0
0
Jenkinsdevops~10 mins

Why Jenkins for automation - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to start a Jenkins pipeline with a simple stage.

Jenkins
pipeline {
  agent any
  stages {
    stage('Build') {
      steps {
        [1] 'echo Building...'
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
Ash
Brun
Cexecute
Dstart
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'run' or 'execute' which are not Jenkins pipeline steps.
2fill in blank
medium

Complete the code to trigger a Jenkins job automatically after a code push.

Jenkins
pipeline {
  triggers {
    [1] 'H/5 * * * *'
  }
  stages {
    stage('Test') {
      steps {
        sh 'echo Testing...'
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
Aschedule
Bcron
CpollSCM
Dtimer
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'cron' or 'timer' which are not Jenkins triggers for SCM polling.
3fill in blank
hard

Fix the error in the Jenkins pipeline code to archive build artifacts.

Jenkins
pipeline {
  agent any
  stages {
    stage('Archive') {
      steps {
        archiveArtifacts artifacts: '[1]'
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
A'**/*.txt'
B'build.log'
C'src/*.java'
D'**/*.jar'
Attempts:
3 left
💡 Hint
Common Mistakes
Using patterns that do not match build outputs like source code or logs.
4fill in blank
hard

Fill both blanks to define environment variables and use them in a Jenkins pipeline.

Jenkins
pipeline {
  agent any
  environment {
    GREETING = [1]
  }
  stages {
    stage('Say Hello') {
      steps {
        sh 'echo [2]'
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
A'Hello, Jenkins!'
B$GREETING
CGREETING
D'Hi there!'
Attempts:
3 left
💡 Hint
Common Mistakes
Using variable name without $ in shell command, or missing quotes in environment value.
5fill in blank
hard

Fill all three blanks to create a Jenkins pipeline that builds, tests, and deploys with proper stages.

Jenkins
pipeline {
  agent any
  stages {
    stage('Build') {
      steps {
        sh '[1]'
      }
    }
    stage('Test') {
      steps {
        sh '[2]'
      }
    }
    stage('Deploy') {
      steps {
        sh '[3]'
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
Amake build
Bmake test
Cmake deploy
Dmake clean
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'make clean' in build or deploy stages, or mixing order of commands.