DevOps Classroomnotes 28/Feb/2023

Jenkins Multi node configuration

  • Multi node configuration using pem files/private files
  • Configure Game of life



Jenkins 2

  • This is all about Pipeline as code
  • Pipeline as a code refers to creating CI/CD Pipeline in some file format and version control (generally closer to code)
  • Jenkins 1 was predominantly UI oriented, where as in Jenkins 2 the concept of pipelines were introduced natively.
  • Now we write our build steps in these pipelines and then version control.
  • Jenkins has created 2 types of pipelines
    • Scripted Pipeline:
      • This pipeline allows to use Groovy Language directly
      • This is a different approach
    • Declarative Pipeline
      • This pipeline internally uses Groovy but we use Jenkins DSL (Domain Specific Language)
      • Similar for the benifit of classic jenkins users

Groovy

  • There are two popular Java Based Languages
    • Scala (Big Data Purposes)
    • Groovy (Scripting purposes)

Lets Quickly build Gameoflife on node1 using

Scripted pipeline

  • Lets look at below steps for an overview

node('MAVEN_JDK8')
{
    stage('vcs')
    {
        git 'https://github.com/wakaleo/game-of-life.git'
    }
    stage('build') 
    {
        sh 'export PATH="/usr/lib/jvm/java-1.8.0-openjdk-amd64/bin:$PATH" && mvn package'

    }
    stage('postbuild')
    {
        archiveArtifacts artifacts: '**/target/gameoflife.war', followSymlinks: false
        junit '**/surefire-reports/TEST-*.xml'
    }
}
  • Declarative
pipeline {
    agent { label 'MAVEN_JDK8' }
    stages {
        stage('VCS') {
            steps {
                git 'https://github.com/wakaleo/game-of-life.git'
            }
        }
        stage('build') {
            steps {
                sh 'export PATH="/usr/lib/jvm/java-1.8.0-openjdk-amd64/bin:$PATH" && mvn package'
            }
        }
    }

}
Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a comment

Turn on JavaScript to leave a comment.

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

Please turn AdBlock off
Customized Social Media Icons from Acurax Digital Marketing Agency
Exit mobile version
%%footer%%