Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
LinuxSuRen
jenkins
提交
1f844a55
J
jenkins
项目概览
LinuxSuRen
/
jenkins
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
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,发现更多精彩内容 >>
提交
1f844a55
编写于
1月 30, 2015
作者:
J
Jesse Glick
浏览文件
操作
浏览文件
下载
差异文件
[FiXED JENKINS-26698] Noting merge of #1554.
上级
7ad3f501
a398cabd
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
98 addition
and
13 deletion
+98
-13
changelog.html
changelog.html
+3
-0
core/src/main/java/hudson/model/Build.java
core/src/main/java/hudson/model/Build.java
+6
-2
core/src/main/java/hudson/model/Run.java
core/src/main/java/hudson/model/Run.java
+1
-10
core/src/main/java/hudson/slaves/WorkspaceList.java
core/src/main/java/hudson/slaves/WorkspaceList.java
+17
-1
test/src/test/java/hudson/model/BuildExecutionTest.java
test/src/test/java/hudson/model/BuildExecutionTest.java
+71
-0
未找到文件。
changelog.html
浏览文件 @
1f844a55
...
...
@@ -60,6 +60,9 @@ Upcoming changes</a>
<li
class=
'major bug'
>
Build format change migrator in 1.597 did not work on some Windows systems.
(
<a
href=
"https://issues.jenkins-ci.org/browse/JENKINS-26519"
>
issue 26519
</a>
)
<li
class=
bug
>
An error thrown in the wrong place in a publisher could result in a failure to release a workspace lock.
(
<a
href=
"https://issues.jenkins-ci.org/browse/JENKINS-26698"
>
issue 26698
</a>
)
<li
class=
bug
>
Errors in some Maven builds since 1.598.
(
<a
href=
"https://issues.jenkins-ci.org/browse/JENKINS-26601"
>
issue 26601
</a>
)
...
...
core/src/main/java/hudson/model/Build.java
浏览文件 @
1f844a55
...
...
@@ -189,8 +189,12 @@ public abstract class Build <P extends Project<P,B>,B extends Build<P,B>>
@Override
public
void
cleanUp
(
@Nonnull
BuildListener
listener
)
throws
Exception
{
// at this point it's too late to mark the build as a failure, so ignore return value.
performAllBuildSteps
(
listener
,
project
.
getPublishersList
(),
false
);
performAllBuildSteps
(
listener
,
project
.
getProperties
(),
false
);
try
{
performAllBuildSteps
(
listener
,
project
.
getPublishersList
(),
false
);
performAllBuildSteps
(
listener
,
project
.
getProperties
(),
false
);
}
catch
(
Exception
x
)
{
x
.
printStackTrace
(
listener
.
error
(
"Post-build steps failed"
));
}
super
.
cleanUp
(
listener
);
}
...
...
core/src/main/java/hudson/model/Run.java
浏览文件 @
1f844a55
...
...
@@ -72,7 +72,6 @@ import java.io.OutputStream;
import
java.io.PrintWriter
;
import
java.io.Reader
;
import
java.io.StringWriter
;
import
java.io.Writer
;
import
java.nio.charset.Charset
;
import
java.text.DateFormat
;
import
java.text.SimpleDateFormat
;
...
...
@@ -1832,15 +1831,7 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
if
(
e
instanceof
IOException
)
Util
.
displayIOException
((
IOException
)
e
,
listener
);
Writer
w
=
listener
.
fatalError
(
e
.
getMessage
());
if
(
w
!=
null
)
{
try
{
e
.
printStackTrace
(
new
PrintWriter
(
w
));
w
.
close
();
}
catch
(
IOException
e1
)
{
// ignore
}
}
e
.
printStackTrace
(
listener
.
fatalError
(
e
.
getMessage
()));
}
else
{
LOGGER
.
log
(
SEVERE
,
getDisplayName
()+
" failed to build and we don't even have a listener"
,
e
);
}
...
...
core/src/main/java/hudson/slaves/WorkspaceList.java
浏览文件 @
1f844a55
...
...
@@ -26,10 +26,12 @@ package hudson.slaves;
import
hudson.FilePath
;
import
hudson.Functions
;
import
hudson.model.Computer
;
import
java.io.Closeable
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.concurrent.atomic.AtomicBoolean
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
javax.annotation.Nonnull
;
...
...
@@ -104,7 +106,7 @@ public final class WorkspaceList {
/**
* Represents a leased workspace that needs to be returned later.
*/
public
static
abstract
class
Lease
{
public
static
abstract
class
Lease
implements
/*Auto*/
Closeable
{
public
final
@Nonnull
FilePath
path
;
protected
Lease
(
@Nonnull
FilePath
path
)
{
...
...
@@ -117,6 +119,14 @@ public final class WorkspaceList {
*/
public
abstract
void
release
();
/**
* By default, calls {@link #release}, but should be idempotent.
* @since 1.600
*/
@Override
public
void
close
()
{
release
();
}
/**
* Creates a dummy {@link Lease} object that does no-op in the release.
*/
...
...
@@ -261,9 +271,15 @@ public final class WorkspaceList {
*/
private
Lease
lease
(
@Nonnull
FilePath
p
)
{
return
new
Lease
(
p
)
{
final
AtomicBoolean
released
=
new
AtomicBoolean
();
public
void
release
()
{
_release
(
path
);
}
@Override
public
void
close
()
{
if
(
released
.
compareAndSet
(
false
,
true
))
{
release
();
}
}
};
}
...
...
test/src/test/java/hudson/model/BuildExecutionTest.java
0 → 100644
浏览文件 @
1f844a55
/*
* The MIT License
*
* Copyright 2015 Jesse Glick.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package
hudson.model
;
import
hudson.FilePath
;
import
hudson.Launcher
;
import
hudson.slaves.WorkspaceList
;
import
hudson.tasks.BuildStepMonitor
;
import
hudson.tasks.Notifier
;
import
java.io.IOException
;
import
org.junit.Test
;
import
static
org
.
junit
.
Assert
.*;
import
org.junit.Rule
;
import
org.jvnet.hudson.test.Issue
;
import
org.jvnet.hudson.test.JenkinsRule
;
public
class
BuildExecutionTest
{
@Rule
public
JenkinsRule
r
=
new
JenkinsRule
();
@Issue
(
"JENKINS-26698"
)
@Test
public
void
workspaceReliablyReleased
()
throws
Exception
{
FreeStyleProject
p
=
r
.
createFreeStyleProject
();
p
.
getPublishersList
().
add
(
new
BrokenPublisher
());
FreeStyleBuild
b
=
r
.
assertBuildStatus
(
Result
.
FAILURE
,
p
.
scheduleBuild2
(
0
).
get
());
r
.
assertLogContains
(
"Post-build steps failed"
,
b
);
FilePath
ws
=
r
.
jenkins
.
getWorkspaceFor
(
p
);
WorkspaceList
.
Lease
lease
=
r
.
jenkins
.
toComputer
().
getWorkspaceList
().
allocate
(
ws
);
try
{
assertEquals
(
ws
,
lease
.
path
);
}
finally
{
lease
.
close
();
}
}
@SuppressWarnings
(
"unchecked"
)
// not my fault
private
static
class
BrokenPublisher
extends
Notifier
{
@Override
public
boolean
needsToRunAfterFinalized
()
{
throw
new
IllegalStateException
(
"oops"
);
}
@Override
public
boolean
perform
(
AbstractBuild
<?,?>
build
,
Launcher
launcher
,
BuildListener
listener
)
throws
InterruptedException
,
IOException
{
return
true
;
}
@Override
public
BuildStepMonitor
getRequiredMonitorService
()
{
return
BuildStepMonitor
.
NONE
;
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录