SlideShare a Scribd company logo
1 of 25
Jenkins as a Service
Code all the way down
Steve Mactaggart
Application Delivery Evangineer
The moving parts
Infrastructure (AWS / ECS)
Application (Jenkins)
Configuration (Jenkins Jobs)
The moving parts - AS CODE
Infrastructure (AWS / ECS)
Application (Jenkins)
Configuration (Jenkins Jobs)
CloudFormation
Docker containers
Groovy / Jenkins DSL
Everything as code
• Consistently repeatable process
• Enables a strong self service workflow
• Highly visible traceability of change
• Roll forward / rollback
The moving parts - Infrastructure
Infrastructure (AWS / ECS)
Application (Jenkins)
Configuration (Jenkins Jobs)
CloudFormation
Docker containers
Groovy / Jenkins DSL
Infrastructure
• Infrastructure captured as Code
• Designed for easy re-use per team
• Deployable into existing VPCs
• Common location to share learned lessons
Infrastructure / AWS
EC2
Infrastructure - Simplified
ap-southeast-2bap-southeast-2a
ECS agent auto-scaling group
ECS master auto-scaling group
EC2 EC2
Infrastructure / AWS /
CloudFormation
ECS configuration
Master ECR
Agent ECR
AWS ECS
CloudWatch logs
EC2
Infrastructure
ap-southeast-2bap-southeast-2a
ECS agent auto-scaling group
ECS master auto-scaling groupECS configuration
Master ECR
Agent ECR
Legend
ECS ScaleDown
function
ECS Memory
Reservation Alarm
Termination Event
AWS ECS
EC2 EC2
Query for tasks running on host
Continue the ASG lifecycle hook
Publish intent to
terminate
Watch for ScaleUp
/ ScaleDown alarm
Consume
message
Containers download configuration
ECSLaunches
AgentTask
Launch / Terminate
EC2 Instance
Jenkins Schedules
new Task via ECS
JenkinsAgent
phoneshometo
Mastercontainer
Direct TCP call
S3 download
AWS API Call
Retrieve Master container from ECR
Retrieve Agent container from ECR
EC2instance
registerswith
ECS
Agentcontainer
registerswithmaster
ALB routes web traffic
Infrastructure / AWS /
CloudFormation
CloudWatch logs
EC2 / ECS logs shipped
to CloudWatch
Infrastructure
• Example CloudFormation
• https://bitbucket.org/stevemac/dock
erfiles/src/282408c04239/cloudforma
tion/?at=master
• 2 stacks
• Infrastructure (2x ECS clusters)
• Cluster - Jenkins Master Service
The moving parts - Application
Infrastructure (AWS / ECS)
Application (Jenkins)
Configuration (Jenkins Jobs)
CloudFormation / Terraform
Docker containers
Groovy / Jenkins DSL
EC2
Jenkins in Docker
ap-southeast-2bap-southeast-2a
ECS agent auto-scaling group
ECS master auto-scaling group
EC2 EC2
ECS configuration
Master ECR
Agent ECR
AWS ECS
CloudWatch logs
Jenkins Application /
Docker containers
Jenkins
Master
Jenkins
Agents
The Jenkins Master and its Agents
• Jenkins is an Application
• We understand the Docker application workflow
• Immutable Applications increase confidence of changes
• Based of official JenkinsCI base containers
• From jenkinsci/Jenkins
• From jenkinsci/slave
• Extended to include specific build and deployment tools
• Python / AWSCli / etc
Jenkins Application /
Docker containers
Jenkins master - Dockerfile
Jenkins Application /
Docker containers
Jenkins agent - Dockerfile
Jenkins Application /
Docker containers
Jenkins in Docker
• Many plugins in-use:
• build-pipeline-plugin
• amazon-ecs
• delivery-pipeline-plugin
• build-monitor-plugin
• gitlab-merge-request-Jenkins
• Etc…
• State persisted through Docker volume mount
• Example Master and Agent Docker containers
• https://bitbucket.org/stevemac/dockerfiles/src/
The moving parts - Configuration
Infrastructure (AWS / ECS)
Application (Jenkins)
Configuration (Jenkins Jobs)
CloudFormation / Terraform
Docker containers
Groovy / Jenkins DSL
Configuration as Code - setup
• Start of the configuration delivered in Dockerfiles
• Configuration and ssh keys downloaded from S3 bucket
• Supplied to container as Environment variable
Configuration / Groovy
Configuration as Code - setup
• Runtime configuration automated through use of custom Groovy
initialisation scripts within the container
• Groovy is used to configure:
• Jenkins credentials
• ECS Cluster configuration
• Jenkins Bootstrap job
• Executed as part of Dockerfile entrypoint
Configuration / Groovy
Pipeline as Code - runtime
• Using the Jenkins DSL pipeline
• https://bitbucket.org/jenkinspipeline/jenkins-dsl-examples
• Using the power of Groovy code to create reusable elements
• Version controlled through Git
• Repeatable / reliable / extensible
• See https://github.com/jenkinsci/job-dsl-plugin/wiki/Tutorial---Using-the-Jenkins-Job-DSL
• Automatic documentation available within each Jenkins instance
Configuration / Jenkins DSL
Lets talk about
a Jenkinsfile
approach over a
beer
Pipeline as Code – groovy constructs
Configuration / Groovy /
Jenkins DSL
Pipeline as Code - example
https://bitbucket.org/jenkinspipeline/jenkins-dsl-examples
1. build_pipeline.groovy
Creation of example build jobs - CI
2. delivery_pipeline.groovy
Creation of example jobs for a candidate delivery pipeline - CD
3. views.groovy
Creation of some standard pipeline views
Configuration / Groovy /
Jenkins DSL
Bringing it together
Let our codebases combine
Executed within
ECS Jenkins service
Result of
infrastructure deploy
Performed by operator
Delivery workflow
Build and
Publish Docker
Containers
Launch Stack
Publish keys to
S3 bucket
Create ECS
Service
Retrieve latest
Docker image
from ECR
Launch ECS
Task
Download keys
from S3
Clone groovy
config repo
Launch Jenkins
Master Process
Groovy config
executed
Bootstrap job
generates
pipelines
Followup discussions
1. Migrating to a Jenkins-as-code approach
2. Jenkins DSL vs Jenkinsfiles
3. All about Jenkins State
4. Security in a stateless world
5. Advanced Jenkins DSL patterns
Thanks !
Steve Mactaggart
• Application Delivery Evangineer at Cevo
• @stevemac
Example working code available at:
https://bitbucket.org/stevemac/dockerfiles

More Related Content

What's hot

DevOps with Azure, Kubernetes, and Helm Webinar
DevOps with Azure, Kubernetes, and Helm WebinarDevOps with Azure, Kubernetes, and Helm Webinar
DevOps with Azure, Kubernetes, and Helm WebinarCodefresh
 
Dell Trials and Triumphs using Docker on Client Systems by Sean McGinnis and ...
Dell Trials and Triumphs using Docker on Client Systems by Sean McGinnis and ...Dell Trials and Triumphs using Docker on Client Systems by Sean McGinnis and ...
Dell Trials and Triumphs using Docker on Client Systems by Sean McGinnis and ...Docker, Inc.
 
TestCorner#22 - Evolving QA implementation for Microservices in Viveport
TestCorner#22 - Evolving QA implementation for Microservices in ViveportTestCorner#22 - Evolving QA implementation for Microservices in Viveport
TestCorner#22 - Evolving QA implementation for Microservices in ViveportHTC
 
Build & Deploy Multi-Container Applications to AWS
Build & Deploy Multi-Container Applications to AWSBuild & Deploy Multi-Container Applications to AWS
Build & Deploy Multi-Container Applications to AWSDocker, Inc.
 
Ultimate Guide to Microservice Architecture on Kubernetes
Ultimate Guide to Microservice Architecture on KubernetesUltimate Guide to Microservice Architecture on Kubernetes
Ultimate Guide to Microservice Architecture on Kuberneteskloia
 
Lessons Learned Building a Container App Library
Lessons Learned Building a Container App LibraryLessons Learned Building a Container App Library
Lessons Learned Building a Container App LibraryAdnan Abdulhussein
 
Docker for developers on mac and windows
Docker for developers on mac and windowsDocker for developers on mac and windows
Docker for developers on mac and windowsDocker, Inc.
 
CI/CD with Docker on AWS
CI/CD with Docker on AWSCI/CD with Docker on AWS
CI/CD with Docker on AWSHart Hoover
 
Development environments in seconds using Bitnami containers
Development environments in seconds using Bitnami containersDevelopment environments in seconds using Bitnami containers
Development environments in seconds using Bitnami containersAdnan Abdulhussein
 
Efficient Parallel Testing with Docker by Laura Frank
Efficient Parallel Testing with Docker by Laura FrankEfficient Parallel Testing with Docker by Laura Frank
Efficient Parallel Testing with Docker by Laura FrankDocker, Inc.
 
DockerCon SF 2015: Docker at Lyft
DockerCon SF 2015: Docker at LyftDockerCon SF 2015: Docker at Lyft
DockerCon SF 2015: Docker at LyftDocker, Inc.
 
DCEU 18: 5 Patterns for Success in Application Transformation
DCEU 18: 5 Patterns for Success in Application TransformationDCEU 18: 5 Patterns for Success in Application Transformation
DCEU 18: 5 Patterns for Success in Application TransformationDocker, Inc.
 
Using Docker Hub at Scale to Support Micro Focus' Delivery and Deployment Model
Using Docker Hub at Scale to Support Micro Focus' Delivery and Deployment ModelUsing Docker Hub at Scale to Support Micro Focus' Delivery and Deployment Model
Using Docker Hub at Scale to Support Micro Focus' Delivery and Deployment ModelDocker, Inc.
 
CI/CD Pipeline mit Gitlab CI und Kubernetes
CI/CD Pipeline mit Gitlab CI und KubernetesCI/CD Pipeline mit Gitlab CI und Kubernetes
CI/CD Pipeline mit Gitlab CI und Kubernetesinovex GmbH
 
Node.js Rocks in Docker for Dev and Ops
Node.js Rocks in Docker for Dev and OpsNode.js Rocks in Docker for Dev and Ops
Node.js Rocks in Docker for Dev and OpsBret Fisher
 
CI/CD with Openshift and Jenkins
CI/CD with Openshift and JenkinsCI/CD with Openshift and Jenkins
CI/CD with Openshift and JenkinsAri LiVigni
 
Lean Cloud Starterkit - Beta
Lean Cloud Starterkit - BetaLean Cloud Starterkit - Beta
Lean Cloud Starterkit - BetaDennis Seidel
 
Java in a world of containers
Java in a world of containersJava in a world of containers
Java in a world of containersDocker, Inc.
 
Intro to docker - innovation demo 2022
Intro to docker - innovation demo 2022Intro to docker - innovation demo 2022
Intro to docker - innovation demo 2022Hussain Mansoor
 

What's hot (20)

DevOps with Azure, Kubernetes, and Helm Webinar
DevOps with Azure, Kubernetes, and Helm WebinarDevOps with Azure, Kubernetes, and Helm Webinar
DevOps with Azure, Kubernetes, and Helm Webinar
 
Dell Trials and Triumphs using Docker on Client Systems by Sean McGinnis and ...
Dell Trials and Triumphs using Docker on Client Systems by Sean McGinnis and ...Dell Trials and Triumphs using Docker on Client Systems by Sean McGinnis and ...
Dell Trials and Triumphs using Docker on Client Systems by Sean McGinnis and ...
 
TestCorner#22 - Evolving QA implementation for Microservices in Viveport
TestCorner#22 - Evolving QA implementation for Microservices in ViveportTestCorner#22 - Evolving QA implementation for Microservices in Viveport
TestCorner#22 - Evolving QA implementation for Microservices in Viveport
 
Build & Deploy Multi-Container Applications to AWS
Build & Deploy Multi-Container Applications to AWSBuild & Deploy Multi-Container Applications to AWS
Build & Deploy Multi-Container Applications to AWS
 
Ultimate Guide to Microservice Architecture on Kubernetes
Ultimate Guide to Microservice Architecture on KubernetesUltimate Guide to Microservice Architecture on Kubernetes
Ultimate Guide to Microservice Architecture on Kubernetes
 
Lessons Learned Building a Container App Library
Lessons Learned Building a Container App LibraryLessons Learned Building a Container App Library
Lessons Learned Building a Container App Library
 
Docker for developers on mac and windows
Docker for developers on mac and windowsDocker for developers on mac and windows
Docker for developers on mac and windows
 
CI/CD with Docker on AWS
CI/CD with Docker on AWSCI/CD with Docker on AWS
CI/CD with Docker on AWS
 
Development environments in seconds using Bitnami containers
Development environments in seconds using Bitnami containersDevelopment environments in seconds using Bitnami containers
Development environments in seconds using Bitnami containers
 
Efficient Parallel Testing with Docker by Laura Frank
Efficient Parallel Testing with Docker by Laura FrankEfficient Parallel Testing with Docker by Laura Frank
Efficient Parallel Testing with Docker by Laura Frank
 
Kubernetes CI/CD with Helm
Kubernetes CI/CD with HelmKubernetes CI/CD with Helm
Kubernetes CI/CD with Helm
 
DockerCon SF 2015: Docker at Lyft
DockerCon SF 2015: Docker at LyftDockerCon SF 2015: Docker at Lyft
DockerCon SF 2015: Docker at Lyft
 
DCEU 18: 5 Patterns for Success in Application Transformation
DCEU 18: 5 Patterns for Success in Application TransformationDCEU 18: 5 Patterns for Success in Application Transformation
DCEU 18: 5 Patterns for Success in Application Transformation
 
Using Docker Hub at Scale to Support Micro Focus' Delivery and Deployment Model
Using Docker Hub at Scale to Support Micro Focus' Delivery and Deployment ModelUsing Docker Hub at Scale to Support Micro Focus' Delivery and Deployment Model
Using Docker Hub at Scale to Support Micro Focus' Delivery and Deployment Model
 
CI/CD Pipeline mit Gitlab CI und Kubernetes
CI/CD Pipeline mit Gitlab CI und KubernetesCI/CD Pipeline mit Gitlab CI und Kubernetes
CI/CD Pipeline mit Gitlab CI und Kubernetes
 
Node.js Rocks in Docker for Dev and Ops
Node.js Rocks in Docker for Dev and OpsNode.js Rocks in Docker for Dev and Ops
Node.js Rocks in Docker for Dev and Ops
 
CI/CD with Openshift and Jenkins
CI/CD with Openshift and JenkinsCI/CD with Openshift and Jenkins
CI/CD with Openshift and Jenkins
 
Lean Cloud Starterkit - Beta
Lean Cloud Starterkit - BetaLean Cloud Starterkit - Beta
Lean Cloud Starterkit - Beta
 
Java in a world of containers
Java in a world of containersJava in a world of containers
Java in a world of containers
 
Intro to docker - innovation demo 2022
Intro to docker - innovation demo 2022Intro to docker - innovation demo 2022
Intro to docker - innovation demo 2022
 

Similar to Jenkins as a Service - Code all the way down

(DVO305) Turbocharge YContinuous Deployment Pipeline with Containers
(DVO305) Turbocharge YContinuous Deployment Pipeline with Containers(DVO305) Turbocharge YContinuous Deployment Pipeline with Containers
(DVO305) Turbocharge YContinuous Deployment Pipeline with ContainersAmazon Web Services
 
Pipeline as code - new feature in Jenkins 2
Pipeline as code - new feature in Jenkins 2Pipeline as code - new feature in Jenkins 2
Pipeline as code - new feature in Jenkins 2Michal Ziarnik
 
04_Azure Kubernetes Service: Basic Practices for Developers_GAB2019
04_Azure Kubernetes Service: Basic Practices for Developers_GAB201904_Azure Kubernetes Service: Basic Practices for Developers_GAB2019
04_Azure Kubernetes Service: Basic Practices for Developers_GAB2019Kumton Suttiraksiri
 
Pipelining DevOps with Jenkins and AWS
Pipelining DevOps with Jenkins and AWSPipelining DevOps with Jenkins and AWS
Pipelining DevOps with Jenkins and AWSJimmy Ray
 
Continuous Delivery to Amazon EC2 Container Service
Continuous Delivery to Amazon EC2 Container ServiceContinuous Delivery to Amazon EC2 Container Service
Continuous Delivery to Amazon EC2 Container ServiceAmazon Web Services
 
DevOps World | Jenkins World 2018 and The Future of Jenkins
DevOps World | Jenkins World 2018 and The Future of JenkinsDevOps World | Jenkins World 2018 and The Future of Jenkins
DevOps World | Jenkins World 2018 and The Future of JenkinsNigel Charman
 
Continuous Delivery to Amazon ECS - AWS August Webinar Series
Continuous Delivery to Amazon ECS - AWS August Webinar SeriesContinuous Delivery to Amazon ECS - AWS August Webinar Series
Continuous Delivery to Amazon ECS - AWS August Webinar SeriesAmazon Web Services
 
Cicd pixelfederation
Cicd pixelfederationCicd pixelfederation
Cicd pixelfederationJuraj Hantak
 
Docker and kubernetes
Docker and kubernetesDocker and kubernetes
Docker and kubernetesDongwon Kim
 
JUC Europe 2015: From Virtual Machines to Containers: Achieving Continuous In...
JUC Europe 2015: From Virtual Machines to Containers: Achieving Continuous In...JUC Europe 2015: From Virtual Machines to Containers: Achieving Continuous In...
JUC Europe 2015: From Virtual Machines to Containers: Achieving Continuous In...CloudBees
 
Jenkins vs. AWS CodePipeline (AWS User Group Berlin)
Jenkins vs. AWS CodePipeline (AWS User Group Berlin)Jenkins vs. AWS CodePipeline (AWS User Group Berlin)
Jenkins vs. AWS CodePipeline (AWS User Group Berlin)Steffen Gebert
 
Continuous Delivery to Amazon EC2 Container Service
Continuous Delivery to Amazon EC2 Container ServiceContinuous Delivery to Amazon EC2 Container Service
Continuous Delivery to Amazon EC2 Container ServiceAmazon Web Services
 
2016 Docker Palo Alto - CD with ECS and Jenkins
2016 Docker Palo Alto -  CD with ECS and Jenkins2016 Docker Palo Alto -  CD with ECS and Jenkins
2016 Docker Palo Alto - CD with ECS and JenkinsTracy Kennedy
 
Docker dev ops for cd meetup 12-14
Docker dev ops for cd meetup 12-14Docker dev ops for cd meetup 12-14
Docker dev ops for cd meetup 12-14Simon Storm
 
Enabling Hybrid Workflows with Docker/Mesos @Orbitz
Enabling Hybrid Workflows with Docker/Mesos @OrbitzEnabling Hybrid Workflows with Docker/Mesos @Orbitz
Enabling Hybrid Workflows with Docker/Mesos @OrbitzSteve Hoffman
 
Microservices with containers in the cloud
Microservices with containers in the cloudMicroservices with containers in the cloud
Microservices with containers in the cloudEugene Fedorenko
 
Docker and Puppet for Continuous Integration
Docker and Puppet for Continuous IntegrationDocker and Puppet for Continuous Integration
Docker and Puppet for Continuous IntegrationGiacomo Vacca
 
Priming Your Teams For Microservice Deployment to the Cloud
Priming Your Teams For Microservice Deployment to the CloudPriming Your Teams For Microservice Deployment to the Cloud
Priming Your Teams For Microservice Deployment to the CloudMatt Callanan
 

Similar to Jenkins as a Service - Code all the way down (20)

(DVO305) Turbocharge YContinuous Deployment Pipeline with Containers
(DVO305) Turbocharge YContinuous Deployment Pipeline with Containers(DVO305) Turbocharge YContinuous Deployment Pipeline with Containers
(DVO305) Turbocharge YContinuous Deployment Pipeline with Containers
 
Pipeline as code - new feature in Jenkins 2
Pipeline as code - new feature in Jenkins 2Pipeline as code - new feature in Jenkins 2
Pipeline as code - new feature in Jenkins 2
 
04_Azure Kubernetes Service: Basic Practices for Developers_GAB2019
04_Azure Kubernetes Service: Basic Practices for Developers_GAB201904_Azure Kubernetes Service: Basic Practices for Developers_GAB2019
04_Azure Kubernetes Service: Basic Practices for Developers_GAB2019
 
Pipelining DevOps with Jenkins and AWS
Pipelining DevOps with Jenkins and AWSPipelining DevOps with Jenkins and AWS
Pipelining DevOps with Jenkins and AWS
 
Continuous Delivery to Amazon EC2 Container Service
Continuous Delivery to Amazon EC2 Container ServiceContinuous Delivery to Amazon EC2 Container Service
Continuous Delivery to Amazon EC2 Container Service
 
DevOps World | Jenkins World 2018 and The Future of Jenkins
DevOps World | Jenkins World 2018 and The Future of JenkinsDevOps World | Jenkins World 2018 and The Future of Jenkins
DevOps World | Jenkins World 2018 and The Future of Jenkins
 
Continuous Delivery to Amazon ECS - AWS August Webinar Series
Continuous Delivery to Amazon ECS - AWS August Webinar SeriesContinuous Delivery to Amazon ECS - AWS August Webinar Series
Continuous Delivery to Amazon ECS - AWS August Webinar Series
 
Cicd pixelfederation
Cicd pixelfederationCicd pixelfederation
Cicd pixelfederation
 
Docker and kubernetes
Docker and kubernetesDocker and kubernetes
Docker and kubernetes
 
JUC Europe 2015: From Virtual Machines to Containers: Achieving Continuous In...
JUC Europe 2015: From Virtual Machines to Containers: Achieving Continuous In...JUC Europe 2015: From Virtual Machines to Containers: Achieving Continuous In...
JUC Europe 2015: From Virtual Machines to Containers: Achieving Continuous In...
 
From Virtual Machines to Containers
From Virtual Machines to ContainersFrom Virtual Machines to Containers
From Virtual Machines to Containers
 
Jenkins vs. AWS CodePipeline (AWS User Group Berlin)
Jenkins vs. AWS CodePipeline (AWS User Group Berlin)Jenkins vs. AWS CodePipeline (AWS User Group Berlin)
Jenkins vs. AWS CodePipeline (AWS User Group Berlin)
 
dockerSAW
dockerSAWdockerSAW
dockerSAW
 
Continuous Delivery to Amazon EC2 Container Service
Continuous Delivery to Amazon EC2 Container ServiceContinuous Delivery to Amazon EC2 Container Service
Continuous Delivery to Amazon EC2 Container Service
 
2016 Docker Palo Alto - CD with ECS and Jenkins
2016 Docker Palo Alto -  CD with ECS and Jenkins2016 Docker Palo Alto -  CD with ECS and Jenkins
2016 Docker Palo Alto - CD with ECS and Jenkins
 
Docker dev ops for cd meetup 12-14
Docker dev ops for cd meetup 12-14Docker dev ops for cd meetup 12-14
Docker dev ops for cd meetup 12-14
 
Enabling Hybrid Workflows with Docker/Mesos @Orbitz
Enabling Hybrid Workflows with Docker/Mesos @OrbitzEnabling Hybrid Workflows with Docker/Mesos @Orbitz
Enabling Hybrid Workflows with Docker/Mesos @Orbitz
 
Microservices with containers in the cloud
Microservices with containers in the cloudMicroservices with containers in the cloud
Microservices with containers in the cloud
 
Docker and Puppet for Continuous Integration
Docker and Puppet for Continuous IntegrationDocker and Puppet for Continuous Integration
Docker and Puppet for Continuous Integration
 
Priming Your Teams For Microservice Deployment to the Cloud
Priming Your Teams For Microservice Deployment to the CloudPriming Your Teams For Microservice Deployment to the Cloud
Priming Your Teams For Microservice Deployment to the Cloud
 

More from Steve Mactaggart

5 DevOps things that have changed because of COVID-19
5 DevOps things that have changed because of COVID-195 DevOps things that have changed because of COVID-19
5 DevOps things that have changed because of COVID-19Steve Mactaggart
 
Are you a leadership group or a leadership team?
Are you a leadership group or a leadership team?Are you a leadership group or a leadership team?
Are you a leadership group or a leadership team?Steve Mactaggart
 
Test driven infrastructure
Test driven infrastructureTest driven infrastructure
Test driven infrastructureSteve Mactaggart
 
The changing role of the team leader in a DevOps transformation
The changing role of the team leader in a DevOps transformationThe changing role of the team leader in a DevOps transformation
The changing role of the team leader in a DevOps transformationSteve Mactaggart
 

More from Steve Mactaggart (6)

5 DevOps things that have changed because of COVID-19
5 DevOps things that have changed because of COVID-195 DevOps things that have changed because of COVID-19
5 DevOps things that have changed because of COVID-19
 
Introduction to CI/CD
Introduction to CI/CDIntroduction to CI/CD
Introduction to CI/CD
 
Are you a leadership group or a leadership team?
Are you a leadership group or a leadership team?Are you a leadership group or a leadership team?
Are you a leadership group or a leadership team?
 
Test driven infrastructure
Test driven infrastructureTest driven infrastructure
Test driven infrastructure
 
The changing role of the team leader in a DevOps transformation
The changing role of the team leader in a DevOps transformationThe changing role of the team leader in a DevOps transformation
The changing role of the team leader in a DevOps transformation
 
Head in the clouds
Head in the cloudsHead in the clouds
Head in the clouds
 

Recently uploaded

From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 

Recently uploaded (20)

From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 

Jenkins as a Service - Code all the way down

  • 1. Jenkins as a Service Code all the way down Steve Mactaggart Application Delivery Evangineer
  • 2. The moving parts Infrastructure (AWS / ECS) Application (Jenkins) Configuration (Jenkins Jobs)
  • 3. The moving parts - AS CODE Infrastructure (AWS / ECS) Application (Jenkins) Configuration (Jenkins Jobs) CloudFormation Docker containers Groovy / Jenkins DSL
  • 4. Everything as code • Consistently repeatable process • Enables a strong self service workflow • Highly visible traceability of change • Roll forward / rollback
  • 5. The moving parts - Infrastructure Infrastructure (AWS / ECS) Application (Jenkins) Configuration (Jenkins Jobs) CloudFormation Docker containers Groovy / Jenkins DSL
  • 6. Infrastructure • Infrastructure captured as Code • Designed for easy re-use per team • Deployable into existing VPCs • Common location to share learned lessons Infrastructure / AWS
  • 7. EC2 Infrastructure - Simplified ap-southeast-2bap-southeast-2a ECS agent auto-scaling group ECS master auto-scaling group EC2 EC2 Infrastructure / AWS / CloudFormation ECS configuration Master ECR Agent ECR AWS ECS CloudWatch logs
  • 8. EC2 Infrastructure ap-southeast-2bap-southeast-2a ECS agent auto-scaling group ECS master auto-scaling groupECS configuration Master ECR Agent ECR Legend ECS ScaleDown function ECS Memory Reservation Alarm Termination Event AWS ECS EC2 EC2 Query for tasks running on host Continue the ASG lifecycle hook Publish intent to terminate Watch for ScaleUp / ScaleDown alarm Consume message Containers download configuration ECSLaunches AgentTask Launch / Terminate EC2 Instance Jenkins Schedules new Task via ECS JenkinsAgent phoneshometo Mastercontainer Direct TCP call S3 download AWS API Call Retrieve Master container from ECR Retrieve Agent container from ECR EC2instance registerswith ECS Agentcontainer registerswithmaster ALB routes web traffic Infrastructure / AWS / CloudFormation CloudWatch logs EC2 / ECS logs shipped to CloudWatch
  • 9. Infrastructure • Example CloudFormation • https://bitbucket.org/stevemac/dock erfiles/src/282408c04239/cloudforma tion/?at=master • 2 stacks • Infrastructure (2x ECS clusters) • Cluster - Jenkins Master Service
  • 10. The moving parts - Application Infrastructure (AWS / ECS) Application (Jenkins) Configuration (Jenkins Jobs) CloudFormation / Terraform Docker containers Groovy / Jenkins DSL
  • 11. EC2 Jenkins in Docker ap-southeast-2bap-southeast-2a ECS agent auto-scaling group ECS master auto-scaling group EC2 EC2 ECS configuration Master ECR Agent ECR AWS ECS CloudWatch logs Jenkins Application / Docker containers Jenkins Master Jenkins Agents
  • 12. The Jenkins Master and its Agents • Jenkins is an Application • We understand the Docker application workflow • Immutable Applications increase confidence of changes • Based of official JenkinsCI base containers • From jenkinsci/Jenkins • From jenkinsci/slave • Extended to include specific build and deployment tools • Python / AWSCli / etc Jenkins Application / Docker containers
  • 13. Jenkins master - Dockerfile Jenkins Application / Docker containers
  • 14. Jenkins agent - Dockerfile Jenkins Application / Docker containers
  • 15. Jenkins in Docker • Many plugins in-use: • build-pipeline-plugin • amazon-ecs • delivery-pipeline-plugin • build-monitor-plugin • gitlab-merge-request-Jenkins • Etc… • State persisted through Docker volume mount • Example Master and Agent Docker containers • https://bitbucket.org/stevemac/dockerfiles/src/
  • 16. The moving parts - Configuration Infrastructure (AWS / ECS) Application (Jenkins) Configuration (Jenkins Jobs) CloudFormation / Terraform Docker containers Groovy / Jenkins DSL
  • 17. Configuration as Code - setup • Start of the configuration delivered in Dockerfiles • Configuration and ssh keys downloaded from S3 bucket • Supplied to container as Environment variable Configuration / Groovy
  • 18. Configuration as Code - setup • Runtime configuration automated through use of custom Groovy initialisation scripts within the container • Groovy is used to configure: • Jenkins credentials • ECS Cluster configuration • Jenkins Bootstrap job • Executed as part of Dockerfile entrypoint Configuration / Groovy
  • 19. Pipeline as Code - runtime • Using the Jenkins DSL pipeline • https://bitbucket.org/jenkinspipeline/jenkins-dsl-examples • Using the power of Groovy code to create reusable elements • Version controlled through Git • Repeatable / reliable / extensible • See https://github.com/jenkinsci/job-dsl-plugin/wiki/Tutorial---Using-the-Jenkins-Job-DSL • Automatic documentation available within each Jenkins instance Configuration / Jenkins DSL Lets talk about a Jenkinsfile approach over a beer
  • 20. Pipeline as Code – groovy constructs Configuration / Groovy / Jenkins DSL
  • 21. Pipeline as Code - example https://bitbucket.org/jenkinspipeline/jenkins-dsl-examples 1. build_pipeline.groovy Creation of example build jobs - CI 2. delivery_pipeline.groovy Creation of example jobs for a candidate delivery pipeline - CD 3. views.groovy Creation of some standard pipeline views Configuration / Groovy / Jenkins DSL
  • 22. Bringing it together Let our codebases combine
  • 23. Executed within ECS Jenkins service Result of infrastructure deploy Performed by operator Delivery workflow Build and Publish Docker Containers Launch Stack Publish keys to S3 bucket Create ECS Service Retrieve latest Docker image from ECR Launch ECS Task Download keys from S3 Clone groovy config repo Launch Jenkins Master Process Groovy config executed Bootstrap job generates pipelines
  • 24. Followup discussions 1. Migrating to a Jenkins-as-code approach 2. Jenkins DSL vs Jenkinsfiles 3. All about Jenkins State 4. Security in a stateless world 5. Advanced Jenkins DSL patterns
  • 25. Thanks ! Steve Mactaggart • Application Delivery Evangineer at Cevo • @stevemac Example working code available at: https://bitbucket.org/stevemac/dockerfiles