Is it impossible to checkout a different branch in Jenkinsfile?

前端 未结 5 2114
耶瑟儿~
耶瑟儿~ 2021-02-05 08:03

I have two branches on BitBucket: master and develop. I\'ve also got a BitBucket Team Folder job configured on my Jenkins server to build that reposito

5条回答
  •  春和景丽
    2021-02-05 08:18

    You can use the intrinsic function in Jenkins Pipeline created for Git cloning and pulling. I would also suggest cloning the branches into separate directories.

    checkout([$class: 'GitSCM',
      branches: [[name: '*/branch_name']],
      doGenerateSubmoduleConfigurations: false,
      extensions: [[$class: 'RelativeTargetDirectory',
        relativeTargetDir: 'different_directory']],
      submoduleCfg: [],
      userRemoteConfigs: [[url: 'git@github.domain:org/repo.git']]])
    

提交回复
热议问题