Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to start the Jenkins service.
Jenkins
sudo systemctl [1] jenkins Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'stop' instead of 'start' will turn off Jenkins.
Using 'status' only shows info, does not start.
✗ Incorrect
Starting Jenkins with start launches the service so it can run jobs.
2fill in blank
mediumComplete the code to check if Jenkins is running.
Jenkins
sudo systemctl [1] jenkins Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'start' will try to launch Jenkins again.
Using 'enable' changes startup behavior but doesn't show status.
✗ Incorrect
The status command shows if Jenkins is active or stopped.
3fill in blank
hardFix the error in the command to reload Jenkins configuration without restarting.
Jenkins
sudo systemctl [1] jenkins Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'restart' causes downtime.
Using 'stop' turns Jenkins off.
✗ Incorrect
The reload command applies config changes without stopping Jenkins.
4fill in blank
hardFill both blanks to create a Jenkins job that runs a shell command and only triggers on changes.
Jenkins
pipeline {
agent any
triggers {
[1]('[2]')
}
stages {
stage('Build') {
steps {
sh 'echo Building...'
}
}
}
} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'cron' instead of 'pollSCM' triggers on time, not changes.
Wrong cron syntax causes Jenkins to ignore the trigger.
✗ Incorrect
The pollSCM trigger checks for source code changes every 5 minutes using the cron syntax H/5 * * * *.
5fill in blank
hardFill all three blanks to define environment variables and use them in a Jenkins pipeline.
Jenkins
pipeline {
agent any
environment {
[1] = '[2]'
}
stages {
stage('Print') {
steps {
echo "Value is: $[3]"
}
}
}
} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using different names for variable definition and usage.
Forgetting to quote the value string.
✗ Incorrect
Define MY_VAR with value hello_world and use MY_VAR in the echo step to print the value.