Jenkins Pipeline:在Bitbucket Pull Request Builder触发后,git检查错误的修订版

时间:2017-03-01 08:05:53

标签: git jenkins bitbucket

我有一个Jenkins管道,用于构建和测试Bitbucket上的拉动请求,用于我的"引擎"库。我使用Bitbucket Pull Request Builder插件,它检查PR分支,对目标分支进行本地合并(使用"构建前合并"管道附加行为),然后执行我Jenkins文件中的管道。

测试具有一些存储在其他存储库中的依赖项。我的Jenkinsfile将这些检查到子目录中(我还尝试将它们检出到父目录中的新目录中,而不是作为子目录)。

node {
  dir('tools') { git url: 'ssh://git@bitbucket.org:<my_org>/tools.git', branch: 'master', credentialsId: 'my-cred-id' }
}

当这个工具结帐步骤发生时,git插件会尝试检查&#34;引擎&#34;的HEAD提交。回购&#34;工具&#34;目录:

首先是主要&#34;引擎&#34; repo clones(由Bitbucket插件触发,在管道开始之前):

> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url git@bitbucket.org:<my_org>/engine.git # timeout=10
Fetching upstream changes from git@bitbucket.org:<my_org>/engine.git
> git --version # timeout=10
using GIT_SSH to set credentials <creds>
> git fetch --tags --progress git@bitbucket.org:<my_org>/engine.git +refs/heads/*:refs/remotes/origin/*
> git rev-parse 2ed413bbaf55^{commit} # timeout=10
> git branch -a -v --no-abbrev --contains 2ed413bbaf551428e5b6328829606155fdb8cd5e # timeout=10
Merging Revision 2ed413bbaf551428e5b6328829606155fdb8cd5e (origin/<branch>) to origin/dev, UserMergeOptions{mergeRemote='origin', mergeTarget='${targetBranch}', mergeStrategy='default', fastForwardMode='--ff'}
> git rev-parse origin/dev^{commit} # timeout=10
> git config core.sparsecheckout # timeout=10
> git checkout -f origin/dev
> git merge --ff 2ed413bbaf551428e5b6328829606155fdb8cd5e # timeout=10
> git rev-parse HEAD^{commit} # timeout=10

然后工具repo clones(由管道中的git命令触发):

> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url git@bitbucket.org:<my_org>/tools.git # timeout=10
Fetching upstream changes from git@bitbucket.org:<my_org>/tools.git
> git --version # timeout=10
using GIT_SSH to set credentials 
> git fetch --tags --progress git@bitbucket.org:<my_org>/tools.git +refs/heads/*:refs/remotes/origin/*
> git rev-parse 2ed413bbaf55^{commit} # timeout=10
[Pipeline] }
[Pipeline] // dir
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
hudson.plugins.git.GitException: Command "git rev-parse 2ed413bbaf55^{commit}" returned status code 128:
stdout: 2ed413bbaf55^{commit}

stderr: fatal: ambiguous argument '2ed413bbaf55^{commit}': unknown revision or path not in the working tree.

PR分支(2ed413)指向的提交SHA与git在签出工具仓库时尝试检出的提交SHA相同,该工具仓库不存在。我错误配置了我的管道吗?或者这是一个错误吗?

0 个答案:

没有答案