In this exercise we are going to quickly create a new pipeline to demonstrate how Checkpoints work and how end users can interact with Checkpoints once a job as been built. To test this create a new pipeline job in your personal folder copying and pasting the following code into the Pipeline Script textbox:
pipeline {
agent none
stages {
stage('One') {
agent any
steps {
echo 'Stage One - Step 1'
}
}
stage('Checkpoint') {
agent none
steps {
checkpoint 'Checkpoint'
}
}
stage('Two') {
agent any
steps {
echo 'Stage Two - Step 1'
}
}
}
}
After saving the job click on Build Now to run it.
When the job has completed running you will see a Resume icon in the build's Stage View. Clicking on the Resume icon gives you the ability to:
- Delete - Delete the cached artifacts and configuration for that build;
- Restart - Restart the build from the checkpoint.
Note: Deleting a checkpoint doesn't make the Resume icon vanish.
In the following exercise we are going to demonstrate how you can use the Custom Marker feature of CloudBees Jenkins Enterprise to assign pipeline to a job based on an arbitrary file name like pom.xml.
In order to complete the following exercise you will need to fork the following repository into the Github organization you created in Exercise 2.1:
Once that repository is forked:
- Click on the Github organization project you created in Exercise 2.2.
- Click on Configure
- Under Project Recognizers select Custom Script
- In Marker file type
pom.xml
- Under Pipeline - Definition select Pipeline script from SCM
- Select Git from SCM
- In Repository URL enter:
https://github.com/PipelineHandsOn/custom-marker-files
- Select your credentials from the Credentials menu
- In Script path enter:
Jenkins-pom
- Click on Save
- Click on Scan Organization Now
When the scan is complete your Github Organization project should now have both the sample-rest-server project and the maven-project.