0
0
Jenkinsdevops~10 mins

Build steps execution 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 simple Jenkins pipeline stage named 'Build'.

Jenkins
stage('Build') {
    steps {
        [1] 'echo Building the project'
    }
}
Drag options to blanks, or click blank then click option'
Ascript
Bsh
Cexecute
Drun
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'run' or 'execute' which are not Jenkins pipeline steps.
2fill in blank
medium

Complete the code to add a stage named 'Test' that runs a shell command.

Jenkins
stage('Test') {
    steps {
        [1] 'echo Running tests'
    }
}
Drag options to blanks, or click blank then click option'
Abat
Bcmd
Cpowershell
Dsh
Attempts:
3 left
💡 Hint
Common Mistakes
Using Windows-specific steps like 'bat' on Unix agents.
3fill in blank
hard

Fix the error in the pipeline code to correctly define a stage named 'Deploy'.

Jenkins
stage('Deploy') {
    [1] {
        sh 'echo Deploying application'
    }
}
Drag options to blanks, or click blank then click option'
Acommands
Bscript
Csteps
Dactions
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'script' or 'commands' which are not valid block names here.
4fill in blank
hard

Fill both blanks to create a pipeline with two stages: 'Build' and 'Test', each running a shell command.

Jenkins
pipeline {
    agent any
    stages {
        stage('Build') {
            [1] {
                sh 'echo Building'
            }
        }
        stage('Test') {
            [2] {
                sh 'echo Testing'
            }
        }
    }
}
Drag options to blanks, or click blank then click option'
Asteps
Bscript
Ccommands
Dactions
Attempts:
3 left
💡 Hint
Common Mistakes
Using different or invalid block names like 'script' or 'commands'.
5fill in blank
hard

Fill all three blanks to create a pipeline with stages 'Build', 'Test', and 'Deploy', each running a shell command.

Jenkins
pipeline {
    agent any
    stages {
        stage('Build') {
            [1] {
                sh 'echo Build started'
            }
        }
        stage('Test') {
            [2] {
                sh 'echo Test started'
            }
        }
        stage('Deploy') {
            [3] {
                sh 'echo Deploy started'
            }
        }
    }
}
Drag options to blanks, or click blank then click option'
Asteps
Bscript
Ccommands
Dactions
Attempts:
3 left
💡 Hint
Common Mistakes
Using different block names for different stages.