SlideShare uma empresa Scribd logo
1 de 32
Baixar para ler offline
© 2017 CloudBees, Inc. All Rights Reserved. 1
Distributed Pipeline Architecture
with CloudBees Jenkins Enterprise
and Docker
WORKSHOP
© 2017 CloudBees, Inc. All Rights Reserved. 2
Prerequisites
● A GitHub Account - github.com
○ with a personal access token -
https://github.com/settings/tokens
● A Docker Hub Account - hub.docker.com
● General understanding of Jenkins Pipeline
© 2017 CloudBees, Inc. All Rights Reserved. 3
DevOps Toolkit 2.1
REVIEW
© 2017 CloudBees, Inc. All Rights Reserved. 4
CD enables speed
A single CD pipeline provides your
team speed with little instability...
© 2017 CloudBees, Inc. All Rights Reserved. 5
But as CD scales business risk increases
As other teams adopt CD instability
increases and speed decreases
© 2017 CloudBees, Inc. All Rights Reserved. 6
With CloudBees, continuous scaling just works
DPA enables scale with isolated,
on-demand containerized CD servers
for each of your team
...in fact you can move faster
© 2017 CloudBees, Inc. All Rights Reserved. 7
CloudBees Distributed Pipeline Architecture
CloudBees Distributed Pipeline Architecture reduces business
risk through:
• Project Isolation
• DevOps project teams get their own Jenkins Master
• Distributes workload across masters
• Cross project contamination of workspaces and data is
eliminated
• Scalable Architecture
• Scaling and elasticity achieved through use of cluster
managed containers
• Data Isolation
• Data contamination from previous executions are easily
eliminated
© 2017 CloudBees, Inc. All Rights Reserved. 8
CloudBees Jenkins Enterprise Cluster
Automated Cluster Install
• Robust CLI for managing cluster
• Automated infrastructure
provisioning for AWS and
OpenStack
Elastic/Ephemeral Jenkins Agents
• Dynamically spins up Docker
images as agents, stops and
removes on job completion
Built-in Fault Tolerance
• JENKINS_HOME is externally
managed to provide HA for
CJOC & Jenkins Masters
• Unhealthy CJOC & Jenkins
Masters are automatically
restarted on a healthy node
Straightforward, Fast, Dynamic
Provisioning of Jenkins Masters
• Easy & quick to create Masters
of any size
• Entire Jenkins Master lifecycle is
managed by CJOC
© 2017 CloudBees, Inc. All Rights Reserved. 9
CloudBees Jenkins Enterprise Installation
Standing up a new CloudBees Jenkins Enterprise Cluster is straightforward
and fast:
• Download CJE install/CLI binary to a dedicated admin workstation
• Create a CJE project:
• $ cje init-project cje-project aws
• From the CJE project directory, initialize the new cluster:
• $ cje prepare cluster-init
• Configure common settings in cluster-init.config
• Verify and Install
• $ cje verify
• $ cje apply
• In 30 minutes or so, you will have a new CJE cluster
© 2017 CloudBees, Inc. All Rights Reserved. 10
HANDS-ON TIME
CREATE A CJE USER ACCOUNT
● Open https://goo.gl/3tRlSQ
● Click on the Create an account link
● Enter information for all fields for the Sign up form
○ Username - needs to match your GitHub
username
○ Password - no restrictions, keep it simple
● Click the Sign Up button
● Success ...
© 2017 CloudBees, Inc. All Rights Reserved. 11
Fast Provisioning of Jenkins Masters
DEMO
© 2017 CloudBees, Inc. All Rights Reserved. 12
Jenkins Masters as Code
DEMO
© 2017 CloudBees, Inc. All Rights Reserved. 13
FROM cloudbees/cje-mm:2.46.3.2
#skip setup wizard and disable CLI
ENV JVM_OPTS -Djenkins.install.runSetupWizard=false -Djenkins.CLI.disabled=true -server
#jenkins master configuration (groovy scripts)
COPY ./init.groovy.d/* /usr/share/jenkins/ref/init.groovy.d/
COPY ./license-activated/*
/usr/share/jenkins/ref/license-activated-or-renewed-after-expiration.groovy.d/
COPY ./quickstart/* /usr/share/jenkins/ref/quickstart.groovy.d/
#install additional plugins
ENV JENKINS_UC http://jenkins-updates.cloudbees.com
COPY plugins.txt plugins.txt
COPY jenkins-support /usr/local/bin/jenkins-support
COPY install-plugins.sh /usr/local/bin/install-plugins.sh
RUN /usr/local/bin/install-plugins.sh $(cat plugins.txt)
1
2
3
4
5
6
© 2017 CloudBees, Inc. All Rights Reserved. 14
Configure CJOC to Use Custom Master Image
beedemo/cje-mm:2.46.3.2
DEMO
© 2017 CloudBees, Inc. All Rights Reserved. 15
HANDS-ON TIME
PROVISION A MANAGED MASTER
● Open {CJE CJOC URL}
● Select New Item from the left menu
● Enter your first initial and last name as the item
name -> kmadel
● Select Managed Master as the item type
● Click OK
● On the Managed Master configuration page, under
Provisioning, click the Advanced button and
update the Disk value to 10
● Click the Save button at the bottom
© 2017 CloudBees, Inc. All Rights Reserved. 16
HANDS-ON TIME
FORK GITHUB REPOS
● Login to github.com
● Open github.com/beedemo/go-demo
● Click on the Fork button on the top-right of the page
● Select the GitHub account/Organization your are using for
this workshop
● Repeat for:
○ github.com/beedemo/maven-project
○ github.com/beedemo/jenkins-dind-agent
© 2017 CloudBees, Inc. All Rights Reserved. 17
Explore the Config-as-Code Managed Master
DEMO
© 2017 CloudBees, Inc. All Rights Reserved. 18
Credentials Management
DEMO
© 2017 CloudBees, Inc. All Rights Reserved. 19
HANDS-ON TIME
CONFIGURE DOCKER HUB CREDENTIALS
● Open {YOUR MASTER URL} and click the Credentials link
in the left menu
● Under Stores scoped to Jenkins, click on the (global) link
● Click the Add Credentials link in the left menu
● The Kind should default to Username with password - if
not select that from the dropdown
● Enter your Docker Hub Username and Password
● Enter an easy to remember ID such as docker-hub-kmadel
● Click the OK button at the bottom
© 2017 CloudBees, Inc. All Rights Reserved. 20
Blue Ocean and Declarative Syntax for Pipeline
Blue Ocean is the new user interface that rethinks the user experience of
Jenkins with a focus on Pipeline.
Declarative syntax for Jenkins Pipelines designed to…
• Have smarter default behavior for most use cases
• Make Pipelines more structured
• Provide better error reporting and handling
© 2017 CloudBees, Inc. All Rights Reserved. 21
Explore the go-demo Jenkinsfile
DEMO
© 2017 CloudBees, Inc. All Rights Reserved. 22
HANDS-ON TIME
UPDATE THE GO-DEMO JENKINSFILE
● Login to github.com and open github.com/{user/org}/go-demo
● Switch to the build-cache-image branch
● Open the Jenkinsfile in edit mode
● Update the DOCKER_HUB_USER to match your Docker Hub
username
● Update the DOCKER_CREDENTIAL_ID to match the ID of the
Docker Hub credential you created earlier
© 2017 CloudBees, Inc. All Rights Reserved. 23
HANDS-ON TIME
UPDATE THE GO-DEMO JENKINSFILE
● Go to the bottom to the go-demo Jenkinsfile - to the post section
● Add a success condition block, and within that block add the following step
to send a Slack notification:
○ slackSend(color: "good", message: "${env.JOB_NAME} completed
successfully, details at ${env.RUN_DISPLAY_URL}")
● Now we will add a failure block with a slight modified Slack step:
○ slackSend(color: "danger", message: "${env.JOB_NAME} failed,
details at ${env.RUN_DISPLAY_URL}")
● Add whatever Commit changes description you like and then click the
Commit changes button to commit to the build-cache-image branch
© 2017 CloudBees, Inc. All Rights Reserved. 24
Palace and Docker Agent Templates
• Palace is a built-in Shared Agent Cloud for instant access to dynamically
provisioned Jenkins Agents
• It provides Dynamic, Ephemeral and Elastic Docker Image based agents
• Easy to configure Docker Agent Templates - individual items, not part of
one massive Jenkins Cloud configuration file
• Allows defining agent templates as separate items - no other Jenkins Cloud
plugin has this level of self-service capability
• The Palace service has built-in fault tolerance identical to what is provided
for CJOC and Managed Masters
• If the cluster node running the Palace service goes down, Marathon will
automatically restart it on another healthy node
© 2017 CloudBees, Inc. All Rights Reserved. 25
HANDS-ON TIME
CREATE A DOCKER AGENT TEMPLATE
● Open {YOUR MASTER URL} and click the New Item link in the left menu
● Enter dind-compose for the item name
● Next, scroll down and select Docker Agent Template as the item type and click
the OK button
● Update the CPU shares to 0.2 and the Memory (MB) to 512
● For the Definition Image enter localhost:31095/beedemo/dind-compose-agent:go-demo
● Next, under Options, click the Add button and select Launch in privileged
mode - this is required to run Docker in a Docker container
● Click Add again, select Use a custom docker shell command and enter
wrapper.sh as the Custom shell command
● Finally, click the Save button
© 2017 CloudBees, Inc. All Rights Reserved. 26
HANDS-ON TIME
CREATE A GITHUB ORG PROJECT WITH BLUE OCEAN
● Open {YOUR MASTER URL} and click on the Blue Ocean link at the top of the page
● Next, click on the New Pipeline button on the left side of the screen
● Click on the Github button
● Enter your GitHub personal access token and click Connect
● Next select your GitHub user or a GitHub Organization you are using for this
workshop
● Select Auto-discover Jenkinsfiles to scan all of the repos in your select
account/Organization
● Click on the Create Pipelines button and watch Blue Ocean discover the repos that
have branches containing a Jenkinsfile and then click on the build-cache-image
branch
© 2017 CloudBees, Inc. All Rights Reserved. 27
HANDS-ON TIME
CREATE A PULL REQUEST TO THE GO-DEMO MASTER BRANCH
● Exit to the Jenkins classic UI by clicking on the Go to classic button
● Next, click on the Organization Folder project, click the Configure link, then click the
Save button and then switch back to the Blue Ocean UI
● Now login to github.com and open github.com/{user/org}/settings/hooks
● Next go to github.com/{user/org}/go-demo and switch to the build-cache-image
branch and click the New pull request button
● GitHub will switch you to the beedemo Org, select the base fork drop-down and
select your account/org, then select the base drop-down and select master
● Next click the Create pull request button and you should see that All checks have
passed already, so go ahead and click on Merge pull request and then Confirm
merge
● Switch back over to your Managed Master and the Blue Ocean UI
© 2017 CloudBees, Inc. All Rights Reserved. 28
Pipeline Project Recognizers and Custom Marker Files
• By default, the Pipeline Organization and Multi-branch scans will only
include repositories that have at least one branch with a file named
Jenkinsfile
• CloudBees has a feature that allows you to specify arbitrary file names,
such as pom.xml, to use instead of Jenkinsfile when scanning branches
for Pipeline Organization Folder and Multi-branch projects
• This feature allows you to automatically provide standard automation for
teams that aren’t ready to start using Jenkins Pipeline and Jenkinsfiles
quite yet
© 2017 CloudBees, Inc. All Rights Reserved. 29
HANDS-ON TIME
SET UP CUSTOM MARKER FILES
● Exit to the Jenkins classic UI by clicking on the Go to classic button
● Next, click on the Organization Folder project, click the Configure link
● Scroll down to the Project Recognizers section and click the Add button
underneath the default Pipeline Jenkinsfile project recognizer and select
Custom script
● Enter pom.xml for the Marker file, then under the Pipeline section, select
Pipeline script from SCM as the Definition and Git as the SCM
● Enter https://github.com/beedemo/custom-marker-pipelines for the
Repository URL and then enter pom-Jenkinsfile as the Script Path
● Now repeat, only specifying Dockerfile as the Marker file and
Dockerfile-Jenkinsfile as the Script Path, the click the Save button
© 2017 CloudBees, Inc. All Rights Reserved. 30
Explore the beedemo/custom-marker-pipelines Repo
DEMO
© 2017 CloudBees, Inc. All Rights Reserved. 31
UNUSED SLIDES BELOW
© 2017 CloudBees, Inc. All Rights Reserved. 32
HANDS-ON TIME
CONFIGURE GITHUB CREDENTIALS
● Click the Global credentials (unrestricted) link at the top of the
page
● Click the Add Credentials link in the left menu
● The Kind should default to Username with password - if not
select that from the dropdown
● Enter your GitHub account id as the Username value
● Enter your GitHub access token as the Password value
● Enter an easy to remember ID such as github-token-kmadel
● Click the OK button at the bottom

Mais conteúdo relacionado

Mais procurados

Mais procurados (20)

Continuous Delivery with Jenkins & Kubernetes @ Sky
Continuous Delivery with Jenkins & Kubernetes @ SkyContinuous Delivery with Jenkins & Kubernetes @ Sky
Continuous Delivery with Jenkins & Kubernetes @ Sky
 
Analyze This! CloudBees Jenkins Cluster Operations and Analytics
Analyze This! CloudBees Jenkins Cluster Operations and AnalyticsAnalyze This! CloudBees Jenkins Cluster Operations and Analytics
Analyze This! CloudBees Jenkins Cluster Operations and Analytics
 
Continuous Delivery to Kubernetes with Jenkins and Helm
Continuous Delivery to Kubernetes with Jenkins and HelmContinuous Delivery to Kubernetes with Jenkins and Helm
Continuous Delivery to Kubernetes with Jenkins and Helm
 
Using Docker for Testing
Using Docker for TestingUsing Docker for Testing
Using Docker for Testing
 
Next-gen DevOps engineering with Docker and Kubernetes by Antons Kranga
Next-gen DevOps engineering with Docker and Kubernetes by Antons KrangaNext-gen DevOps engineering with Docker and Kubernetes by Antons Kranga
Next-gen DevOps engineering with Docker and Kubernetes by Antons Kranga
 
Testing with Docker
Testing with DockerTesting with Docker
Testing with Docker
 
DockerCon SF 2015: Docker in the New York Times Newsroom
DockerCon SF 2015: Docker in the New York Times NewsroomDockerCon SF 2015: Docker in the New York Times Newsroom
DockerCon SF 2015: Docker in the New York Times Newsroom
 
DockerCon SF 2015: Keynote Day 1
DockerCon SF 2015: Keynote Day 1DockerCon SF 2015: Keynote Day 1
DockerCon SF 2015: Keynote Day 1
 
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
 
Continuous Delivery to Kubernetes with Jenkins and Helm
Continuous Delivery to Kubernetes with Jenkins and HelmContinuous Delivery to Kubernetes with Jenkins and Helm
Continuous Delivery to Kubernetes with Jenkins and Helm
 
DockerCon 15 Keynote - Day 2
DockerCon 15 Keynote - Day 2DockerCon 15 Keynote - Day 2
DockerCon 15 Keynote - Day 2
 
How to Improve Your Image Builds Using Advance Docker Build
How to Improve Your Image Builds Using Advance Docker BuildHow to Improve Your Image Builds Using Advance Docker Build
How to Improve Your Image Builds Using Advance Docker Build
 
7 Habits of Highly Effective Jenkins Users
7 Habits of Highly Effective Jenkins Users7 Habits of Highly Effective Jenkins Users
7 Habits of Highly Effective Jenkins Users
 
Continuous Delivery Pipeline with Docker and Jenkins
Continuous Delivery Pipeline with Docker and JenkinsContinuous Delivery Pipeline with Docker and Jenkins
Continuous Delivery Pipeline with Docker and Jenkins
 
Exploring Docker in CI/CD
Exploring Docker in CI/CDExploring Docker in CI/CD
Exploring Docker in CI/CD
 
Cloud Native CI/CD with Jenkins X and Knative Pipelines
Cloud Native CI/CD with Jenkins X and Knative PipelinesCloud Native CI/CD with Jenkins X and Knative Pipelines
Cloud Native CI/CD with Jenkins X and Knative Pipelines
 
From Continuous Integration to Continuous Delivery with Jenkins - javaland.de...
From Continuous Integration to Continuous Delivery with Jenkins - javaland.de...From Continuous Integration to Continuous Delivery with Jenkins - javaland.de...
From Continuous Integration to Continuous Delivery with Jenkins - javaland.de...
 
Continuous Delivery with Jenkins
Continuous Delivery with JenkinsContinuous Delivery with Jenkins
Continuous Delivery with Jenkins
 
Git and GitHub for Documentation
Git and GitHub for DocumentationGit and GitHub for Documentation
Git and GitHub for Documentation
 
Docker Container As A Service - JAX 2016
Docker Container As A Service - JAX 2016Docker Container As A Service - JAX 2016
Docker Container As A Service - JAX 2016
 

Semelhante a Distributed Docker Pipeline Architecture with CloudBees Jenkins Enterprise

Semelhante a Distributed Docker Pipeline Architecture with CloudBees Jenkins Enterprise (20)

Docker and Jenkins [as code]
Docker and Jenkins [as code]Docker and Jenkins [as code]
Docker and Jenkins [as code]
 
Cicd.pdf
Cicd.pdfCicd.pdf
Cicd.pdf
 
Introduction to Jenkins X - a beginner's guide
Introduction to Jenkins X - a beginner's guideIntroduction to Jenkins X - a beginner's guide
Introduction to Jenkins X - a beginner's guide
 
Jenkins x gitops
Jenkins x gitopsJenkins x gitops
Jenkins x gitops
 
IBM Container Service Overview
IBM Container Service OverviewIBM Container Service Overview
IBM Container Service Overview
 
Continuous Delivery with CloudBees Core
Continuous Delivery with CloudBees CoreContinuous Delivery with CloudBees Core
Continuous Delivery with CloudBees Core
 
Developing Microservices Directly in AKS/Kubernetes
Developing Microservices Directly in AKS/KubernetesDeveloping Microservices Directly in AKS/Kubernetes
Developing Microservices Directly in AKS/Kubernetes
 
Dockerfile best practices
Dockerfile best practicesDockerfile best practices
Dockerfile best practices
 
Introduction of CCE and DevCloud
Introduction of CCE and DevCloudIntroduction of CCE and DevCloud
Introduction of CCE and DevCloud
 
There's More to Docker than the Container: The Docker Platform - Kendrick Col...
There's More to Docker than the Container: The Docker Platform - Kendrick Col...There's More to Docker than the Container: The Docker Platform - Kendrick Col...
There's More to Docker than the Container: The Docker Platform - Kendrick Col...
 
Docking, loading, running domino on docker v12
Docking, loading, running domino on docker v12Docking, loading, running domino on docker v12
Docking, loading, running domino on docker v12
 
Rome .NET Conference 2024 - Remote Conference
Rome .NET Conference 2024  - Remote ConferenceRome .NET Conference 2024  - Remote Conference
Rome .NET Conference 2024 - Remote Conference
 
Using DC/OS for Continuous Delivery - DevPulseCon 2017
Using DC/OS for Continuous Delivery - DevPulseCon 2017Using DC/OS for Continuous Delivery - DevPulseCon 2017
Using DC/OS for Continuous Delivery - DevPulseCon 2017
 
Ansible Meetup FI - Ansible use cases with enterprise application
Ansible Meetup FI - Ansible use cases with enterprise application Ansible Meetup FI - Ansible use cases with enterprise application
Ansible Meetup FI - Ansible use cases with enterprise application
 
[@NaukriEngineering] Docker 101
[@NaukriEngineering] Docker 101[@NaukriEngineering] Docker 101
[@NaukriEngineering] Docker 101
 
Tech Talk: DevOps at LeanIX @ Startup Camp Berlin
Tech Talk: DevOps at LeanIX @ Startup Camp BerlinTech Talk: DevOps at LeanIX @ Startup Camp Berlin
Tech Talk: DevOps at LeanIX @ Startup Camp Berlin
 
Introduction to Containers: From Docker to Kubernetes and everything in-between
Introduction to Containers:  From Docker to Kubernetes and everything in-betweenIntroduction to Containers:  From Docker to Kubernetes and everything in-between
Introduction to Containers: From Docker to Kubernetes and everything in-between
 
DCEU 18: Building Your Development Pipeline
DCEU 18: Building Your Development PipelineDCEU 18: Building Your Development Pipeline
DCEU 18: Building Your Development Pipeline
 
Docker for Developers - php[tek] 2017
Docker for Developers - php[tek] 2017Docker for Developers - php[tek] 2017
Docker for Developers - php[tek] 2017
 
Ci/CD - Stop wasting time, Automate your deployments
Ci/CD  - Stop wasting time, Automate your deploymentsCi/CD  - Stop wasting time, Automate your deployments
Ci/CD - Stop wasting time, Automate your deployments
 

Último

TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 

Último (20)

BUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxBUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
ManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide DeckManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide Deck
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
 

Distributed Docker Pipeline Architecture with CloudBees Jenkins Enterprise

  • 1. © 2017 CloudBees, Inc. All Rights Reserved. 1 Distributed Pipeline Architecture with CloudBees Jenkins Enterprise and Docker WORKSHOP
  • 2. © 2017 CloudBees, Inc. All Rights Reserved. 2 Prerequisites ● A GitHub Account - github.com ○ with a personal access token - https://github.com/settings/tokens ● A Docker Hub Account - hub.docker.com ● General understanding of Jenkins Pipeline
  • 3. © 2017 CloudBees, Inc. All Rights Reserved. 3 DevOps Toolkit 2.1 REVIEW
  • 4. © 2017 CloudBees, Inc. All Rights Reserved. 4 CD enables speed A single CD pipeline provides your team speed with little instability...
  • 5. © 2017 CloudBees, Inc. All Rights Reserved. 5 But as CD scales business risk increases As other teams adopt CD instability increases and speed decreases
  • 6. © 2017 CloudBees, Inc. All Rights Reserved. 6 With CloudBees, continuous scaling just works DPA enables scale with isolated, on-demand containerized CD servers for each of your team ...in fact you can move faster
  • 7. © 2017 CloudBees, Inc. All Rights Reserved. 7 CloudBees Distributed Pipeline Architecture CloudBees Distributed Pipeline Architecture reduces business risk through: • Project Isolation • DevOps project teams get their own Jenkins Master • Distributes workload across masters • Cross project contamination of workspaces and data is eliminated • Scalable Architecture • Scaling and elasticity achieved through use of cluster managed containers • Data Isolation • Data contamination from previous executions are easily eliminated
  • 8. © 2017 CloudBees, Inc. All Rights Reserved. 8 CloudBees Jenkins Enterprise Cluster Automated Cluster Install • Robust CLI for managing cluster • Automated infrastructure provisioning for AWS and OpenStack Elastic/Ephemeral Jenkins Agents • Dynamically spins up Docker images as agents, stops and removes on job completion Built-in Fault Tolerance • JENKINS_HOME is externally managed to provide HA for CJOC & Jenkins Masters • Unhealthy CJOC & Jenkins Masters are automatically restarted on a healthy node Straightforward, Fast, Dynamic Provisioning of Jenkins Masters • Easy & quick to create Masters of any size • Entire Jenkins Master lifecycle is managed by CJOC
  • 9. © 2017 CloudBees, Inc. All Rights Reserved. 9 CloudBees Jenkins Enterprise Installation Standing up a new CloudBees Jenkins Enterprise Cluster is straightforward and fast: • Download CJE install/CLI binary to a dedicated admin workstation • Create a CJE project: • $ cje init-project cje-project aws • From the CJE project directory, initialize the new cluster: • $ cje prepare cluster-init • Configure common settings in cluster-init.config • Verify and Install • $ cje verify • $ cje apply • In 30 minutes or so, you will have a new CJE cluster
  • 10. © 2017 CloudBees, Inc. All Rights Reserved. 10 HANDS-ON TIME CREATE A CJE USER ACCOUNT ● Open https://goo.gl/3tRlSQ ● Click on the Create an account link ● Enter information for all fields for the Sign up form ○ Username - needs to match your GitHub username ○ Password - no restrictions, keep it simple ● Click the Sign Up button ● Success ...
  • 11. © 2017 CloudBees, Inc. All Rights Reserved. 11 Fast Provisioning of Jenkins Masters DEMO
  • 12. © 2017 CloudBees, Inc. All Rights Reserved. 12 Jenkins Masters as Code DEMO
  • 13. © 2017 CloudBees, Inc. All Rights Reserved. 13 FROM cloudbees/cje-mm:2.46.3.2 #skip setup wizard and disable CLI ENV JVM_OPTS -Djenkins.install.runSetupWizard=false -Djenkins.CLI.disabled=true -server #jenkins master configuration (groovy scripts) COPY ./init.groovy.d/* /usr/share/jenkins/ref/init.groovy.d/ COPY ./license-activated/* /usr/share/jenkins/ref/license-activated-or-renewed-after-expiration.groovy.d/ COPY ./quickstart/* /usr/share/jenkins/ref/quickstart.groovy.d/ #install additional plugins ENV JENKINS_UC http://jenkins-updates.cloudbees.com COPY plugins.txt plugins.txt COPY jenkins-support /usr/local/bin/jenkins-support COPY install-plugins.sh /usr/local/bin/install-plugins.sh RUN /usr/local/bin/install-plugins.sh $(cat plugins.txt) 1 2 3 4 5 6
  • 14. © 2017 CloudBees, Inc. All Rights Reserved. 14 Configure CJOC to Use Custom Master Image beedemo/cje-mm:2.46.3.2 DEMO
  • 15. © 2017 CloudBees, Inc. All Rights Reserved. 15 HANDS-ON TIME PROVISION A MANAGED MASTER ● Open {CJE CJOC URL} ● Select New Item from the left menu ● Enter your first initial and last name as the item name -> kmadel ● Select Managed Master as the item type ● Click OK ● On the Managed Master configuration page, under Provisioning, click the Advanced button and update the Disk value to 10 ● Click the Save button at the bottom
  • 16. © 2017 CloudBees, Inc. All Rights Reserved. 16 HANDS-ON TIME FORK GITHUB REPOS ● Login to github.com ● Open github.com/beedemo/go-demo ● Click on the Fork button on the top-right of the page ● Select the GitHub account/Organization your are using for this workshop ● Repeat for: ○ github.com/beedemo/maven-project ○ github.com/beedemo/jenkins-dind-agent
  • 17. © 2017 CloudBees, Inc. All Rights Reserved. 17 Explore the Config-as-Code Managed Master DEMO
  • 18. © 2017 CloudBees, Inc. All Rights Reserved. 18 Credentials Management DEMO
  • 19. © 2017 CloudBees, Inc. All Rights Reserved. 19 HANDS-ON TIME CONFIGURE DOCKER HUB CREDENTIALS ● Open {YOUR MASTER URL} and click the Credentials link in the left menu ● Under Stores scoped to Jenkins, click on the (global) link ● Click the Add Credentials link in the left menu ● The Kind should default to Username with password - if not select that from the dropdown ● Enter your Docker Hub Username and Password ● Enter an easy to remember ID such as docker-hub-kmadel ● Click the OK button at the bottom
  • 20. © 2017 CloudBees, Inc. All Rights Reserved. 20 Blue Ocean and Declarative Syntax for Pipeline Blue Ocean is the new user interface that rethinks the user experience of Jenkins with a focus on Pipeline. Declarative syntax for Jenkins Pipelines designed to… • Have smarter default behavior for most use cases • Make Pipelines more structured • Provide better error reporting and handling
  • 21. © 2017 CloudBees, Inc. All Rights Reserved. 21 Explore the go-demo Jenkinsfile DEMO
  • 22. © 2017 CloudBees, Inc. All Rights Reserved. 22 HANDS-ON TIME UPDATE THE GO-DEMO JENKINSFILE ● Login to github.com and open github.com/{user/org}/go-demo ● Switch to the build-cache-image branch ● Open the Jenkinsfile in edit mode ● Update the DOCKER_HUB_USER to match your Docker Hub username ● Update the DOCKER_CREDENTIAL_ID to match the ID of the Docker Hub credential you created earlier
  • 23. © 2017 CloudBees, Inc. All Rights Reserved. 23 HANDS-ON TIME UPDATE THE GO-DEMO JENKINSFILE ● Go to the bottom to the go-demo Jenkinsfile - to the post section ● Add a success condition block, and within that block add the following step to send a Slack notification: ○ slackSend(color: "good", message: "${env.JOB_NAME} completed successfully, details at ${env.RUN_DISPLAY_URL}") ● Now we will add a failure block with a slight modified Slack step: ○ slackSend(color: "danger", message: "${env.JOB_NAME} failed, details at ${env.RUN_DISPLAY_URL}") ● Add whatever Commit changes description you like and then click the Commit changes button to commit to the build-cache-image branch
  • 24. © 2017 CloudBees, Inc. All Rights Reserved. 24 Palace and Docker Agent Templates • Palace is a built-in Shared Agent Cloud for instant access to dynamically provisioned Jenkins Agents • It provides Dynamic, Ephemeral and Elastic Docker Image based agents • Easy to configure Docker Agent Templates - individual items, not part of one massive Jenkins Cloud configuration file • Allows defining agent templates as separate items - no other Jenkins Cloud plugin has this level of self-service capability • The Palace service has built-in fault tolerance identical to what is provided for CJOC and Managed Masters • If the cluster node running the Palace service goes down, Marathon will automatically restart it on another healthy node
  • 25. © 2017 CloudBees, Inc. All Rights Reserved. 25 HANDS-ON TIME CREATE A DOCKER AGENT TEMPLATE ● Open {YOUR MASTER URL} and click the New Item link in the left menu ● Enter dind-compose for the item name ● Next, scroll down and select Docker Agent Template as the item type and click the OK button ● Update the CPU shares to 0.2 and the Memory (MB) to 512 ● For the Definition Image enter localhost:31095/beedemo/dind-compose-agent:go-demo ● Next, under Options, click the Add button and select Launch in privileged mode - this is required to run Docker in a Docker container ● Click Add again, select Use a custom docker shell command and enter wrapper.sh as the Custom shell command ● Finally, click the Save button
  • 26. © 2017 CloudBees, Inc. All Rights Reserved. 26 HANDS-ON TIME CREATE A GITHUB ORG PROJECT WITH BLUE OCEAN ● Open {YOUR MASTER URL} and click on the Blue Ocean link at the top of the page ● Next, click on the New Pipeline button on the left side of the screen ● Click on the Github button ● Enter your GitHub personal access token and click Connect ● Next select your GitHub user or a GitHub Organization you are using for this workshop ● Select Auto-discover Jenkinsfiles to scan all of the repos in your select account/Organization ● Click on the Create Pipelines button and watch Blue Ocean discover the repos that have branches containing a Jenkinsfile and then click on the build-cache-image branch
  • 27. © 2017 CloudBees, Inc. All Rights Reserved. 27 HANDS-ON TIME CREATE A PULL REQUEST TO THE GO-DEMO MASTER BRANCH ● Exit to the Jenkins classic UI by clicking on the Go to classic button ● Next, click on the Organization Folder project, click the Configure link, then click the Save button and then switch back to the Blue Ocean UI ● Now login to github.com and open github.com/{user/org}/settings/hooks ● Next go to github.com/{user/org}/go-demo and switch to the build-cache-image branch and click the New pull request button ● GitHub will switch you to the beedemo Org, select the base fork drop-down and select your account/org, then select the base drop-down and select master ● Next click the Create pull request button and you should see that All checks have passed already, so go ahead and click on Merge pull request and then Confirm merge ● Switch back over to your Managed Master and the Blue Ocean UI
  • 28. © 2017 CloudBees, Inc. All Rights Reserved. 28 Pipeline Project Recognizers and Custom Marker Files • By default, the Pipeline Organization and Multi-branch scans will only include repositories that have at least one branch with a file named Jenkinsfile • CloudBees has a feature that allows you to specify arbitrary file names, such as pom.xml, to use instead of Jenkinsfile when scanning branches for Pipeline Organization Folder and Multi-branch projects • This feature allows you to automatically provide standard automation for teams that aren’t ready to start using Jenkins Pipeline and Jenkinsfiles quite yet
  • 29. © 2017 CloudBees, Inc. All Rights Reserved. 29 HANDS-ON TIME SET UP CUSTOM MARKER FILES ● Exit to the Jenkins classic UI by clicking on the Go to classic button ● Next, click on the Organization Folder project, click the Configure link ● Scroll down to the Project Recognizers section and click the Add button underneath the default Pipeline Jenkinsfile project recognizer and select Custom script ● Enter pom.xml for the Marker file, then under the Pipeline section, select Pipeline script from SCM as the Definition and Git as the SCM ● Enter https://github.com/beedemo/custom-marker-pipelines for the Repository URL and then enter pom-Jenkinsfile as the Script Path ● Now repeat, only specifying Dockerfile as the Marker file and Dockerfile-Jenkinsfile as the Script Path, the click the Save button
  • 30. © 2017 CloudBees, Inc. All Rights Reserved. 30 Explore the beedemo/custom-marker-pipelines Repo DEMO
  • 31. © 2017 CloudBees, Inc. All Rights Reserved. 31 UNUSED SLIDES BELOW
  • 32. © 2017 CloudBees, Inc. All Rights Reserved. 32 HANDS-ON TIME CONFIGURE GITHUB CREDENTIALS ● Click the Global credentials (unrestricted) link at the top of the page ● Click the Add Credentials link in the left menu ● The Kind should default to Username with password - if not select that from the dropdown ● Enter your GitHub account id as the Username value ● Enter your GitHub access token as the Password value ● Enter an easy to remember ID such as github-token-kmadel ● Click the OK button at the bottom