Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
jenkins
提交
dc578546
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,发现更多精彩内容 >>
提交
dc578546
编写于
5月 23, 2012
作者:
S
Sergey Burkov
提交者:
Kohsuke Kawaguchi
5月 25, 2012
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Revised version of Extension
上级
0f03a70c
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
171 addition
and
2 deletion
+171
-2
core/src/main/java/hudson/matrix/DefaultMatrixRunCheckoutStrategyImpl.java
...a/hudson/matrix/DefaultMatrixRunCheckoutStrategyImpl.java
+35
-0
core/src/main/java/hudson/matrix/MatrixProject.java
core/src/main/java/hudson/matrix/MatrixProject.java
+29
-0
core/src/main/java/hudson/matrix/MatrixRun.java
core/src/main/java/hudson/matrix/MatrixRun.java
+23
-0
core/src/main/java/hudson/matrix/MatrixRunCheckoutStrategy.java
...rc/main/java/hudson/matrix/MatrixRunCheckoutStrategy.java
+20
-0
core/src/main/java/hudson/matrix/MatrixRunCheckoutStrategyDescriptor.java
...va/hudson/matrix/MatrixRunCheckoutStrategyDescriptor.java
+23
-0
core/src/main/java/hudson/model/AbstractBuild.java
core/src/main/java/hudson/model/AbstractBuild.java
+2
-2
core/src/main/resources/hudson/matrix/DefaultMatrixRunCheckoutStrategyImpl/config.jelly
.../matrix/DefaultMatrixRunCheckoutStrategyImpl/config.jelly
+27
-0
core/src/main/resources/hudson/matrix/MatrixProject/configure-entries.jelly
...urces/hudson/matrix/MatrixProject/configure-entries.jelly
+12
-0
未找到文件。
core/src/main/java/hudson/matrix/DefaultMatrixRunCheckoutStrategyImpl.java
0 → 100644
浏览文件 @
dc578546
package
hudson.matrix
;
import
hudson.Extension
;
import
hudson.Launcher
;
import
hudson.model.BuildListener
;
import
java.io.IOException
;
import
org.kohsuke.stapler.DataBoundConstructor
;
public
class
DefaultMatrixRunCheckoutStrategyImpl
extends
MatrixRunCheckoutStrategy
{
@DataBoundConstructor
public
DefaultMatrixRunCheckoutStrategyImpl
()
{
}
@Override
protected
boolean
preCheckout
(
MatrixRun
build
,
Launcher
launcher
,
BuildListener
listener
)
throws
IOException
,
InterruptedException
{
return
true
;
}
@Override
protected
boolean
checkout
(
MatrixRun
build
,
Launcher
launcher
,
BuildListener
listener
)
throws
Exception
{
return
true
;
}
@Extension
public
static
class
DescriptorImpl
extends
MatrixRunCheckoutStrategyDescriptor
{
@Override
public
String
getDisplayName
()
{
return
"Classic"
;
}
}
}
core/src/main/java/hudson/matrix/MatrixProject.java
浏览文件 @
dc578546
...
...
@@ -160,6 +160,8 @@ public class MatrixProject extends AbstractProject<MatrixProject,MatrixBuild> im
private
MatrixExecutionStrategy
executionStrategy
;
private
MatrixRunCheckoutStrategy
matrixRunCheckoutStrategy
;
/**
* Custom workspace location for {@link MatrixConfiguration}s.
*
...
...
@@ -280,6 +282,16 @@ public class MatrixProject extends AbstractProject<MatrixProject,MatrixBuild> im
save
();
}
public
MatrixRunCheckoutStrategy
getMatrixRunCheckoutStrategy
()
{
return
matrixRunCheckoutStrategy
==
null
?
new
DefaultMatrixRunCheckoutStrategyImpl
()
:
matrixRunCheckoutStrategy
;
}
public
void
setMatrixRunCheckoutStrategy
(
MatrixRunCheckoutStrategy
matrixRunCheckoutStrategy
)
throws
IOException
{
if
(
matrixRunCheckoutStrategy
==
null
)
throw
new
IllegalArgumentException
();
this
.
matrixRunCheckoutStrategy
=
matrixRunCheckoutStrategy
;
save
();
}
/**
* @deprecated as of 1.456
* Use {@link DefaultMatrixExecutionStrategyImpl#isRunSequentially()}.
...
...
@@ -763,6 +775,19 @@ public class MatrixProject extends AbstractProject<MatrixProject,MatrixBuild> im
else
executionStrategy
=
req
.
bindJSON
(
esd
.
get
(
0
).
clazz
,
json
.
getJSONObject
(
"executionStrategy"
));
try
{
List
<
MatrixRunCheckoutStrategyDescriptor
>
mrcsd
=
MatrixRunCheckoutStrategyDescriptor
.
all
();
if
(
mrcsd
.
size
()
>
1
)
matrixRunCheckoutStrategy
=
req
.
bindJSON
(
MatrixRunCheckoutStrategy
.
class
,
json
.
getJSONObject
(
"matrixRunCheckoutStrategy"
));
else
matrixRunCheckoutStrategy
=
req
.
bindJSON
(
mrcsd
.
get
(
0
).
clazz
,
json
.
getJSONObject
(
"matrixRunCheckoutStrategy"
));
}
catch
(
Exception
exc
)
{
matrixRunCheckoutStrategy
=
new
DefaultMatrixRunCheckoutStrategyImpl
();
}
// parse system axes
DescribableList
<
Axis
,
AxisDescriptor
>
newAxes
=
new
DescribableList
<
Axis
,
AxisDescriptor
>(
this
);
newAxes
.
rebuildHetero
(
req
,
json
,
Axis
.
all
(),
"axis"
);
...
...
@@ -843,6 +868,10 @@ public class MatrixProject extends AbstractProject<MatrixProject,MatrixBuild> im
public
List
<
MatrixExecutionStrategyDescriptor
>
getExecutionStrategyDescriptors
()
{
return
MatrixExecutionStrategyDescriptor
.
all
();
}
public
List
<
MatrixRunCheckoutStrategyDescriptor
>
getMatrixRunCheckoutStrategyDescriptors
()
{
return
MatrixRunCheckoutStrategyDescriptor
.
all
();
}
}
private
static
final
Logger
LOGGER
=
Logger
.
getLogger
(
MatrixProject
.
class
.
getName
());
...
...
core/src/main/java/hudson/matrix/MatrixRun.java
浏览文件 @
dc578546
...
...
@@ -25,10 +25,14 @@ package hudson.matrix;
import
hudson.EnvVars
;
import
hudson.FilePath
;
import
hudson.Launcher
;
import
hudson.model.AbstractBuild
;
import
hudson.model.BuildListener
;
import
hudson.model.BuildableItemWithBuildWrappers
;
import
hudson.model.TopLevelItem
;
import
hudson.slaves.WorkspaceList
;
import
hudson.slaves.WorkspaceList.Lease
;
import
hudson.tasks.BuildWrapper
;
import
hudson.model.Build
;
import
hudson.model.Node
;
import
org.kohsuke.stapler.Ancestor
;
...
...
@@ -182,5 +186,24 @@ public class MatrixRun extends Build<MatrixConfiguration,MatrixRun> {
String
childWs
=
mp
.
getChildCustomWorkspace
();
return
Lease
.
createLinkedDummyLease
(
baseDir
.
child
(
env
.
expand
(
childWs
)),
baseLease
);
}
@Override
protected
void
preCheckout
(
Launcher
launcher
,
BuildListener
listener
)
throws
IOException
,
InterruptedException
{
MatrixProject
mp
=
getParent
().
getParent
();
MatrixRunCheckoutStrategy
strategy
=
mp
.
getMatrixRunCheckoutStrategy
();
boolean
invokeSuper
=
strategy
.
preCheckout
(
MatrixRun
.
this
,
launcher
,
listener
);
if
(
invokeSuper
)
{
super
.
preCheckout
(
launcher
,
listener
);
}
}
@Override
protected
void
checkout
(
BuildListener
listener
)
throws
Exception
{
MatrixProject
mp
=
getParent
().
getParent
();
MatrixRunCheckoutStrategy
strategy
=
mp
.
getMatrixRunCheckoutStrategy
();
boolean
invokeSuper
=
strategy
.
checkout
(
MatrixRun
.
this
,
launcher
,
listener
);
if
(
invokeSuper
)
{
super
.
checkout
(
listener
);
}
}
}
}
core/src/main/java/hudson/matrix/MatrixRunCheckoutStrategy.java
0 → 100644
浏览文件 @
dc578546
package
hudson.matrix
;
import
hudson.ExtensionPoint
;
import
hudson.Launcher
;
import
hudson.model.AbstractDescribableImpl
;
import
hudson.model.BuildListener
;
import
java.io.IOException
;
public
abstract
class
MatrixRunCheckoutStrategy
extends
AbstractDescribableImpl
<
MatrixRunCheckoutStrategy
>
implements
ExtensionPoint
{
protected
abstract
boolean
preCheckout
(
MatrixRun
build
,
Launcher
launcher
,
BuildListener
listener
)
throws
IOException
,
InterruptedException
;
protected
abstract
boolean
checkout
(
MatrixRun
build
,
Launcher
launcher
,
BuildListener
listener
)
throws
Exception
;
@Override
public
MatrixRunCheckoutStrategyDescriptor
getDescriptor
()
{
return
(
MatrixRunCheckoutStrategyDescriptor
)
super
.
getDescriptor
();
}
}
core/src/main/java/hudson/matrix/MatrixRunCheckoutStrategyDescriptor.java
0 → 100644
浏览文件 @
dc578546
package
hudson.matrix
;
import
hudson.DescriptorExtensionList
;
import
hudson.model.Descriptor
;
import
jenkins.model.Jenkins
;
public
abstract
class
MatrixRunCheckoutStrategyDescriptor
extends
Descriptor
<
MatrixRunCheckoutStrategy
>
{
protected
MatrixRunCheckoutStrategyDescriptor
(
Class
<?
extends
MatrixRunCheckoutStrategy
>
clazz
)
{
super
(
clazz
);
}
protected
MatrixRunCheckoutStrategyDescriptor
()
{
}
/**
* Returns all the registered {@link MatrixExecutionStrategyDescriptor}s.
*/
public
static
DescriptorExtensionList
<
MatrixRunCheckoutStrategy
,
MatrixRunCheckoutStrategyDescriptor
>
all
()
{
return
Jenkins
.
getInstance
().<
MatrixRunCheckoutStrategy
,
MatrixRunCheckoutStrategyDescriptor
>
getDescriptorList
(
MatrixRunCheckoutStrategy
.
class
);
}
}
core/src/main/java/hudson/model/AbstractBuild.java
浏览文件 @
dc578546
...
...
@@ -568,7 +568,7 @@ public abstract class AbstractBuild<P extends AbstractProject<P,R>,R extends Abs
* @throws IOException
* @throws InterruptedException
*/
pr
ivate
void
preCheckout
(
Launcher
launcher
,
BuildListener
listener
)
throws
IOException
,
InterruptedException
{
pr
otected
void
preCheckout
(
Launcher
launcher
,
BuildListener
listener
)
throws
IOException
,
InterruptedException
{
if
(
project
instanceof
BuildableItemWithBuildWrappers
)
{
BuildableItemWithBuildWrappers
biwbw
=
(
BuildableItemWithBuildWrappers
)
project
;
for
(
BuildWrapper
bw
:
biwbw
.
getBuildWrappersList
())
...
...
@@ -576,7 +576,7 @@ public abstract class AbstractBuild<P extends AbstractProject<P,R>,R extends Abs
}
}
pr
ivate
void
checkout
(
BuildListener
listener
)
throws
Exception
{
pr
otected
void
checkout
(
BuildListener
listener
)
throws
Exception
{
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.
...
...
core/src/main/resources/hudson/matrix/DefaultMatrixRunCheckoutStrategyImpl/config.jelly
0 → 100644
浏览文件 @
dc578546
<!--
The MIT License
Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
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.
-->
<!-- nothing to configure -->
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core"/>
core/src/main/resources/hudson/matrix/MatrixProject/configure-entries.jelly
浏览文件 @
dc578546
...
...
@@ -57,6 +57,18 @@ THE SOFTWARE.
<p:config-scm/>
<f:section title="${%Advanced Source Code Management}">
<j:choose>
<j:when test="${descriptor.matrixRunCheckoutStrategyDescriptors.size() gt 1}">
<f:dropdownDescriptorSelector title="${%Matrix Run Checkout Strategy}" field="matrixRunCheckoutStrategy"/>
</j:when>
<j:otherwise>
<!-- for the default case when there's only one build checkout strategy, render it inline to simplify the UI -->
<f:property field="matrixRunCheckoutStrategy" propertyDescriptor="${descriptor.matrixRunCheckoutStrategyDescriptors.get(0)}"/>
</j:otherwise>
</j:choose>
</f:section>
<p:config-trigger>
<p:config-upstream-pseudo-trigger />
</p:config-trigger>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录