Pipeline Execution Flows
- Declarative pipeline
- basic structure
pipeline { agent { label 'GOL' } stages { stage('SCM'){ //step } } post { success { } failure { } } } - For all the steps Refer Here
- Refer Here for the basic declarative pipeline to build game of life
- To the jenkinsfile we can add build triggers by using the triggers section Refer Here. The Jenkinsfile will be as shown below
pipeline {
agent { label 'GOL'}
triggers {
cron('H * * * *')
pollSCM('* * * * *')
}
stages {
stage('scm') {
steps {
git branch: 'master', url: 'https://github.com/asquarezone/game-of-life.git'
}
}
stage('build') {
steps {
sh 'mvn package'
}
}
}
post {
success {
archive '**/gameoflife.war'
junit '**/TEST-*.xml'
}
}
}
- Adding manual inputs from user during build Refer Here
Parameters in Jenkins
- A Parameter is use to store a value in variable which can be used in the later build steps.
- Lets create a simple parameter in the Jenkins Freestyle project

- Parameters can be created from jenkins pipelines as well Refer Here
- Refer Here for the parameters added in jenkins pipeline.
- Declarative Pipeline structure

