DevOps Classroom Series – 21/Feb/2021

Static Code Analysis

  • We need some kind of a tool to check/evaluate code against the best practices or rules
  • We also need a tool which will help us in understanding the quality of the unit tests written by checking code coverage.
  • SonarQube is a popular tool that fits the description
  • Refer Here to install sonarqube
  • Create an ubuntu/centos vm with atleast 3 GB of RAM
  • To install the latest version of sonarqube Refer Here
  • Analysis of sonarqube can be done by following the steps Refer Here
  • Refer Here for the changeset and Refer Here for the correct version
  • Now lets add wait for Quality Gate Analysis by following the steps Refer Here
  • Refer Here for the changes done
  • Refer the Jenkins pipeline below
pipeline {
    agent { label 'ltecomm'}
    triggers {
        cron('H * * * 1-5')
    stages {
        stage('scm') {
            steps {
                git branch: 'developer', url:''        
        stage('build') {
            steps {
                withSonarQubeEnv('SONAR-7.1') {
                    sh script: 'mvn clean package sonar:sonar'

        stage('post build') {
            steps {
                junit 'gameoflife-web/target/surefire-reports/*.xml'
                archiveArtifacts 'gameoflife-web/target/*.war'
        stage("Quality Gate") {
            steps {
              timeout(time: 1, unit: 'HOURS') {
                waitForQualityGate abortPipeline: true, credentialsId: 'SONAR_TOKEN'
    post {
        always {
            mail to: '', 
                subject: "Status of pipeline ${currentBuild.fullDisplayName}",
                body: "${env.BUILD_URL} has result ${currentBuild.result}"

Artifactory Integration with Jenkins

  • This is used to store the build artifacts Refer Here for installation and configuration
  • Refer to installation steps link Refer Here Preview
  • Once artifactory is setup navigate to the url Refer Here
  • The default username is admin and Password is password
  • Install the plugin as Referred over Here and Refer Here
  • Refer Here for the Jenkins pipeline examples with almost all the technologies
  • Refer Here for the maven example
  • In organizations all the qa and release builds have to be stored in repository.

Git Submodules

  • Consider you have a git repository
    • In this repository we need to store the code from other git repository
  • So lets create a repository Preview
  • Now in this repository you need to have some other git repository Preview Preview

Topics for Evening Session

  • Git Hooks/GitHub Web Hooks
  • Git Branching Strategy
  • Git Tags

Leave a Reply

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

About learningthoughtsadmin