Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
jenkins
提交
ee38d15b
J
jenkins
项目概览
xxadev
/
jenkins
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jenkins
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ee38d15b
编写于
11月 08, 2011
作者:
C
Christoph Kutzinski
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Interrupting SCM checkout should mark the build as aborted instead of failed [JENKINS-4605]
上级
a4ba526d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
35 addition
and
7 deletion
+35
-7
core/src/main/java/hudson/model/AbstractBuild.java
core/src/main/java/hudson/model/AbstractBuild.java
+3
-6
core/src/main/java/hudson/scm/SCM.java
core/src/main/java/hudson/scm/SCM.java
+1
-1
test/src/test/java/hudson/scm/ScmTest.java
test/src/test/java/hudson/scm/ScmTest.java
+31
-0
未找到文件。
core/src/main/java/hudson/model/AbstractBuild.java
浏览文件 @
ee38d15b
...
...
@@ -68,6 +68,7 @@ import org.xml.sax.SAXException;
import
javax.servlet.ServletException
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.InterruptedIOException
;
import
java.io.StringWriter
;
import
java.lang.ref.WeakReference
;
import
java.text.MessageFormat
;
...
...
@@ -557,7 +558,6 @@ public abstract class AbstractBuild<P extends AbstractProject<P,R>,R extends Abs
}
private
void
checkout
(
BuildListener
listener
)
throws
Exception
{
try
{
for
(
int
retryCount
=
project
.
getScmCheckoutRetryCount
();
;
retryCount
--)
{
// for historical reasons, null in the scm field means CVS, so we need to explicitly set this to something
// in case check out fails and leaves a broken changelog.xml behind.
...
...
@@ -578,6 +578,8 @@ public abstract class AbstractBuild<P extends AbstractProject<P,R>,R extends Abs
}
}
catch
(
AbortException
e
)
{
listener
.
error
(
e
.
getMessage
());
}
catch
(
InterruptedIOException
e
)
{
throw
(
InterruptedException
)
new
InterruptedException
().
initCause
(
e
);
}
catch
(
IOException
e
)
{
// checkout error not yet reported
e
.
printStackTrace
(
listener
.
getLogger
());
...
...
@@ -589,11 +591,6 @@ public abstract class AbstractBuild<P extends AbstractProject<P,R>,R extends Abs
listener
.
getLogger
().
println
(
"Retrying after 10 seconds"
);
Thread
.
sleep
(
10000
);
}
}
catch
(
InterruptedException
e
)
{
listener
.
getLogger
().
println
(
Messages
.
AbstractProject_ScmAborted
());
LOGGER
.
log
(
Level
.
INFO
,
AbstractBuild
.
this
+
" aborted"
,
e
);
throw
new
RunnerAbortedException
();
}
}
/**
...
...
core/src/main/java/hudson/scm/SCM.java
浏览文件 @
ee38d15b
...
...
@@ -416,7 +416,7 @@ public abstract class SCM implements Describable<SCM>, ExtensionPoint {
*
* @throws InterruptedException
* interruption is usually caused by the user aborting the build.
* this exception will cause the build to
fail
.
* this exception will cause the build to
be aborted
.
*/
public
abstract
boolean
checkout
(
AbstractBuild
<?,?>
build
,
Launcher
launcher
,
FilePath
workspace
,
BuildListener
listener
,
File
changelogFile
)
throws
IOException
,
InterruptedException
;
...
...
test/src/test/java/hudson/scm/ScmTest.java
浏览文件 @
ee38d15b
...
...
@@ -23,10 +23,20 @@
*/
package
hudson.scm
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.concurrent.ExecutionException
;
import
hudson.FilePath
;
import
hudson.Launcher
;
import
hudson.model.AbstractBuild
;
import
hudson.model.AbstractProject
;
import
hudson.model.BuildListener
;
import
hudson.model.FreeStyleBuild
;
import
hudson.model.FreeStyleProject
;
import
hudson.model.Node
;
import
hudson.model.Result
;
import
org.jvnet.hudson.test.Bug
;
import
org.jvnet.hudson.test.HudsonTestCase
;
...
...
@@ -56,4 +66,25 @@ public class ScmTest extends HudsonTestCase {
p
.
delete
();
assertTrue
(
callback
[
0
]);
}
@Bug
(
4605
)
public
void
testAbortDuringCheckoutMarksBuildAsAborted
()
throws
IOException
,
InterruptedException
,
ExecutionException
{
FreeStyleProject
p
=
createFreeStyleProject
();
p
.
setScm
(
new
NullSCM
()
{
@Override
public
boolean
checkout
(
AbstractBuild
<?,
?>
build
,
Launcher
launcher
,
FilePath
remoteDir
,
BuildListener
listener
,
File
changeLogFile
)
throws
IOException
,
InterruptedException
{
throw
new
InterruptedException
();
}
private
Object
writeReplace
()
{
// don't really care about save
return
new
NullSCM
();
}
});
FreeStyleBuild
build
=
p
.
scheduleBuild2
(
0
).
get
();
assertEquals
(
Result
.
ABORTED
,
build
.
getResult
());
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录