0
0
Jenkinsdevops~10 mins

Scripted vs declarative comparison in Jenkins - Interactive Practice

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

Complete the code to start a declarative Jenkins pipeline.

Jenkins
pipeline {
    agent any
    stages {
        stage('Build') {
            steps {
                [1] 'echo Building...'
            }
        }
    }
}
Drag options to blanks, or click blank then click option'
Astage
Bscript
Cnode
Dsh
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'script' instead of 'sh' inside steps.
2fill in blank
medium

Complete the code to define a scripted Jenkins pipeline node block.

Jenkins
node {
    stage('Test') {
        [1] 'echo Testing...'
    }
}
Drag options to blanks, or click blank then click option'
Ash
Bpipeline
Csteps
Dagent
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'steps' which is not valid in scripted pipeline.
3fill in blank
hard

Fix the error in the scripted pipeline to properly wrap shell commands.

Jenkins
node {
    stage('Deploy') {
        [1] {
            sh 'echo Deploying...'
        }
    }
}
Drag options to blanks, or click blank then click option'
Ascript
Bsteps
Cpipeline
Dagent
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'steps' which is only valid in declarative pipelines.
4fill in blank
hard

Fill both blanks to create a declarative pipeline with a post action.

Jenkins
pipeline {
    agent any
    stages {
        stage('Build') {
            steps {
                sh 'echo Building...'
            }
        }
    }
    post {
        [1] {
            [2] 'echo Cleaning up...'
        }
    }
}
Drag options to blanks, or click blank then click option'
Aalways
Bsh
Csuccess
Dscript
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'script' in post steps which is invalid.
5fill in blank
hard

Fill all three blanks to create a scripted pipeline with a stage and shell command.

Jenkins
node {
    stage('[1]') {
        [2] '[3]'
    }
}
Drag options to blanks, or click blank then click option'
ADeploy
Bsh
Cecho Deploying...
DBuild
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'Build' instead of 'Deploy' for the stage name.