0
0
Jenkinsdevops~10 mins

Stage block structure in Jenkins - Interactive Code Practice

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

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

Jenkins
stage('[1]') {
    steps {
        echo 'Building...'
    }
}
Drag options to blanks, or click blank then click option'
ATest
BBuild
CDeploy
DClean
Attempts:
3 left
💡 Hint
Common Mistakes
Using a step name instead of a stage name.
Leaving the stage name empty.
2fill in blank
medium

Complete the code to add a 'Test' stage with a shell command step.

Jenkins
stage('Test') {
    steps {
        [1] 'echo Running tests'
    }
}
Drag options to blanks, or click blank then click option'
Ash
Bbat
Cscript
Decho
Attempts:
3 left
💡 Hint
Common Mistakes
Using bat on Linux agents.
Using echo as a step instead of a command.
3fill in blank
hard

Fix the error in the stage block by completing the missing keyword.

Jenkins
stage('Deploy') {
    [1] {
        echo 'Deploying application'
    }
}
Drag options to blanks, or click blank then click option'
Aagent
Bscript
Cenvironment
Dsteps
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting the steps block.
Using script instead of steps for simple commands.
4fill in blank
hard

Fill both blanks to create a stage named 'Test' that runs a shell command.

Jenkins
stage('[1]') {
    [2] {
        sh 'echo Testing...'
    }
}
Drag options to blanks, or click blank then click option'
ATest
BBuild
Csteps
Dscript
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong stage names.
Using script instead of steps for simple commands.
5fill in blank
hard

Fill all three blanks to define a 'Deploy' stage with an agent and a shell step.

Jenkins
stage('[1]') {
    agent { [2] 'any' }
    steps {
        [3] 'echo Deploying app'
    }
}
Drag options to blanks, or click blank then click option'
ADeploy
Bsh
Clabel
Dnode
Attempts:
3 left
💡 Hint
Common Mistakes
Using node instead of label inside agent.
Using bat on Linux agents.
Omitting the steps block.