0
0
Jenkinsdevops~20 mins

Branch discovery configuration in Jenkins - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Branch Discovery Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
Understanding Branch Discovery in Jenkins Multibranch Pipeline

What is the primary purpose of the Branch Discovery trait in Jenkins Multibranch Pipeline jobs?

ATo automatically find and create jobs for branches in the source repository
BTo delete branches from the source repository after build completion
CTo merge all branches into the main branch before building
DTo restrict builds only to the default branch
Attempts:
2 left
💡 Hint

Think about how Jenkins finds branches to build automatically.

💻 Command Output
intermediate
1:30remaining
Effect of Branch Discovery Setting on Job Creation

Given a Jenkins Multibranch Pipeline configured with Branch Discovery trait set to Discover branches that are also filed as PRs, what will Jenkins do when scanning the repository?

ACreate jobs only for the default branch
BCreate jobs for all branches regardless of pull requests
CCreate jobs only for branches that have open pull requests
DCreate jobs for branches without any pull requests
Attempts:
2 left
💡 Hint

Focus on the meaning of 'also filed as PRs'.

Configuration
advanced
2:00remaining
Configuring Branch Discovery to Exclude Certain Branches

Which configuration snippet correctly excludes branches named feature/temp-* from being discovered in Jenkins Multibranch Pipeline?

AAdd a <code>Filter by name (with wildcards)</code> trait with pattern <code>feature/temp-*</code> and set to exclude
BAdd a <code>Filter by name (with wildcards)</code> trait with pattern <code>feature/temp-*</code> and set to include
CAdd a <code>Branch Discovery</code> trait with pattern <code>feature/temp-*</code> to include only those branches
DAdd a <code>Pull Request Discovery</code> trait with pattern <code>feature/temp-*</code> to exclude those branches
Attempts:
2 left
💡 Hint

Think about how to exclude branches by name using traits.

Troubleshoot
advanced
2:00remaining
Troubleshooting Missing Branches in Jenkins Multibranch Pipeline

You notice that some branches are not appearing as jobs in your Jenkins Multibranch Pipeline scan. Which of the following is the most likely cause?

AThe Jenkinsfile is missing in the root of the repository
BBranch Discovery trait is configured to discover only branches with open pull requests
CThe repository URL is incorrect
DJenkins server is offline
Attempts:
2 left
💡 Hint

Consider how Branch Discovery settings affect which branches are found.

🔀 Workflow
expert
3:00remaining
Optimizing Branch Discovery for Large Repositories

You manage a Jenkins Multibranch Pipeline for a large repository with hundreds of branches. To reduce load, you want Jenkins to discover only branches that have been updated in the last 7 days. Which approach best achieves this?

AUse the <code>Filter by name (with wildcards)</code> trait to exclude old branches
BUse the <code>Suppress automatic SCM triggering</code> option and trigger builds manually
CConfigure Branch Discovery to include only branches matching a date-based pattern
DUse a custom script in the Jenkinsfile to skip builds for branches not updated in 7 days
Attempts:
2 left
💡 Hint

Think about how to control build execution based on branch update time.