0
0
Jenkinsdevops~10 mins

Why pipeline quality matters in Jenkins - Test Your Understanding

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

Complete the code to define a Jenkins pipeline stage named 'Build'.

Jenkins
stage('[1]') {
    steps {
        echo 'Building the project'
    }
}
Drag options to blanks, or click blank then click option'
AClean
BTest
CDeploy
DBuild
Attempts:
3 left
💡 Hint
Common Mistakes
Using a wrong stage name like 'Test' or 'Deploy' here.
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'
Afailure
Bsuccess
Calways
Dunstable
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'success' or 'failure' which run conditionally.
3fill in blank
hard

Fix the error in the pipeline syntax to correctly define an agent.

Jenkins
pipeline {
    agent [1]
    stages {
        stage('Test') {
            steps {
                echo 'Running tests'
            }
        }
    }
}
Drag options to blanks, or click blank then click option'
Aany
B'any'
Cnode
D'node'
Attempts:
3 left
💡 Hint
Common Mistakes
Putting quotes around 'any' causing syntax errors.
4fill in blank
hard

Fill both blanks to create a stage that runs only when the branch is 'main'.

Jenkins
stage('Deploy') {
    when {
        [1] '[2]'
    }
    steps {
        echo 'Deploying to production'
    }
}
Drag options to blanks, or click blank then click option'
Abranch
Benvironment
Cmain
Dfeature
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'environment' or wrong branch names like 'feature'.
5fill in blank
hard

Fill all three blanks to define a pipeline with an agent, environment variable, and a stage.

Jenkins
pipeline {
    agent [1]
    environment {
        APP_ENV = '[2]'
    }
    stages {
        stage('[3]') {
            steps {
                echo "Environment is $APP_ENV"
            }
        }
    }
}
Drag options to blanks, or click blank then click option'
Aany
Bproduction
CDeploy
Dmain
Attempts:
3 left
💡 Hint
Common Mistakes
Using quotes around agent, wrong environment values, or incorrect stage names.