在Jenkins中使用多个repos yield存储库找不到错误

时间:2015-02-26 15:56:33

标签: git jenkins git-push git-remote

我在“源代码管理”部分中为多个存储库配置了一个Jenkins作业,每个存储库都获得一个“自定义”原始名称。用例是我需要从第一个repo中提取校验和值,然后使用它来更新第二个repo中的文件并将该更改推送到远程repo。这是Jenkins作业输出的样子:

> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from 2 remote Git repositories
 > git config remote.second-origin.url git@github.com:user/repo-2.git # timeout=10
Fetching upstream changes from git@github.com:user/repo-2.git
 > git --version # timeout=10
using GIT_SSH to set credentials 
 > git fetch --tags --progress git@github.com:user/repo-2.git +refs/heads/*:refs/remotes/second-origin/*
 > git config remote.first-origin.url git@github.com:user/repo-1.git # timeout=10
Fetching upstream changes from git@github.com:user/repo-1.git
using GIT_SSH to set credentials 
 > git fetch --tags --progress git@github.com:user/repo-1.git +refs/heads/*:refs/remotes/first-origin/*
Seen branch in repository second-origin/development
Seen branch in repository second-origin/master
Seen branch in repository first-origin/master
Seen branch in repository first-origin/test
Seen 4 remote branches
Checking out Revision 15j5123hjhjkl5123jk512hjkl5hjk5jhkl (first-origin/test)
 > git config core.sparsecheckout # timeout=10
 > git checkout -f 15j5123hjhjkl5123jk512hjkl5hjk5jhkl
 > git rev-list 15j5123hjhjkl5123jk512hjkl5hjk5jhkl # timeout=10
[Jenkins Job] $ /bin/sh -xe /tmp/hudson2801366816478454446.sh
+ git config --global user.name jenkins-deploy
+ git config --global user.email jenkins-deploy@test.com
+ git checkout first-origin/master
Previous HEAD position was 15j51... Some stuff
HEAD is now at f2f34af23.. Merging master
++ git rev-parse HEAD
+ echo f2f34af23a2g3hLKJHGQLK2HJ > current.rev
+ git branch -d development
warning: deleting branch 'development' that has been merged to
         'refs/remotes/second-origin/development', but it is not yet merged to HEAD.
Deleted branch development (was 15bfafb).
+ git checkout -b development second-origin/development
Previous HEAD position was f8c45cf... Merging master
Switched to a new branch 'development'
Branch development set up to track remote branch development from second-origin.
+ cat current.rev >> file-changed.txt
+ git add file-changed.txt
+ git commit -m 'updating file-changed.txt'
[development 4fd83aa] updating file-changed.txt
 1 files changed, 1 insertions(+), 1 deletions(-)
+ git push second-origin development
ERROR: Repository not found.
fatal: The remote end hung up unexpectedly
Build step 'Execute shell' marked build as failure
Notifying upstream projects of job completion
Finished: FAILURE

我也尝试了我能想到的git push命令的各种风格,但没有任何作用:

git push -u second-origin development
git push
git push development
git push second-origin/development
git push second-origin:development
git push second-origin
git push remotes/second-origin
git push remotes/second-origin/development
git push second-origin user/repo-2/development
git push second-origin user/repo-2:development
git push second-origin user/repo-2 development

我觉得这与Jenkins插入git config core.sparsecheckout有关,但找不到有关该主题的任何内容。

1 个答案:

答案 0 :(得分:0)

我通过更新shell命令修复了这个问题:

  1. 定期git checkout second-origin/development
  2. 删除了git push,然后我添加了一个构建后的步骤 使用 Git Pulisher 来推动我想要的分支 second-origin