0
0
Jenkinsdevops~10 mins

Why Pipeline as Code 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 simple Jenkins pipeline.

Jenkins
pipeline {
    agent any
    stages {
        stage('Build') {
            steps {
                [1] 'echo Building...'
            }
        }
    }
}
Drag options to blanks, or click blank then click option'
Aexecute
Bsh
Crun
Dcommand
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'run' instead of 'sh' causes errors.
2fill in blank
medium

Complete the code to specify the pipeline agent.

Jenkins
pipeline {
    agent [1]
    stages {
        stage('Test') {
            steps {
                sh 'echo Testing...'
            }
        }
    }
}
Drag options to blanks, or click blank then click option'
A'docker'
Bnone
Cany
D'node'
Attempts:
3 left
💡 Hint
Common Mistakes
Putting quotes around 'any' causes syntax errors.
3fill in blank
hard

Fix the error in the pipeline syntax to run a shell command.

Jenkins
pipeline {
    agent any
    stages {
        stage('Deploy') {
            steps {
                [1] 'echo Deploying...'
            }
        }
    }
}
Drag options to blanks, or click blank then click option'
Ash
Bshell
CrunShell
DexecuteShell
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'shell' or 'runShell' causes errors.
4fill in blank
hard

Fill both blanks to create a stage with a shell step that echoes a message.

Jenkins
pipeline {
    agent any
    stages {
        stage([1]) {
            steps {
                [2] 'echo Hello World'
            }
        }
    }
}
Drag options to blanks, or click blank then click option'
A'Greeting'
Bsh
C'Build'
Drun
Attempts:
3 left
💡 Hint
Common Mistakes
Using run instead of sh causes errors.
5fill in blank
hard

Fill all three blanks to define a pipeline with an agent, a stage name, and a shell step.

Jenkins
pipeline {
    agent [1]
    stages {
        stage([2]) {
            steps {
                [3] 'echo Pipeline as Code'
            }
        }
    }
}
Drag options to blanks, or click blank then click option'
Aany
B'ExampleStage'
Csh
D'agent'
Attempts:
3 left
💡 Hint
Common Mistakes
Putting quotes around agent or using wrong shell step.