Jenkins checkout Pipeline Multibranch

In this tutorial, How to use Jenkins checkout for Multibranch. For example with Git, the scm reference a GitSCM Object. It is the same git pull command.

For example below, When you running job Jenkins then checkout source code from git takes 15 minutes. You running job Jenkins again then checkout the source code from git takes 4s. It is faster, as the picture below

Jenkins checkout Pipeline Multi-branch code as below

stage('Checkout') {
      checkout([$class: 'GitSCM', branches: [[name: "${BRANCH}"]],
           doGenerateSubmoduleConfigurations: false,
            extensions: [[$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: true, timeout: 30], 
[$class: 'LocalBranch', localBranch: '$BRANCH'], 
[$class: 'RelativeTargetDirectory', relativeTargetDir: 'devopsroles'], [$class: 'CleanBeforeCheckout'], 
[$class: 'CloneOption', depth: 0, honorRefspec: true, noTags: true, reference: '', shallow: false, timeout: 90]],
            submoduleCfg: [],
            userRemoteConfigs: [[credentialsId: '755f8df9-0g83-4b80-96d8-917eeb6b2fgg', url: '']]

About HuuPV

My name is Huu. I love technology and especially Devops Skill such as Docker, vagrant, git so forth. I likes open-sources. so I created site to share the knowledge that I have learned. My Job: IT system administrator. Hobbies: summoners war game, gossip.
View all posts by HuuPV →

Leave a Reply

Your email address will not be published. Required fields are marked *

Comment moderation is enabled. Your comment may take some time to appear.

This site uses Akismet to reduce spam. Learn how your comment data is processed.