0
0
Jenkinsdevops~20 mins

Branch selection and branch specifier in Jenkins - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Branch Specifier Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
Jenkins branch specifier syntax output
What is the output of the Jenkins branch specifier origin/feature/* when used in a Multibranch Pipeline job?
AMatches all branches named 'feature/*' from any remote.
BMatches only the branch literally named 'origin/feature/*'.
CMatches all branches starting with 'origin/feature/' from any remote.
DMatches all branches starting with 'feature/' from the remote named 'origin'.
Attempts:
2 left
💡 Hint
Think about how Jenkins interprets remote names and wildcards in branch specifiers.
🧠 Conceptual
intermediate
2:00remaining
Understanding Jenkins branch selection behavior
In Jenkins Multibranch Pipeline, what does the branch specifier */main select?
ASelects the 'main' branch from any remote repository.
BSelects all branches named 'main' only from the default remote.
CSelects branches named 'main' only from remotes named '*'.
DSelects all branches starting with 'main' from any remote.
Attempts:
2 left
💡 Hint
The asterisk (*) is a wildcard for remote names.
Troubleshoot
advanced
2:00remaining
Troubleshooting branch not detected in Jenkins
A Jenkins Multibranch Pipeline job does not detect the branch feature/login even though it exists in the remote repository. The branch specifier is set to origin/feature/*. What is the most likely cause?
AThe branch specifier should be <code>feature/*</code> without the remote prefix.
BThe remote name 'origin' is incorrect or not configured in Jenkins.
CThe branch specifier must be <code>refs/heads/feature/*</code> to detect branches.
DThe Jenkins job requires a manual refresh to detect new branches.
Attempts:
2 left
💡 Hint
Check the remote repository configuration in Jenkins.
🔀 Workflow
advanced
2:00remaining
Configuring Jenkins to build only specific branches
You want Jenkins Multibranch Pipeline to build only the branches main and any branch starting with release/. Which branch specifier configuration achieves this?
AUse a single branch specifier: <code>refs/heads/main refs/heads/release/*</code>.
BUse a single branch specifier: <code>main, release/*</code>.
CUse two branch specifiers: <code>*/main</code> and <code>*/release/*</code>.
DUse a single branch specifier: <code>main|release/*</code>.
Attempts:
2 left
💡 Hint
Jenkins allows multiple branch specifiers separated by commas or multiple entries.
Best Practice
expert
3:00remaining
Best practice for branch specifier in Jenkins Multibranch Pipeline
What is the best practice for writing branch specifiers in Jenkins Multibranch Pipeline to ensure consistent branch detection across different remotes?
AAlways use <code>*/branch-name</code> to match the branch on any remote.
BAlways use <code>origin/branch-name</code> to specify the default remote explicitly.
CUse full refspecs like <code>refs/remotes/origin/branch-name</code> for clarity.
DUse only branch names without remote prefixes, like <code>branch-name</code>.
Attempts:
2 left
💡 Hint
Consider flexibility when remotes may vary.