0
0
Jenkinsdevops~10 mins

Why patterns solve common problems 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'
ATest
BBuild
CDeploy
DClean
Attempts:
3 left
💡 Hint
Common Mistakes
Using a wrong stage name like 'Test' or 'Deploy' here.
2fill in blank
medium

Complete the code to use the 'agent any' directive in a Jenkins pipeline.

Jenkins
pipeline {
    [1] any
    stages {
        stage('Example') {
            steps {
                echo 'Hello World'
            }
        }
    }
}
Drag options to blanks, or click blank then click option'
Aenvironment
Btools
Cagent
Doptions
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'environment' or 'tools' instead of 'agent'.
3fill in blank
hard

Fix the error in the Jenkins scripted pipeline to correctly echo a message.

Jenkins
node {
    [1] 'Hello from Jenkins!'
}
Drag options to blanks, or click blank then click option'
Aecho
Bprint
Cprintln
Dwrite
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'print' or 'println' which are not Jenkins pipeline commands.
4fill in blank
hard

Fill both blanks to create a declarative pipeline with a 'Build' stage that runs on any agent.

Jenkins
pipeline {
    [1] any
    stages {
        stage('[2]') {
            steps {
                echo 'Building...'
            }
        }
    }
}
Drag options to blanks, or click blank then click option'
Aagent
Benvironment
CBuild
DTest
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'environment' instead of 'agent' or wrong stage name like 'Test'.
5fill in blank
hard

Fill all three blanks to create a pipeline that runs on any agent, has a 'Test' stage, and echoes a test message.

Jenkins
pipeline {
    [1] any
    stages {
        stage('[2]') {
            steps {
                [3] 'Running tests...'
            }
        }
    }
}
Drag options to blanks, or click blank then click option'
Aagent
BTest
Cecho
DBuild
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong stage name or print command.