DevOps Classroom Series – 27/Jul/2021

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 Preview Preview
  • Parameters can be created from jenkins pipelines as well Refer Here
  • Refer Here for the parameters added in jenkins pipeline.
  • Declarative Pipeline structure Preview

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Floating Social Media Icons by Acurax Wordpress Designers

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Visit Us On FacebookVisit Us On LinkedinVisit Us On Youtube