0
0
Jenkinsdevops~20 mins

Multi-branch pipeline job creation in Jenkins - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Multi-branch Pipeline Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
What is the primary purpose of a Jenkins multi-branch pipeline?

Choose the best description of what a Jenkins multi-branch pipeline job does.

AIt schedules pipeline jobs only for the main branch of a repository.
BIt runs a single pipeline job that merges all branches before building.
CIt automatically discovers branches in a source code repository and creates pipelines for each branch.
DIt creates a pipeline that runs only when manually triggered.
Attempts:
2 left
💡 Hint

Think about how Jenkins handles multiple branches in one job.

💻 Command Output
intermediate
1:30remaining
What is the output of this Jenkinsfile snippet in a multi-branch pipeline?

Given the Jenkinsfile below, what will be printed when the pipeline runs on branch 'feature-xyz'?

Jenkins
pipeline {
  agent any
  stages {
    stage('Print Branch') {
      steps {
        echo "Building branch: ${env.BRANCH_NAME}"
      }
    }
  }
}
ABuilding branch: null
BBuilding branch: feature-xyz
CBuilding branch: main
DSyntax error in Jenkinsfile
Attempts:
2 left
💡 Hint

Check the environment variable that Jenkins sets for branch name in multi-branch pipelines.

Configuration
advanced
2:00remaining
Which Jenkinsfile snippet correctly triggers builds only for branches with names starting with 'release/'?

Select the Jenkinsfile snippet that uses the correct syntax to include only branches starting with 'release/' in a multi-branch pipeline.

Aoptions { skipDefaultCheckout() }
Btriggers { pollSCM('H/5 * * * *') }
Cproperties([pipelineTriggers([branchFilter('release/*')])])
Dwhen { branch pattern: 'release/.*', comparator: 'REGEXP' }
Attempts:
2 left
💡 Hint

Look for the correct way to filter branches in Jenkinsfile using 'when' and 'branch' conditions.

🔀 Workflow
advanced
2:00remaining
What is the correct sequence to create a Jenkins multi-branch pipeline job for a GitHub repository?

Order the steps to create a multi-branch pipeline job that builds branches from a GitHub repository.

A1,2,3,4
B2,1,3,4
C1,3,2,4
D3,1,2,4
Attempts:
2 left
💡 Hint

Think about the logical order of creating a new job and configuring it.

Troubleshoot
expert
2:30remaining
Why does a Jenkins multi-branch pipeline fail to detect new branches after adding them to the repository?

You added new branches to your GitHub repository, but Jenkins multi-branch pipeline job does not create jobs for them. What is the most likely cause?

AThe Jenkins job's branch source scan interval is too long or manual scan was not triggered.
BThe Jenkinsfile is missing from the new branches.
CThe GitHub repository URL is incorrect in the job configuration.
DThe Jenkins master node is offline.
Attempts:
2 left
💡 Hint

Consider how Jenkins discovers new branches in multi-branch pipelines.