Download - Jenkins & scriptable build
![Page 1: Jenkins & scriptable build](https://reader036.vdocuments.mx/reader036/viewer/2022062400/587d0f491a28abae148b5683/html5/thumbnails/1.jpg)
Jenkins & Scriptable Build
![Page 2: Jenkins & scriptable build](https://reader036.vdocuments.mx/reader036/viewer/2022062400/587d0f491a28abae148b5683/html5/thumbnails/2.jpg)
What’s Up?
![Page 3: Jenkins & scriptable build](https://reader036.vdocuments.mx/reader036/viewer/2022062400/587d0f491a28abae148b5683/html5/thumbnails/3.jpg)
![Page 4: Jenkins & scriptable build](https://reader036.vdocuments.mx/reader036/viewer/2022062400/587d0f491a28abae148b5683/html5/thumbnails/4.jpg)
Why Pipeline• Complex build/test/deploy pipelines
• traditional Jenkins projects too rigid
• sometimes need custom logic
• Stages, human input, parallelism, …
• Long-running build steps survive Jenkins restarts
![Page 5: Jenkins & scriptable build](https://reader036.vdocuments.mx/reader036/viewer/2022062400/587d0f491a28abae148b5683/html5/thumbnails/5.jpg)
Why “as code”?• Overall job definition is a script
• calls your build tools and scripts for details
• Script can be versioned alongside project sources
• experimental branches
• code review!
• Keep less configuration in $JENKINS_HOME
![Page 6: Jenkins & scriptable build](https://reader036.vdocuments.mx/reader036/viewer/2022062400/587d0f491a28abae148b5683/html5/thumbnails/6.jpg)
Multibranch Build• Branch with a Jenkinsfile → one subproject
• that is your Workflow script
• just checkout scm to get full source tree
• Can edit Jenkinsfile in your branch
• revision matches sources
![Page 7: Jenkins & scriptable build](https://reader036.vdocuments.mx/reader036/viewer/2022062400/587d0f491a28abae148b5683/html5/thumbnails/7.jpg)
Organization Folders• New folder type: “organization”
• each item is a multibranch Pipeline project
• adds/removes projects automatically
• Only configuration is Git repo + credentials
• one step closer to “code as config”
![Page 8: Jenkins & scriptable build](https://reader036.vdocuments.mx/reader036/viewer/2022062400/587d0f491a28abae148b5683/html5/thumbnails/8.jpg)
Pipeline Plugin for Docker
• Simple entry point to Docker-related functions
• Build images from Dockerfile
• Test images in temporary containers
• Push to Docker Hub or private Docker registry
![Page 9: Jenkins & scriptable build](https://reader036.vdocuments.mx/reader036/viewer/2022062400/587d0f491a28abae148b5683/html5/thumbnails/9.jpg)
Docker as Build Environment
• Run build steps inside a container!✴ use a standard image from Docker Hub✴ or from your company’s registry✴ or build it from project sources
• Use generic Linux slaves• Reproduce CI environment on your laptop• Pipeline controls container lifecycle
docker.image('maven:3.3.3-jdk8').inside {sh 'mvn verify'}
![Page 10: Jenkins & scriptable build](https://reader036.vdocuments.mx/reader036/viewer/2022062400/587d0f491a28abae148b5683/html5/thumbnails/10.jpg)
Dockerized Test Env
![Page 11: Jenkins & scriptable build](https://reader036.vdocuments.mx/reader036/viewer/2022062400/587d0f491a28abae148b5683/html5/thumbnails/11.jpg)
![Page 12: Jenkins & scriptable build](https://reader036.vdocuments.mx/reader036/viewer/2022062400/587d0f491a28abae148b5683/html5/thumbnails/12.jpg)
DemoStable Build Env
• Multi-branch job monitor
• Concurrent build (docker & no shared infra.)
• < 15 mins for commit stage
![Page 13: Jenkins & scriptable build](https://reader036.vdocuments.mx/reader036/viewer/2022062400/587d0f491a28abae148b5683/html5/thumbnails/13.jpg)
Reference• New Jenkins Server (LDAP)
• Jenkins pipeline plugin tutorial
• Jenkins pipeline reference card
• Plugins compatibility
• Introduction @CloudBees
![Page 14: Jenkins & scriptable build](https://reader036.vdocuments.mx/reader036/viewer/2022062400/587d0f491a28abae148b5683/html5/thumbnails/14.jpg)
SCM ChangeSetFrom scm change set to determine which component should be built:
• 3 ways you can get the SCM changes
• From Jenkins web api
• More ….