14
Jenkins & Scriptable Build

Jenkins & scriptable build

Embed Size (px)

Citation preview

Page 1: Jenkins & scriptable build

Jenkins & Scriptable Build

Page 2: Jenkins & scriptable build

What’s Up?

Page 3: Jenkins & scriptable build
Page 4: Jenkins & scriptable build

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

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

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

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

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

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

Dockerized Test Env

Page 11: Jenkins & scriptable build
Page 12: Jenkins & scriptable build

DemoStable Build Env

• Multi-branch job monitor

• Concurrent build (docker & no shared infra.)

• < 15 mins for commit stage

Page 14: Jenkins & scriptable build

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 ….