Complete the code to define a simple Jenkins pipeline stage named 'Build'.
stage('[1]') { steps { echo 'Building the project' } }
The stage block names the pipeline stage. Here, it should be 'Build' to match the task.
Complete the code to declare a variable named 'version' with value '1.0' in a Jenkins pipeline script.
def [1] = '1.0'
In Groovy scripts for Jenkins pipelines, variables are declared with def. The variable name here should be 'version'.
Fix the error in the code to correctly run a shell command in a Jenkins pipeline step.
steps {
sh '[1]'
}The sh step runs shell commands. echo Hello World is a valid shell command.
Fill both blanks to create a Jenkins pipeline script that runs a shell command only if the branch is 'main'.
if (env.BRANCH_NAME [1] '[2]') { sh 'echo Deploying to production' }
The condition checks if the branch name equals 'main' using == and the string 'main'.
Fill all three blanks to create a map in Groovy with keys 'name' and 'status', and a condition to include only if status is 'success'.
def result = [[1]: 'Build', [2]: 'success'] if (result.[3] == 'success') { echo 'Build succeeded' }
The map keys are 'name' and 'status'. The condition checks if result.status equals 'success'.