詹金斯拉请求生成器

时间:2014-05-09 20:37:44

标签: github jenkins hudson jenkins-plugins hudson-plugins

我设置了Jenkins的父母和子女工作。父作业配置为在拉取请求时执行,子作业由父作业触发。

我的父作业配置

在“源代码管理”部分,

Repository URL: https://github.com/myorg/myrepo.git
Name: origin
Refspec: +refs/pull/*:refs/remotes/origin/pr/*
Branch Specifier (blank for default): ${sha1}

在构建部分,

Trigger/call builds on other projects : 
Current build parameters
Pass-through Git Commit that was built

我的子作业配置,

在“源代码管理”部分,

Repository URL: https://github.com/myorg/myrepo.git
Name: blank
Refspec: blank
Branch Specifier (blank for default): blank

问题:

执行子作业时出错,

父作业控制台,

00:00:00.249 Last Built Revision: Revision defghi (origin/pr/29/merge)
00:00:00.407 Fetching upstream changes from https://github.com/myorg/myrepo.git
00:00:02.237 Commencing build of Revision abcdef (origin/pr/28/merge)
00:00:02.247 Checking out Revision abcdef (origin/pr/28/merge)
00:00:02.843 Waiting for the completion of child
00:01:30.776 child #23 completed. Result was FAILURE

子作业控制台,

00:00:00.000 Started by upstream project "parent" build number 19
00:00:00.002 originally caused by:
00:00:00.002  GitHub pull request #28 of commit cdefgh automatically merged.
00:00:00.136 Last Built Revision: Revision bcdefg (detached)
00:00:01.101 Commencing build of Revision abcdef (detached)
00:00:01.151 Checking out Revision abcdef (detached)
00:00:01.317 FATAL: Could not checkout null with start point abcdef
00:00:01.317 hudson.plugins.git.GitException: Could not checkout null with start point abcdef
00:00:01.317    at hudson.plugins.git.GitAPI.checkoutBranch(GitAPI.java:863)
00:00:01.317    at hudson.plugins.git.GitSCM$4.invoke(GitSCM.java:1192)
00:00:01.317    at hudson.plugins.git.GitSCM$4.invoke(GitSCM.java:1176)
00:00:01.317    at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2394)
00:00:01.317    at hudson.remoting.UserRequest.perform(UserRequest.java:118)
00:00:01.317    at hudson.remoting.UserRequest.perform(UserRequest.java:48)
00:00:01.317    at hudson.remoting.Request$2.run(Request.java:326)
00:00:01.317    at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
00:00:01.317    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
00:00:01.317    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
00:00:01.317    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
00:00:01.317    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
00:00:01.317    at java.lang.Thread.run(Thread.java:619)
00:00:01.317 Caused by: hudson.plugins.git.GitException: Error performing command: /usr/bin/git checkout -f abcdef
00:00:01.317 Command "/usr/bin/git checkout -f abcdef" returned status code 128: fatal: reference is not a tree: abcdef

知道如何解决这个问题吗?

1 个答案:

答案 0 :(得分:1)

您还需要为子项目指定refspec(+ refs / pull / :refs / remotes / origin / pr / )和分支说明符($ {sha1})。< / p>