Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
jenkins
提交
310c9526
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,发现更多精彩内容 >>
提交
310c9526
编写于
6月 07, 2016
作者:
N
Nicolas De Loof
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[JENKINS-34923]
Signed-off-by:
N
Nicolas De Loof
<
nicolas.deloof@gmail.com
>
上级
405c86af
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
51 addition
and
23 deletion
+51
-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
+20
-0
core/src/main/java/hudson/slaves/SlaveComputer.java
core/src/main/java/hudson/slaves/SlaveComputer.java
+4
-0
未找到文件。
core/src/main/java/hudson/model/Computer.java
浏览文件 @
310c9526
...
@@ -1014,7 +1014,7 @@ public /*transient*/ abstract class Computer extends Actionable implements Acces
...
@@ -1014,7 +1014,7 @@ public /*transient*/ abstract class Computer extends Actionable implements Acces
/**
/**
* Called by {@link Executor} to kill excessive executors from this computer.
* 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
()
{
final
Runnable
task
=
new
Runnable
()
{
@Override
@Override
public
void
run
()
{
public
void
run
()
{
...
...
core/src/main/java/hudson/model/Run.java
浏览文件 @
310c9526
...
@@ -1701,28 +1701,7 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
...
@@ -1701,28 +1701,7 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
charset
=
computer
.
getDefaultCharset
();
charset
=
computer
.
getDefaultCharset
();
this
.
charset
=
charset
.
name
();
this
.
charset
=
charset
.
name
();
}
}
listener
=
createBuildListener
(
job
,
listener
,
charset
);
// 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
.
started
(
getCauses
());
listener
.
started
(
getCauses
());
Authentication
auth
=
Jenkins
.
getAuthentication
();
Authentication
auth
=
Jenkins
.
getAuthentication
();
...
@@ -1811,6 +1790,30 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
...
@@ -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.
* 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,
* 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
...
@@ -1868,6 +1871,7 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
startTime
=
System
.
currentTimeMillis
();
startTime
=
System
.
currentTimeMillis
();
if
(
runner
!=
null
)
if
(
runner
!=
null
)
RunnerStack
.
INSTANCE
.
push
(
runner
);
RunnerStack
.
INSTANCE
.
push
(
runner
);
RunListener
.
fireInitialize
(
this
);
}
}
/**
/**
...
...
core/src/main/java/hudson/model/listeners/RunListener.java
浏览文件 @
310c9526
...
@@ -33,6 +33,7 @@ import hudson.Launcher;
...
@@ -33,6 +33,7 @@ import hudson.Launcher;
import
hudson.model.AbstractBuild
;
import
hudson.model.AbstractBuild
;
import
hudson.model.BuildListener
;
import
hudson.model.BuildListener
;
import
hudson.model.Environment
;
import
hudson.model.Environment
;
import
hudson.model.Job
;
import
hudson.model.JobProperty
;
import
hudson.model.JobProperty
;
import
hudson.model.Run
;
import
hudson.model.Run
;
import
hudson.model.Run.RunnerAbortedException
;
import
hudson.model.Run.RunnerAbortedException
;
...
@@ -107,6 +108,12 @@ public abstract class RunListener<R extends Run> implements ExtensionPoint {
...
@@ -107,6 +108,12 @@ public abstract class RunListener<R extends Run> implements ExtensionPoint {
*/
*/
public
void
onFinalized
(
R
r
)
{}
public
void
onFinalized
(
R
r
)
{}
/**
* Called when a Run is entering execution.
* @param r
*/
public
void
onInitialize
(
R
r
)
{}
/**
/**
* Called when a build is started (i.e. it was in the queue, and will now start running
* Called when a build is started (i.e. it was in the queue, and will now start running
* on an executor)
* on an executor)
...
@@ -206,6 +213,18 @@ public abstract class RunListener<R extends Run> implements ExtensionPoint {
...
@@ -206,6 +213,18 @@ public abstract class RunListener<R extends Run> implements ExtensionPoint {
}
}
}
}
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.
* Fires the {@link #onStarted(Run, TaskListener)} event.
*/
*/
...
@@ -263,4 +282,5 @@ public abstract class RunListener<R extends Run> implements ExtensionPoint {
...
@@ -263,4 +282,5 @@ public abstract class RunListener<R extends Run> implements ExtensionPoint {
}
}
private
static
final
Logger
LOGGER
=
Logger
.
getLogger
(
RunListener
.
class
.
getName
());
private
static
final
Logger
LOGGER
=
Logger
.
getLogger
(
RunListener
.
class
.
getName
());
}
}
core/src/main/java/hudson/slaves/SlaveComputer.java
浏览文件 @
310c9526
...
@@ -204,6 +204,10 @@ public class SlaveComputer extends Computer {
...
@@ -204,6 +204,10 @@ public class SlaveComputer extends Computer {
}
}
}
}
public
TaskListener
getListener
()
{
return
taskListener
;
}
@Override
@Override
public
String
getIcon
()
{
public
String
getIcon
()
{
Future
<?>
l
=
lastConnectActivity
;
Future
<?>
l
=
lastConnectActivity
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录