0
0
Jenkinsdevops~20 mins

Source code management setup in Jenkins - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Source Code Management Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
Jenkins Git SCM Plugin: What is the output?

You configured a Jenkins job with Git SCM plugin to clone a repository. The repository URL is correct, but the branch name is set to feature-xyz which does not exist in the remote repo.

What will Jenkins show in the console output when it tries to fetch this branch?

ACloning repository... Branch feature-xyz checked out successfully.
BBuild succeeded without fetching any branch.
CERROR: Could not find remote branch feature-xyz to clone.
DWarning: Branch feature-xyz is deprecated, using master instead.
Attempts:
2 left
💡 Hint

Think about what happens if Jenkins tries to fetch a branch that does not exist.

Configuration
intermediate
2:00remaining
Jenkins Pipeline SCM Configuration Syntax

Which Jenkins Pipeline syntax snippet correctly checks out a Git repository from https://github.com/example/repo.git on branch develop?

Acheckout([$class: 'GitSCM', branches: [[name: 'develop']], userRemoteConfigs: [[url: 'https://github.com/example/repo.git']]])
Bgit url: 'https://github.com/example/repo.git', branch: 'develop'
Ccheckout scm: git('https://github.com/example/repo.git', 'develop')
DgitCheckout(url: 'https://github.com/example/repo.git', branch: 'develop')
Attempts:
2 left
💡 Hint

Remember the Jenkins Pipeline checkout step syntax for GitSCM.

Troubleshoot
advanced
2:00remaining
Jenkins Git Credentials Failure Diagnosis

A Jenkins job configured with Git SCM fails with the error: Authentication failed for https://github.com/example/repo.git. The credentials are set as username/password in Jenkins credentials store.

Which is the most likely cause?

AThe Git plugin version is outdated and incompatible with GitHub.
BThe repository URL is incorrect and does not match the credentials domain.
CThe Jenkins server has no internet access.
DThe credentials are not linked to the Git SCM configuration in the job.
Attempts:
2 left
💡 Hint

Check if the credentials are properly selected in the job configuration.

🔀 Workflow
advanced
2:00remaining
Jenkins Multibranch Pipeline SCM Behavior

In a Jenkins Multibranch Pipeline job, what happens when a new branch is pushed to the remote Git repository?

AJenkins ignores new branches until manually added in the job configuration.
BJenkins automatically detects the new branch and creates a new job for it.
CJenkins deletes all existing branches and only builds the new one.
DJenkins triggers a build on the master branch only.
Attempts:
2 left
💡 Hint

Think about how Multibranch Pipeline jobs manage branches automatically.

Best Practice
expert
2:00remaining
Best Practice for Jenkins SCM Polling Frequency

What is the best practice for setting SCM polling frequency in Jenkins to balance build responsiveness and server load?

ASet polling interval to every 5 minutes to catch changes quickly without overloading the server.
BSet polling interval to every 30 seconds for immediate build triggers.
CSet polling interval to once a day to minimize server load.
DDisable polling and rely only on manual build triggers.
Attempts:
2 left
💡 Hint

Consider the trade-off between build speed and resource usage.