Challenge - 5 Problems
Jenkins Pipeline Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate2:00remaining
Jenkins Pipeline: Output of a simple stage
What will be the output in the Jenkins console log after running this pipeline snippet?
Selenium Java
pipeline {
agent any
stages {
stage('Hello') {
steps {
echo 'Hello, Jenkins!'
}
}
}
}Attempts:
2 left
💡 Hint
Look at what the echo step does inside a stage.
✗ Incorrect
The echo step prints the given message to the Jenkins console log during the pipeline execution.
🔀 Workflow
intermediate2:00remaining
Jenkins Pipeline: Parallel stages execution
Given this Jenkins pipeline snippet, which stages run in parallel?
Selenium Java
pipeline {
agent any
stages {
stage('Build and Test') {
parallel {
stage('Build') {
steps {
echo 'Building...'
}
}
stage('Test') {
steps {
echo 'Testing...'
}
}
}
}
}
}Attempts:
2 left
💡 Hint
Look at the 'parallel' block inside the 'Build and Test' stage.
✗ Incorrect
The 'Build' and 'Test' stages are nested inside the 'Build and Test' stage and run in parallel as defined by the 'parallel' block.
❓ Configuration
advanced2:00remaining
Jenkins Pipeline: Correct syntax for environment variables
Which option correctly sets environment variables in a Jenkins declarative pipeline?
Selenium Java
pipeline {
agent any
environment {
JAVA_HOME = '/usr/lib/jvm/java-11-openjdk'
PATH = "$JAVA_HOME/bin:$PATH"
}
stages {
stage('Print Env') {
steps {
sh 'echo $JAVA_HOME'
}
}
}
}Attempts:
2 left
💡 Hint
Check the syntax for environment variable assignment in Jenkins declarative pipelines.
✗ Incorrect
In Jenkins declarative pipelines, environment variables are assigned using '=' inside the environment block.
❓ Troubleshoot
advanced2:00remaining
Jenkins Pipeline: Diagnosing a failed stage due to missing agent
A Jenkins pipeline stage fails with the error: 'No agent found for stage'. Which option explains the cause?
Selenium Java
pipeline {
stages {
stage('Build') {
steps {
echo 'Building...'
}
}
}
}Attempts:
2 left
💡 Hint
Every pipeline or stage needs an agent to run on.
✗ Incorrect
Jenkins requires an agent declaration either globally or per stage to allocate an executor for running steps.
✅ Best Practice
expert3:00remaining
Jenkins Pipeline: Best practice for integrating Selenium Java tests
Which Jenkins pipeline snippet best integrates running Selenium Java tests with Maven and archives test reports?
Attempts:
2 left
💡 Hint
Consider running tests and publishing test results properly.
✗ Incorrect
Option D runs Maven tests and publishes test results with the junit step, which is the recommended way to integrate Selenium Java tests in Jenkins.