DevOps Classroom Series – 20/Feb/2021

Declarative Pipeline Structure

  • In this section lets try to understand the declarative pipelines structure
  • Now evaluate the image with the pipeline below
pipeline {
    agent { label 'ltecomm'}
    stages {
        stage('scm') {
            steps {
                git 'https://github.com/wakaleo/game-of-life.git'        
            }
        }
        stage('build') {
            steps {
                sh script: 'mvn clean package'
            }
        }
        stage('post build') {
            steps {
                junit 'gameoflife-web/target/surefire-reports/*.xml'
                archiveArtifacts 'gameoflife-web/target/*.war'
            }
        }
    }
}
  • Lets set one build trigger using pipeline. Refer Here for the changeset which uses triggers section Refer Here for the documentation
  • Exercise: Make changes in the pipeline to reflect pollSCM or upstream jobs
  • Now lets try to create parameters in our build job Refer Here
  • Refer Here for the changeset
  • If you need to set any Jenkins Environmental variables Refer Here
  • If you need to use different version of tools which you have configured in Manage Jenkins => Global Tools section, that can be used by using tools section Refer Here
  • Lets add a build timeout of 30 mins
  • Now we can look into the pipeline steps: Refer Here
  • Now lets copy files from one node to other using stash and unstash steps Refer Here for the changeset
  • Now lets create a game of life source code with three branches
    • developer
    • qa
    • release
  • For the repository Refer Here
  • Now lets create Jenkinsfile per branch so that
    • developer build is triggered every Hour
    • qa build is triggered once in a day at 11:59 PM on different node
    • release build is triggered manually
  • Now lets configure one build job which will create one job per git branch
  • Refer Here for the post step
  • If you want to send an extended email Refer Here

Problems to be resolved

  • How do we ensure the code written by developers is meeting standards/best practices => SonarQube
  • We build the project multiple times how do we store the project artifacts so that they can be retrieved in the future => Jfrog/Artifactory
  • Understanding One of the popular branching strategy => Gitflow
  • Understanding git tags and their importance
  • Git Ops => Pull request
  • Git Sub modules
  • Azure DevOps => .net build environment. (Next weekend)

Leave a ReplyCancel reply

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

Please turn AdBlock off
Social Network Integration by Acurax Social Media Branding Company

Discover more from Direct DevOps from Quality Thought

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

Continue reading

Exit mobile version
%%footer%%