Challenge - 5 Problems
Jenkinsfile Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate1:30remaining
What is the output of this Jenkins pipeline stage?
Consider this Jenkinsfile snippet. What will be printed in the console when the
Build stage runs?Jenkins
pipeline {
agent any
stages {
stage('Build') {
steps {
echo 'Building project...'
}
}
}
}Attempts:
2 left
💡 Hint
Look at the
echo command inside the Build stage.✗ Incorrect
The
echo step prints the given string to the Jenkins console output during the stage execution.❓ Configuration
intermediate1:30remaining
Which Jenkinsfile syntax correctly defines a post-build action?
You want to send a notification only after the pipeline finishes, regardless of success or failure. Which Jenkinsfile snippet correctly uses the
post section?Attempts:
2 left
💡 Hint
The
always block runs no matter what the pipeline result is.✗ Incorrect
The
post { always { ... } } block runs after the pipeline finishes, regardless of success or failure.🔀 Workflow
advanced2:00remaining
What is the correct order of execution in this Jenkins pipeline?
Reorder the stages in the order they will execute in this Jenkinsfile:
Jenkins
pipeline {
agent any
stages {
stage('Test') {
steps { echo 'Testing...' }
}
stage('Build') {
steps { echo 'Building...' }
}
stage('Deploy') {
steps { echo 'Deploying...' }
}
}
}Attempts:
2 left
💡 Hint
Stages run in the order they are defined in the Jenkinsfile.
✗ Incorrect
The pipeline executes stages top to bottom: Test, then Build, then Deploy.
❓ Troubleshoot
advanced1:30remaining
What error will this Jenkinsfile cause?
This Jenkinsfile snippet is used to run a shell command. What error will Jenkins report?
Jenkins
pipeline {
agent any
stages {
stage('Run') {
steps {
sh 'echo Hello World'
}
}
}
}Attempts:
2 left
💡 Hint
Check the quotes around the shell command.
✗ Incorrect
The shell command string is correctly quoted, so it will run and print 'Hello World'.
✅ Best Practice
expert2:30remaining
Which Jenkinsfile snippet correctly uses environment variables for secure credentials?
You want to use a secret password stored in Jenkins credentials inside your pipeline securely. Which snippet correctly accesses the secret?
Attempts:
2 left
💡 Hint
Use the
withCredentials step to access secrets safely.✗ Incorrect
The
withCredentials block injects the secret into an environment variable only for the block scope, keeping it secure.