Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
LinuxSuRen
jenkins
提交
ceb36b54
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,发现更多精彩内容 >>
提交
ceb36b54
编写于
6月 09, 2016
作者:
N
Nicolas De loof
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2395 from ndeloof/one-shot-6
[JENKINS-34923]
上级
057791ca
97a3f714
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
60 addition
and
23 deletion
+60
-23
core/src/main/java/hudson/model/Computer.java
core/src/main/java/hudson/model/Computer.java
+1
-1
core/src/main/java/hudson/model/Run.java
core/src/main/java/hudson/model/Run.java
+26
-22
core/src/main/java/hudson/model/listeners/RunListener.java
core/src/main/java/hudson/model/listeners/RunListener.java
+25
-0
core/src/main/java/hudson/slaves/SlaveComputer.java
core/src/main/java/hudson/slaves/SlaveComputer.java
+8
-0
未找到文件。
core/src/main/java/hudson/model/Computer.java
浏览文件 @
ceb36b54
...
...
@@ -1014,7 +1014,7 @@ public /*transient*/ abstract class Computer extends Actionable implements Acces
/**
* Called by {@link Executor} to kill excessive executors from this computer.
*/
/*package*/
void
removeExecutor
(
final
Executor
e
)
{
protected
void
removeExecutor
(
final
Executor
e
)
{
final
Runnable
task
=
new
Runnable
()
{
@Override
public
void
run
()
{
...
...
core/src/main/java/hudson/model/Run.java
浏览文件 @
ceb36b54
...
...
@@ -1701,28 +1701,7 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
charset
=
computer
.
getDefaultCharset
();
this
.
charset
=
charset
.
name
();
}
// don't do buffering so that what's written to the listener
// gets reflected to the file immediately, which can then be
// served to the browser immediately
OutputStream
logger
=
new
FileOutputStream
(
getLogFile
());
RunT
build
=
job
.
getBuild
();
// Global log filters
for
(
ConsoleLogFilter
filter
:
ConsoleLogFilter
.
all
())
{
logger
=
filter
.
decorateLogger
(
build
,
logger
);
}
// Project specific log filters
if
(
project
instanceof
BuildableItemWithBuildWrappers
&&
build
instanceof
AbstractBuild
)
{
BuildableItemWithBuildWrappers
biwbw
=
(
BuildableItemWithBuildWrappers
)
project
;
for
(
BuildWrapper
bw
:
biwbw
.
getBuildWrappersList
())
{
logger
=
bw
.
decorateLogger
((
AbstractBuild
)
build
,
logger
);
}
}
listener
=
new
StreamBuildListener
(
logger
,
charset
);
listener
=
createBuildListener
(
job
,
listener
,
charset
);
listener
.
started
(
getCauses
());
Authentication
auth
=
Jenkins
.
getAuthentication
();
...
...
@@ -1811,6 +1790,30 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
}
}
private
StreamBuildListener
createBuildListener
(
@Nonnull
RunExecution
job
,
StreamBuildListener
listener
,
Charset
charset
)
throws
IOException
,
InterruptedException
{
// don't do buffering so that what's written to the listener
// gets reflected to the file immediately, which can then be
// served to the browser immediately
OutputStream
logger
=
new
FileOutputStream
(
getLogFile
(),
true
);
RunT
build
=
job
.
getBuild
();
// Global log filters
for
(
ConsoleLogFilter
filter
:
ConsoleLogFilter
.
all
())
{
logger
=
filter
.
decorateLogger
(
build
,
logger
);
}
// Project specific log filters
if
(
project
instanceof
BuildableItemWithBuildWrappers
&&
build
instanceof
AbstractBuild
)
{
BuildableItemWithBuildWrappers
biwbw
=
(
BuildableItemWithBuildWrappers
)
project
;
for
(
BuildWrapper
bw
:
biwbw
.
getBuildWrappersList
())
{
logger
=
bw
.
decorateLogger
((
AbstractBuild
)
build
,
logger
);
}
}
listener
=
new
StreamBuildListener
(
logger
,
charset
);
return
listener
;
}
/**
* Makes sure that {@code lastSuccessful} and {@code lastStable} legacy links in the project’s root directory exist.
* Normally you do not need to call this explicitly, since {@link #execute} does so,
...
...
@@ -1868,6 +1871,7 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
startTime
=
System
.
currentTimeMillis
();
if
(
runner
!=
null
)
RunnerStack
.
INSTANCE
.
push
(
runner
);
RunListener
.
fireInitialize
(
this
);
}
/**
...
...
core/src/main/java/hudson/model/listeners/RunListener.java
浏览文件 @
ceb36b54
...
...
@@ -33,6 +33,7 @@ import hudson.Launcher;
import
hudson.model.AbstractBuild
;
import
hudson.model.BuildListener
;
import
hudson.model.Environment
;
import
hudson.model.Job
;
import
hudson.model.JobProperty
;
import
hudson.model.Run
;
import
hudson.model.Run.RunnerAbortedException
;
...
...
@@ -107,6 +108,14 @@ public abstract class RunListener<R extends Run> implements ExtensionPoint {
*/
public
void
onFinalized
(
R
r
)
{}
/**
* Called when a Run is entering execution.
* @param r
* The started build.
* @since 2.9
*/
public
void
onInitialize
(
R
r
)
{}
/**
* Called when a build is started (i.e. it was in the queue, and will now start running
* on an executor)
...
...
@@ -206,6 +215,21 @@ public abstract class RunListener<R extends Run> implements ExtensionPoint {
}
}
/**
* Fires the {@link #onInitialize(Run)} event.
*/
public
static
void
fireInitialize
(
Run
r
)
{
for
(
RunListener
l
:
all
())
{
if
(
l
.
targetType
.
isInstance
(
r
))
try
{
l
.
onInitialize
(
r
);
}
catch
(
Throwable
e
)
{
report
(
e
);
}
}
}
/**
* Fires the {@link #onStarted(Run, TaskListener)} event.
*/
...
...
@@ -263,4 +287,5 @@ public abstract class RunListener<R extends Run> implements ExtensionPoint {
}
private
static
final
Logger
LOGGER
=
Logger
.
getLogger
(
RunListener
.
class
.
getName
());
}
core/src/main/java/hudson/slaves/SlaveComputer.java
浏览文件 @
ceb36b54
...
...
@@ -204,6 +204,14 @@ public class SlaveComputer extends Computer {
}
}
/**
* Return the {@code TaskListener} for this SlaveComputer. Never null
* @since 2.9
*/
public
TaskListener
getListener
()
{
return
taskListener
;
}
@Override
public
String
getIcon
()
{
Future
<?>
l
=
lastConnectActivity
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录