Complete the code to specify the Git repository URL in Jenkins pipeline.
pipeline {
agent any
stages {
stage('Checkout') {
steps {
git url: '[1]'
}
}
}
}The git step in Jenkins pipeline requires the full repository URL as the url parameter.
Complete the code to checkout a specific branch named 'develop' in Jenkins pipeline.
pipeline {
agent any
stages {
stage('Checkout') {
steps {
git branch: '[1]', url: 'https://github.com/example/repo.git'
}
}
}
}To checkout a specific branch, set the branch parameter to the branch name, here 'develop'.
Fix the error in the Jenkins pipeline code to properly checkout a Git repository with credentials.
pipeline {
agent any
stages {
stage('Checkout') {
steps {
git url: 'https://github.com/example/repo.git', credentialsId: '[1]'
}
}
}
}The credentialsId must match the ID of the stored credentials in Jenkins, usually a string like 'my-git-credentials'.
Fill both blanks to configure a Jenkins pipeline to checkout a Git repository with a specific branch and credentials.
pipeline {
agent any
stages {
stage('Checkout') {
steps {
git url: 'https://github.com/example/repo.git', branch: '[1]', credentialsId: '[2]'
}
}
}
}Set branch to the desired branch name, e.g., 'feature-branch', and credentialsId to the Jenkins stored credentials ID, e.g., 'my-credentials-id'.
Fill all three blanks to create a Jenkins pipeline snippet that checks out a Git repository, uses a specific branch, and cleans the workspace before checkout.
pipeline {
agent any
stages {
stage('Checkout') {
steps {
cleanWs()
git url: '[1]', branch: '[2]', [3]
}
}
}
}The git step requires the repository URL, the branch name, and optionally the credentials ID to authenticate. The cleanWs() step cleans the workspace before checkout.