我在詹金斯做了一个多分支管道项目.我需要使用两个存储库,并且都需要凭据.
我在repository1中创建了一个Jenkins文件:
node ('label1'){
stage 'sanity check'
sh 'echo sanity check'
stage 'checkout other repository'
checkout([
$class: 'GitSCM', branches: [[name: '*/master']],
userRemoteConfigs: [[url: 'https://BRNTZN@bitbucket.org/BRNTZN/repository2.git'],[credentialsId:'23b2eed1-2863-49d5-bc7b-bcccb9ad914d']]
])
stage 'log results'
sh 'echo result = OK'
}
Run Code Online (Sandbox Code Playgroud)
当我将此文件推送到repository1的分支并启动构建时,我在Jenkins中收到以下错误:
Branch indexing
Setting origin to https://BRNTZN@bitbucket.org/BRNTZN/repository1.git
Fetching origin...
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url https://BRNTZN@bitbucket.org/BRNTZN/repository1.git # timeout=10
Fetching upstream changes from https://BRNTZN@bitbucket.org/BRNTZN/repository1.git
> git --version # timeout=10
using .gitcredentials to set credentials
> git …Run Code Online (Sandbox Code Playgroud)