Jenkins pipeline: checkout explicit git commit

前端 未结 3 1881
盖世英雄少女心
盖世英雄少女心 2021-02-03 23:39

I want to be able to say something like:

git branch: commitHash, credentialsId: credentialsId, url: url

The usecase: I\'m doing parallel build

3条回答
  •  逝去的感伤
    2021-02-04 00:08

    Yuri G's example didn't work for me when jenkins lacked a workspace due to initial checkout. The following works in this case. I don't understand why they are all that different.

        def commitId = ""
    
        checkout ( [$class: 'GitSCM',
            branches: [[name: commitId ]],
            userRemoteConfigs: [[
                credentialsId: 'deploy key for your repo', 
                url: 'repo url']]])
    

提交回复
热议问题