Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
FIY695
jenkins
提交
67646214
J
jenkins
项目概览
FIY695
/
jenkins
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
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,发现更多精彩内容 >>
提交
67646214
编写于
5月 17, 2011
作者:
K
Kohsuke Kawaguchi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Prototype label parameterization.
上级
872b4dfb
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
46 addition
and
7 deletion
+46
-7
core/src/main/java/hudson/model/ParameterValue.java
core/src/main/java/hudson/model/ParameterValue.java
+9
-1
core/src/main/java/hudson/model/ParametersAction.java
core/src/main/java/hudson/model/ParametersAction.java
+11
-1
core/src/main/java/hudson/model/Queue.java
core/src/main/java/hudson/model/Queue.java
+14
-5
core/src/main/java/hudson/model/labels/LabelAssignmentAction.java
.../main/java/hudson/model/labels/LabelAssignmentAction.java
+12
-0
未找到文件。
core/src/main/java/hudson/model/ParameterValue.java
浏览文件 @
67646214
...
...
@@ -26,6 +26,7 @@ package hudson.model;
import
hudson.EnvVars
;
import
hudson.Util
;
import
hudson.model.queue.SubTask
;
import
hudson.scm.SCM
;
import
hudson.slaves.OfflineCause
;
import
hudson.tasks.BuildWrapper
;
...
...
@@ -256,5 +257,12 @@ public abstract class ParameterValue implements Serializable {
*/
public
boolean
isSensitive
()
{
return
false
;
}
}
/**
* @since 1.414
*/
public
Label
getAssignedLabel
(
SubTask
task
)
{
return
null
;
}
}
core/src/main/java/hudson/model/ParametersAction.java
浏览文件 @
67646214
...
...
@@ -27,6 +27,8 @@ import hudson.Util;
import
hudson.EnvVars
;
import
hudson.diagnosis.OldDataMonitor
;
import
hudson.model.Queue.QueueAction
;
import
hudson.model.labels.LabelAssignmentAction
;
import
hudson.model.queue.SubTask
;
import
hudson.tasks.BuildStep
;
import
hudson.tasks.BuildWrapper
;
import
hudson.util.VariableResolver
;
...
...
@@ -50,7 +52,7 @@ import java.util.Set;
* that were specified when scheduling.
*/
@ExportedBean
public
class
ParametersAction
implements
Action
,
Iterable
<
ParameterValue
>,
QueueAction
,
EnvironmentContributingAction
{
public
class
ParametersAction
implements
Action
,
Iterable
<
ParameterValue
>,
QueueAction
,
EnvironmentContributingAction
,
LabelAssignmentAction
{
private
final
List
<
ParameterValue
>
parameters
;
...
...
@@ -119,6 +121,14 @@ public class ParametersAction implements Action, Iterable<ParameterValue>, Queue
return
null
;
}
public
Label
getAssignedLabel
(
SubTask
task
)
{
for
(
ParameterValue
p
:
parameters
)
{
Label
l
=
p
.
getAssignedLabel
(
task
);
if
(
l
!=
null
)
return
l
;
}
return
null
;
}
public
String
getDisplayName
()
{
return
Messages
.
ParameterAction_DisplayName
();
}
...
...
core/src/main/java/hudson/model/Queue.java
浏览文件 @
67646214
...
...
@@ -36,6 +36,7 @@ import static hudson.util.Iterators.reverse;
import
hudson.cli.declarative.CLIMethod
;
import
hudson.cli.declarative.CLIResolver
;
import
hudson.model.labels.LabelAssignmentAction
;
import
hudson.model.queue.AbstractQueueTask
;
import
hudson.model.queue.Executables
;
import
hudson.model.queue.SubTask
;
...
...
@@ -678,10 +679,10 @@ public class Queue extends ResourceController implements Saveable {
public
synchronized
int
countBuildableItemsFor
(
Label
l
)
{
int
r
=
0
;
for
(
BuildableItem
bi
:
buildables
.
values
())
if
(
bi
.
task
.
getAssignedLabel
()==
l
)
if
(
bi
.
getAssignedLabel
()==
l
)
r
++;
for
(
BuildableItem
bi
:
pendings
.
values
())
if
(
bi
.
task
.
getAssignedLabel
()==
l
)
if
(
bi
.
getAssignedLabel
()==
l
)
r
++;
return
r
;
}
...
...
@@ -960,7 +961,7 @@ public class Queue extends ResourceController implements Saveable {
for
(
Node
n
:
h
.
getNodes
())
hash
.
add
(
n
,
n
.
getNumExecutors
()*
100
);
Label
lbl
=
p
.
task
.
getAssignedLabel
();
Label
lbl
=
p
.
getAssignedLabel
();
for
(
Node
n
:
hash
.
list
(
p
.
task
.
getFullDisplayName
()))
{
Computer
c
=
n
.
toComputer
();
if
(
c
==
null
||
c
.
isOffline
())
continue
;
...
...
@@ -1215,6 +1216,14 @@ public class Queue extends ResourceController implements Saveable {
*/
public
Future
<
Executable
>
getFuture
()
{
return
future
;
}
public
Label
getAssignedLabel
()
{
for
(
LabelAssignmentAction
laa
:
getActions
(
LabelAssignmentAction
.
class
))
{
Label
l
=
laa
.
getAssignedLabel
(
task
);
if
(
l
!=
null
)
return
l
;
}
return
task
.
getAssignedLabel
();
}
/**
* Convenience method that returns a read only view of the {@link Cause}s associated with this item in the queue.
*
...
...
@@ -1448,7 +1457,7 @@ public class Queue extends ResourceController implements Saveable {
if
(
ifBlockedByHudsonShutdown
(
task
))
return
CauseOfBlockage
.
fromMessage
(
Messages
.
_Queue_HudsonIsAboutToShutDown
());
Label
label
=
task
.
getAssignedLabel
();
Label
label
=
getAssignedLabel
();
if
(
hudson
.
getNodes
().
isEmpty
())
label
=
null
;
// no master/slave. pointless to talk about nodes
...
...
@@ -1470,7 +1479,7 @@ public class Queue extends ResourceController implements Saveable {
@Override
public
boolean
isStuck
()
{
Label
label
=
task
.
getAssignedLabel
();
Label
label
=
getAssignedLabel
();
if
(
label
!=
null
&&
label
.
isOffline
())
// no executor online to process this job. definitely stuck.
return
true
;
...
...
core/src/main/java/hudson/model/labels/LabelAssignmentAction.java
0 → 100644
浏览文件 @
67646214
package
hudson.model.labels
;
import
hudson.model.Action
;
import
hudson.model.Label
;
import
hudson.model.queue.SubTask
;
/**
* @author Kohsuke Kawaguchi
*/
public
interface
LabelAssignmentAction
extends
Action
{
Label
getAssignedLabel
(
SubTask
task
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录