0
0
Jenkinsdevops~10 mins

Pipeline visualization and debugging in Jenkins - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to start a Jenkins pipeline with a declarative syntax.

Jenkins
pipeline {
    agent any
    stages {
        stage('Build') {
            steps {
                [1] 'echo Building...'
            }
        }
    }
}
Drag options to blanks, or click blank then click option'
Arun
Bcommand
Cexecute
Dsh
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'run' or 'execute' which are not Jenkins pipeline steps.
2fill in blank
medium

Complete the code to add a post-build action that always runs.

Jenkins
post {
    [1] {
        echo 'Cleaning up workspace'
    }
}
Drag options to blanks, or click blank then click option'
Asuccess
Bfailure
Calways
Dunstable
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'failure' or 'success' which run only on those results.
3fill in blank
hard

Fix the error in the stage name to enable proper visualization.

Jenkins
stage('[1]') {
    steps {
        echo 'Testing...'
    }
}
Drag options to blanks, or click blank then click option'
ATest Stage
BTestStage
Ctest stage
DTest_Stage
Attempts:
3 left
💡 Hint
Common Mistakes
Using spaces in stage names causing visualization issues.
4fill in blank
hard

Fill both blanks to correctly define a parallel stage with two branches.

Jenkins
parallel {
    branch1: {
        steps {
            [1] 'echo Branch 1'
        }
    }
    branch2: {
        steps {
            [2] 'echo Branch 2'
        }
    }
}
Drag options to blanks, or click blank then click option'
Ash
Bscript
Cbat
Decho
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing different steps causing inconsistent execution.
5fill in blank
hard

Fill all three blanks to add a timeout and catch errors in a scripted pipeline.

Jenkins
try {
    timeout(time: [1], unit: '[2]') {
        [3] {
            echo 'Running long task'
        }
    }
} catch (err) {
    echo "Error: ${err}"
}
Drag options to blanks, or click blank then click option'
A30
BMINUTES
Cnode
DSECONDS
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase units or missing the node block.