0
0
Jenkinsdevops~20 mins

Build steps execution in Jenkins - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Build Steps Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
What is the output of this Jenkins pipeline step?
Consider this Jenkins pipeline snippet:
pipeline {
  agent any
  stages {
    stage('Build') {
      steps {
        echo 'Building project...'
      }
    }
  }
}

What will Jenkins print in the console log during the Build stage?
Jenkins
pipeline {
  agent any
  stages {
    stage('Build') {
      steps {
        echo 'Building project...'
      }
    }
  }
}
ABuilding project...
BBuild stage started
CError: echo command not found
DNo output
Attempts:
2 left
💡 Hint
The echo step prints the given message to the console log.
🔀 Workflow
intermediate
2:00remaining
Order of execution in Jenkins pipeline stages
Given this Jenkins pipeline:
pipeline {
  agent any
  stages {
    stage('Test') {
      steps {
        echo 'Testing...'
      }
    }
    stage('Deploy') {
      steps {
        echo 'Deploying...'
      }
    }
  }
}

What is the correct order Jenkins executes these stages?
ABoth stages run in parallel
B1,2
CStages run randomly
D2,1
Attempts:
2 left
💡 Hint
Stages in Jenkins pipeline run sequentially by default.
Troubleshoot
advanced
2:00remaining
Why does this Jenkins pipeline fail to execute the shell command?
Look at this Jenkins pipeline snippet:
pipeline {
  agent any
  stages {
    stage('Build') {
      steps {
        sh 'echo Building project'
      }
    }
  }
}

When running on a Windows agent, what error is most likely to occur?
Aecho Building project
BBuild completed successfully
Csh: command not found
DSyntax error in pipeline script
Attempts:
2 left
💡 Hint
The 'sh' step runs shell commands, which may not be available on Windows agents.
Best Practice
advanced
2:00remaining
Which Jenkins pipeline step ensures a build step runs only if the previous step succeeded?
In Jenkins declarative pipeline, which step or directive ensures that a build step runs only if the previous steps in the stage succeeded?
Ause 'post' block with 'failure' condition
Buse 'always' block
Cuse 'parallel' block
Dsteps inside a stage run sequentially and stop on failure by default
Attempts:
2 left
💡 Hint
By default, steps run one after another and stop if one fails.
🧠 Conceptual
expert
2:00remaining
What is the effect of the 'parallel' directive in Jenkins pipeline?
In Jenkins pipeline, what happens when you use the 'parallel' directive inside a stage?
AMultiple branches run at the same time, speeding up the build
BBranches run one after another in defined order
CPipeline pauses until all branches complete sequentially
DPipeline fails immediately
Attempts:
2 left
💡 Hint
Parallel means multiple things happen simultaneously.