0
0
Jenkinsdevops~10 mins

Why CI/CD matters for development velocity 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 that runs on any available agent.

Jenkins
pipeline {
    agent [1]
    stages {
        stage('Build') {
            steps {
                echo 'Building...'
            }
        }
    }
}
Drag options to blanks, or click blank then click option'
Amaster
Bany
Cnone
Ddocker
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'none' disables the agent and causes errors.
Specifying 'master' limits builds to the master node only.
2fill in blank
medium

Complete the code to add a stage named 'Test' in the Jenkins pipeline.

Jenkins
pipeline {
    agent any
    stages {
        stage('[1]') {
            steps {
                echo 'Running tests...'
            }
        }
    }
}
Drag options to blanks, or click blank then click option'
ATest
BCleanup
CBuild
DDeploy
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'Build' or 'Deploy' as the stage name here is incorrect for testing.
Misspelling the stage name causes pipeline errors.
3fill in blank
hard

Fix the error in the Jenkins pipeline syntax by completing the missing keyword.

Jenkins
pipeline {
    agent any
    stages {
        stage('Deploy') {
            [1] {
                echo 'Deploying application...'
            }
        }
    }
}
Drag options to blanks, or click blank then click option'
Ascript
Btools
Cenvironment
Dsteps
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'script' instead of 'steps' causes errors unless inside a script block.
Omitting the block entirely breaks the pipeline.
4fill in blank
hard

Fill both blanks to create a post-build action that always runs and sends a notification.

Jenkins
pipeline {
    agent any
    stages {
        stage('Build') {
            steps {
                echo 'Building...'
            }
        }
    }
    post {
        [1] {
            [2] 'Build finished.'
        }
    }
}
Drag options to blanks, or click blank then click option'
Aalways
Bsuccess
Cecho
Dfailure
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'success' means the notification won't run if the build fails.
Using 'failure' means the notification only runs on failure.
5fill in blank
hard

Fill all three blanks to create a simple pipeline with environment variables and a shell command.

Jenkins
pipeline {
    agent any
    environment {
        [1] = 'production'
    }
    stages {
        stage('Deploy') {
            steps {
                sh '[2] deploy to [3]'
            }
        }
    }
}
Drag options to blanks, or click blank then click option'
AENVIRONMENT
Becho
C$ENVIRONMENT
Ddeploy
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting the $ before the variable name in the shell command.
Using incorrect variable names or missing quotes.