DevOps Classroom Series – 15/May/2020

Jenkins Notifications via Email

  • We need Jenkins to report failures or feedback and for that we will be using Email configuration.

Jenkins Email configuration

  • In all the latest installations of jenkins, a plugin called Email-Ext is already part of basic plugins, if not please install this plugin Preview
  • Navigate to Manage Jenkins => Configure System
    • Navigate to Email Notification Section Preview Preview Preview Preview Preview Preview
    • Naviagate to Extended Email Notification Section Preview

Jenkins Pipeline Project without having much knowledge of groovy

  • Create a Jenkins pipeline project Preview
  • Navigate through all the sections Preview Preview
  • Click on Pipeline Syntax Preview Preview
  • Try to review the steps done for building the project in free style
    1. Git
    2. Invoke Top level targets or mvn package
    3. publish junit test results
    4. archived the artifacts
  • Pipleline which we are using is called as Scripted Pipeline and basic syntax of scripted pipeline
node('<LABEL>') {
    stage('<stage name 1>') {

    }

    stage('<stage name 2>') {
        
    }
}

  • Now lets try to create the basic script for executing our gol and lets have stages scm, build, postbuild

node('REDHAT'){
    stage('scm'){

    }

    stage('build'){

    }

    stage('postbuild'){

    }

}

Preview Preview

  • Now lets use generator to generate script for the git and copy the script to the pipeline Preview Preview

  • Now do the same stuff for other steps Preview Preview Preview

  • Now lets build the project Preview Preview

  • The pipeline will be of more benifit if we have this script for building jenkins in our version control system

    • Store Jenkins pipleline script in a file called as Jenkinsfile in the root directory of your git Preview Preview
    • Now lets simply create a new Jenkins pipeline Job Preview Preview
    • Now build the project Preview
    • Advantage of Jenkinsfile in VCS will help us in having jenkinssteps version controlled and we can make changes in Jenkins jobs without changing ui

Leave a Reply

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

About learningthoughtsadmin