0
0
Jenkinsdevops~20 mins

Git repository configuration in Jenkins - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Git Repository Configuration Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
Jenkins Git Plugin: Repository URL Validation
You configure a Jenkins job with the Git repository URL: https://github.com/example/repo.git. What will be the output of Jenkins when it tries to clone this repository if the URL is incorrect or unreachable?
AERROR: Failed to connect to repository: https://github.com/example/repo.git
BSUCCESS: Repository cloned successfully
CWARNING: Repository URL is deprecated but cloned
DINFO: Repository URL not specified
Attempts:
2 left
💡 Hint
Think about what Jenkins reports when it cannot access the Git repository.
Configuration
intermediate
2:00remaining
Jenkins Git Plugin: Specifying Branch to Build
In Jenkins Git plugin configuration, which syntax correctly specifies to build only the develop branch?
Arefs/heads/master
Brefs/tags/develop
Crefs/remotes/origin/develop
Drefs/heads/develop
Attempts:
2 left
💡 Hint
Branches are referenced under refs/heads/ in Git.
🔀 Workflow
advanced
2:30remaining
Jenkins Pipeline: Git Checkout with Credentials
You want to checkout a private Git repository in a Jenkins pipeline using stored credentials with ID git-creds. Which pipeline snippet correctly performs this checkout?
Acheckout scm
Bcheckout([$class: 'GitSCM', branches: [[name: 'refs/heads/main']], userRemoteConfigs: [[url: 'https://github.com/private/repo.git', credentialsId: 'git-creds']]])
Cgit url: 'https://github.com/private/repo.git', branch: 'main'
Dgit credentialsId: 'git-creds', url: 'https://github.com/private/repo.git'
Attempts:
2 left
💡 Hint
Using checkout with GitSCM class allows specifying credentials explicitly.
Troubleshoot
advanced
2:00remaining
Jenkins Git Plugin: Resolving 'No credentials specified' Error
A Jenkins job fails with the error: ERROR: No credentials specified when trying to clone a private Git repository. What is the most likely cause?
AThe Jenkins job configuration does not specify any credentials for the Git repository
BThe Git repository URL is public and does not require credentials
CThe Git plugin is not installed in Jenkins
DThe repository branch name is incorrect
Attempts:
2 left
💡 Hint
Think about what Jenkins needs to access private repositories.
Best Practice
expert
3:00remaining
Best Practice for Jenkins Git Polling Configuration
Which Jenkins Git plugin polling configuration is best to minimize unnecessary builds while ensuring changes are detected promptly?
ADisable polling and rely only on manual builds
BPoll SCM every minute with <code>* * * * *</code> and disable shallow clone
CPoll SCM every 5 minutes with <code>H/5 * * * *</code> and use shallow clone
DPoll SCM once daily with <code>H H * * *</code> and use shallow clone
Attempts:
2 left
💡 Hint
Balance frequency and resource usage for polling.