0
0
Jenkinsdevops~10 mins

What is Continuous Integration in Jenkins - Interactive Quiz & Practice

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

Complete the code to define a Jenkins pipeline that triggers on every code commit.

Jenkins
pipeline {
  agent any
  triggers {
    [1]()
  }
  stages {
    stage('Build') {
      steps {
        echo 'Building...'
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
Atimer
Bcron
CmanualTrigger
DpollSCM
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing cron triggers a build on a schedule, not on code changes.
manualTrigger is not a valid Jenkins trigger.
2fill in blank
medium

Complete the Jenkins pipeline stage to run tests after building the code.

Jenkins
stage('Test') {
  steps {
    sh '[1]'
  }
}
Drag options to blanks, or click blank then click option'
Anpm test
Bnpm deploy
Cnpm build
Dnpm start
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'npm start' runs the app, not tests.
Using 'npm build' compiles but does not test.
3fill in blank
hard

Fix the error in the Jenkinsfile snippet to archive test results correctly.

Jenkins
post {
  always {
    [1] artifacts: 'test-results/*.xml', allowEmptyArchive: true
  }
}
Drag options to blanks, or click blank then click option'
AsaveArtifacts
BarchiveFiles
CarchiveArtifacts
DstoreArtifacts
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'archiveFiles' or 'saveArtifacts' are not valid Jenkins steps.
Misspelling the step name causes pipeline errors.
4fill in blank
hard

Fill both blanks to define environment variables and use them in the build stage.

Jenkins
pipeline {
  agent any
  environment {
    APP_NAME = '[1]'
  }
  stages {
    stage('Build') {
      steps {
        echo "Building $[2]"
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
AMyApp
BYourApp
CAPP_NAME
DBuild
Attempts:
3 left
💡 Hint
Common Mistakes
Putting the app name directly in echo instead of variable.
Using undefined variable names.
5fill in blank
hard

Fill all three blanks to create a post-build action that sends notifications on failure.

Jenkins
post {
  failure {
    [1] {
      subject: '[2] Build Failed',
      body: 'Please check the [3] logs for details.'
    }
  }
}
Drag options to blanks, or click blank then click option'
Aemailext
BJenkins
Cbuild
Demail
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'email' instead of 'emailext' causes errors.
Incorrect subject or body placeholders.