Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to define a stage in a Jenkins pipeline.
Jenkins
stage('[1]') { steps { echo 'Building...' } }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'steps' or 'agent' as the stage name.
✗ Incorrect
The stage block names a step in the pipeline flow, like 'Build'.
2fill in blank
mediumComplete the code to add a stage that runs tests.
Jenkins
stage('[1]') { steps { echo 'Running tests...' } }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Naming the test stage as 'Deploy' or 'Build'.
✗ Incorrect
The stage named 'Test' clearly shows this part runs tests in the pipeline.
3fill in blank
hardFix the error in the stage declaration by completing the blank.
Jenkins
stage([1]) { steps { echo 'Deploying...' } }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Leaving out quotes causes syntax errors.
✗ Incorrect
The stage name must be a string in quotes, like 'Deploy'.
4fill in blank
hardFill both blanks to create a stage named 'Build' with a step that echoes 'Compiling...'.
Jenkins
stage([1]) { steps { echo [2] } }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing stage name and echo message.
✗ Incorrect
The stage name is 'Build' and the echo message is 'Compiling...'.
5fill in blank
hardFill all three blanks to define a pipeline with an agent, a 'Test' stage, and an echo step 'Running tests...'.
Jenkins
pipeline {
agent [1]
stages {
stage([2]) {
steps {
echo [3]
}
}
}
} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong agent name or missing quotes.
✗ Incorrect
The agent is 'any' to run on any available machine, the stage is 'Test', and the echo message is 'Running tests...'.