0
0
Jenkinsdevops~20 mins

Pipeline triggers and upstream/downstream in Jenkins - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Pipeline Trigger Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
Understanding Upstream and Downstream Jobs

In Jenkins, if Job A triggers Job B after it finishes successfully, which statement is true?

AJob A is the upstream job of Job B.
BJob B is the upstream job of Job A.
CJob A is the downstream job of Job B.
DJob A and Job B are unrelated in terms of triggers.
Attempts:
2 left
💡 Hint

Think about the direction of the trigger: who starts first and who follows.

💻 Command Output
intermediate
1:30remaining
Output of a Jenkins Pipeline Trigger Script

What will be the output of this Jenkins pipeline snippet when Job A triggers Job B?

Jenkins
pipeline {
  agent any
  stages {
    stage('Trigger') {
      steps {
        build job: 'JobB', wait: true
        echo 'Job B completed'
      }
    }
  }
}
ASyntax error due to missing parameters
BJob B completed (immediately, without waiting)
CJob B completed (after Job B finishes)
DJob B is triggered but pipeline fails
Attempts:
2 left
💡 Hint

Check the meaning of wait: true in the build step.

Configuration
advanced
2:00remaining
Configuring Upstream Job to Trigger Multiple Downstream Jobs

Which Jenkins pipeline snippet correctly triggers two downstream jobs JobB and JobC in parallel and waits for both to finish?

Jenkins
pipeline {
  agent any
  stages {
    stage('Trigger') {
      steps {
        parallel {
          JobB: { build job: 'JobB', wait: true },
          JobC: { build job: 'JobC', wait: true }
        }
      }
    }
  }
}
A
parallel {
  JobB: { build job: 'JobB' },
  JobC: { build job: 'JobC' }
}
B
parallel {
  JobB: { build job: 'JobB', wait: true },
  JobC: { build job: 'JobC', wait: true }
}
C
stage('Trigger') {
  steps {
    build job: 'JobB'
    build job: 'JobC'
  }
}
D
stage('Trigger') {
  steps {
    build job: 'JobB', wait: false
    build job: 'JobC', wait: false
  }
}
Attempts:
2 left
💡 Hint

Remember that parallel runs branches at the same time and wait: true waits for each job to finish.

Troubleshoot
advanced
1:30remaining
Troubleshooting a Downstream Job Not Triggering

You have configured Job A to trigger Job B using the build step in a pipeline, but Job B never starts. What is the most likely cause?

AJob B is disabled or does not exist.
BJob A has no agent defined.
CThe <code>build</code> step is missing <code>wait: true</code>.
DJob B is already running and cannot be triggered again.
Attempts:
2 left
💡 Hint

Check if the downstream job is available and enabled.

Best Practice
expert
2:00remaining
Best Practice for Triggering Upstream Job After Downstream Completion

You want Job A to start only after Job B completes successfully, but Job B is not triggered by Job A. Which Jenkins feature best supports this?

AConfigure Job A to run on a timer and check Job B's logs.
BUse a polling trigger in Job A to check Job B's status.
CUse the <code>build</code> step in Job A to trigger Job B with <code>wait: true</code>.
DConfigure Job B to trigger Job A as a downstream job on success.
Attempts:
2 left
💡 Hint

Think about how to start a job after another finishes when the first job is not triggered by the second.