0
0
Jenkinsdevops~20 mins

Milestone step for concurrency in Jenkins - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Milestone Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Purpose of the Milestone Step in Jenkins Pipelines

What is the main purpose of using the milestone step in a Jenkins pipeline?

ATo pause the pipeline execution until a manual approval is given.
BTo mark a point in the pipeline that prevents older builds from running past it if a newer build has reached the same milestone.
CTo trigger parallel execution of multiple stages simultaneously.
DTo archive build artifacts at a specific stage.
Attempts:
2 left
💡 Hint

Think about how Jenkins manages concurrent builds and avoids outdated work continuing.

💻 Command Output
intermediate
2:00remaining
Output of Pipeline with Milestone Step

Given the following Jenkins pipeline snippet, what will be the output if build #2 reaches the milestone before build #1?

Jenkins
pipeline {
  agent any
  stages {
    stage('Build') {
      steps {
        milestone 1
        echo "Build stage running"
      }
    }
    stage('Test') {
      steps {
        milestone 2
        echo "Test stage running"
      }
    }
  }
}
ABuild #2 will stop at milestone 1 and not run 'Build stage running'.
BBoth builds run all stages fully without interruption.
CBuild #1 and Build #2 will both stop at milestone 1.
DBuild #1 will stop at milestone 2 and not run 'Test stage running', while Build #2 runs both stages fully.
Attempts:
2 left
💡 Hint

Remember that milestone stops older builds from passing milestones reached by newer builds.

🔀 Workflow
advanced
2:30remaining
Using Milestone to Control Parallel Branches

In a Jenkins pipeline with parallel branches, how can the milestone step be used to ensure that only the latest build's parallel branches proceed beyond a certain point?

AUse <code>milestone</code> inside a single sequential stage, not in parallel branches.
BUse <code>milestone</code> only after all parallel branches complete to stop older builds.
CPlace a <code>milestone</code> step at the start of each parallel branch to stop older builds from continuing in any branch once a newer build passes the milestone.
DMilestone steps cannot be used with parallel branches.
Attempts:
2 left
💡 Hint

Think about how to stop outdated work in each parallel path individually.

Troubleshoot
advanced
2:30remaining
Troubleshooting Unexpected Pipeline Stops with Milestone

A Jenkins pipeline with milestones unexpectedly stops an older build early. What is the most likely cause?

AA newer build has already passed the same milestone, causing the older build to be aborted at that point.
BThe pipeline script has a syntax error causing premature termination.
CThe Jenkins agent lost connection during the build.
DThe milestone step was placed after all stages, so it never triggered.
Attempts:
2 left
💡 Hint

Consider how milestones affect concurrency and build ordering.

Best Practice
expert
3:00remaining
Best Practice for Using Milestone Steps in Complex Pipelines

What is the best practice when placing milestone steps in a complex Jenkins pipeline to manage concurrency effectively?

APlace milestone steps at key points before resource-intensive or long-running stages to prevent older builds from wasting resources.
BAvoid using milestone steps in complex pipelines as they cause unpredictable behavior.
CPlace milestone steps only at the very end of the pipeline to ensure all builds complete fully.
DUse milestone steps only in freestyle jobs, not in pipelines.
Attempts:
2 left
💡 Hint

Think about saving time and resources by stopping outdated builds early.