Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
roginluo
Jenkins
提交
e65f893b
J
Jenkins
项目概览
roginluo
/
Jenkins
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
Jenkins
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e65f893b
编写于
4月 12, 2011
作者:
C
Christoph Kutzinski
提交者:
Kohsuke Kawaguchi
4月 19, 2011
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[JENKINS-8848] allow custom workspaces for maven jobs
上级
1f8ac362
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
51 addition
and
109 deletion
+51
-109
core/src/main/java/hudson/matrix/MatrixBuild.java
core/src/main/java/hudson/matrix/MatrixBuild.java
+0
-11
core/src/main/java/hudson/matrix/MatrixProject.java
core/src/main/java/hudson/matrix/MatrixProject.java
+0
-33
core/src/main/java/hudson/model/AbstractBuild.java
core/src/main/java/hudson/model/AbstractBuild.java
+5
-0
core/src/main/java/hudson/model/AbstractProject.java
core/src/main/java/hudson/model/AbstractProject.java
+38
-0
core/src/main/java/hudson/model/FreeStyleBuild.java
core/src/main/java/hudson/model/FreeStyleBuild.java
+0
-11
core/src/main/java/hudson/model/FreeStyleProject.java
core/src/main/java/hudson/model/FreeStyleProject.java
+0
-43
maven-plugin/src/main/resources/hudson/maven/MavenModuleSet/configure-entries.jelly
...urces/hudson/maven/MavenModuleSet/configure-entries.jelly
+3
-2
war/src/main/webapp/help/project-config/custom-workspace.html
...src/main/webapp/help/project-config/custom-workspace.html
+1
-2
war/src/main/webapp/help/project-config/custom-workspace_de.html
.../main/webapp/help/project-config/custom-workspace_de.html
+2
-3
war/src/main/webapp/help/project-config/custom-workspace_fr.html
.../main/webapp/help/project-config/custom-workspace_fr.html
+1
-2
war/src/main/webapp/help/project-config/custom-workspace_tr.html
.../main/webapp/help/project-config/custom-workspace_tr.html
+1
-2
未找到文件。
core/src/main/java/hudson/matrix/MatrixBuild.java
浏览文件 @
e65f893b
...
...
@@ -323,17 +323,6 @@ public class MatrixBuild extends AbstractBuild<MatrixProject,MatrixBuild> {
for
(
MatrixAggregator
a
:
aggregators
)
a
.
endBuild
();
}
@Override
protected
Lease
decideWorkspace
(
Node
n
,
WorkspaceList
wsl
)
throws
IOException
,
InterruptedException
{
String
customWorkspace
=
getProject
().
getCustomWorkspace
();
if
(
customWorkspace
!=
null
)
{
// we allow custom workspaces to be concurrently used between jobs.
return
Lease
.
createDummyLease
(
n
.
getRootPath
().
child
(
getEnvironment
(
listener
).
expand
(
customWorkspace
)));
}
return
super
.
decideWorkspace
(
n
,
wsl
);
}
}
/**
...
...
core/src/main/java/hudson/matrix/MatrixProject.java
浏览文件 @
e65f893b
...
...
@@ -143,11 +143,6 @@ public class MatrixProject extends AbstractProject<MatrixProject,MatrixBuild> im
*/
private
Result
touchStoneResultCondition
;
/**
* See {@link #setCustomWorkspace(String)}.
*/
private
String
customWorkspace
;
public
MatrixProject
(
String
name
)
{
this
(
Hudson
.
getInstance
(),
name
);
}
...
...
@@ -229,28 +224,6 @@ public class MatrixProject extends AbstractProject<MatrixProject,MatrixBuild> im
this
.
touchStoneResultCondition
=
touchStoneResultCondition
;
}
public
String
getCustomWorkspace
()
{
return
customWorkspace
;
}
/**
* User-specified workspace directory, or null if it's up to Hudson.
*
* <p>
* Normally a matrix project uses the workspace location assigned by its parent container,
* but sometimes people have builds that have hard-coded paths.
*
* <p>
* This is not {@link File} because it may have to hold a path representation on another OS.
*
* <p>
* If this path is relative, it's resolved against {@link Node#getRootPath()} on the node where this workspace
* is prepared.
*/
public
void
setCustomWorkspace
(
String
customWorkspace
)
throws
IOException
{
this
.
customWorkspace
=
customWorkspace
;
}
@Override
protected
List
<
Action
>
createTransientActions
()
{
List
<
Action
>
r
=
super
.
createTransientActions
();
...
...
@@ -594,12 +567,6 @@ public class MatrixProject extends AbstractProject<MatrixProject,MatrixBuild> im
this
.
touchStoneCombinationFilter
=
null
;
}
if
(
req
.
hasParameter
(
"customWorkspace"
))
{
customWorkspace
=
req
.
getParameter
(
"customWorkspace.directory"
);
}
else
{
customWorkspace
=
null
;
}
// parse system axes
DescribableList
<
Axis
,
AxisDescriptor
>
newAxes
=
new
DescribableList
<
Axis
,
AxisDescriptor
>(
this
);
newAxes
.
rebuildHetero
(
req
,
json
,
Axis
.
all
(),
"axis"
);
...
...
core/src/main/java/hudson/model/AbstractBuild.java
浏览文件 @
e65f893b
...
...
@@ -394,6 +394,11 @@ public abstract class AbstractBuild<P extends AbstractProject<P,R>,R extends Abs
* Passed in for the convenience. The returned path must be registered to this object.
*/
protected
Lease
decideWorkspace
(
Node
n
,
WorkspaceList
wsl
)
throws
InterruptedException
,
IOException
{
String
customWorkspace
=
getProject
().
getCustomWorkspace
();
if
(
customWorkspace
!=
null
)
{
// we allow custom workspaces to be concurrently used between jobs.
return
Lease
.
createDummyLease
(
n
.
getRootPath
().
child
(
getEnvironment
(
listener
).
expand
(
customWorkspace
)));
}
// TODO: this cast is indicative of abstraction problem
return
wsl
.
allocate
(
n
.
getWorkspaceFor
((
TopLevelItem
)
getProject
()));
}
...
...
core/src/main/java/hudson/model/AbstractProject.java
浏览文件 @
e65f893b
...
...
@@ -219,6 +219,13 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
private
boolean
concurrentBuild
;
/**
* See {@link #setCustomWorkspace(String)}.
*
* @since xxx
*/
private
String
customWorkspace
;
protected
AbstractProject
(
ItemGroup
parent
,
String
name
)
{
super
(
parent
,
name
);
...
...
@@ -1629,6 +1636,12 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
blockBuildWhenDownstreamBuilding
=
req
.
getParameter
(
"blockBuildWhenDownstreamBuilding"
)!=
null
;
blockBuildWhenUpstreamBuilding
=
req
.
getParameter
(
"blockBuildWhenUpstreamBuilding"
)!=
null
;
if
(
req
.
hasParameter
(
"customWorkspace"
))
{
customWorkspace
=
req
.
getParameter
(
"customWorkspace.directory"
);
}
else
{
customWorkspace
=
null
;
}
if
(
req
.
getParameter
(
"hasSlaveAffinity"
)!=
null
)
{
assignedNode
=
Util
.
fixEmptyAndTrim
(
req
.
getParameter
(
"_.assignedLabelString"
));
}
else
{
...
...
@@ -1942,4 +1955,29 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
throw
new
CmdLineException
(
null
,
Messages
.
AbstractItem_NoSuchJobExists
(
name
,
AbstractProject
.
findNearest
(
name
).
getFullName
()));
return
item
;
}
public
String
getCustomWorkspace
()
{
return
customWorkspace
;
}
/**
* User-specified workspace directory, or null if it's up to Jenkins.
*
* <p>
* Normally a project uses the workspace location assigned by its parent container,
* but sometimes people have builds that have hard-coded paths.
*
* <p>
* This is not {@link File} because it may have to hold a path representation on another OS.
*
* <p>
* If this path is relative, it's resolved against {@link Node#getRootPath()} on the node where this workspace
* is prepared.
*
* @since XXX
*/
public
void
setCustomWorkspace
(
String
customWorkspace
)
throws
IOException
{
this
.
customWorkspace
=
customWorkspace
;
save
();
}
}
core/src/main/java/hudson/model/FreeStyleBuild.java
浏览文件 @
e65f893b
...
...
@@ -45,15 +45,4 @@ public class FreeStyleBuild extends Build<FreeStyleProject,FreeStyleBuild> {
public
void
run
()
{
run
(
new
RunnerImpl
());
}
protected
class
RunnerImpl
extends
Build
<
FreeStyleProject
,
FreeStyleBuild
>.
RunnerImpl
{
@Override
protected
Lease
decideWorkspace
(
Node
n
,
WorkspaceList
wsl
)
throws
IOException
,
InterruptedException
{
String
customWorkspace
=
getProject
().
getCustomWorkspace
();
if
(
customWorkspace
!=
null
)
// we allow custom workspaces to be concurrently used between jobs.
return
Lease
.
createDummyLease
(
n
.
getRootPath
().
child
(
getEnvironment
(
listener
).
expand
(
customWorkspace
)));
return
super
.
decideWorkspace
(
n
,
wsl
);
}
}
}
core/src/main/java/hudson/model/FreeStyleProject.java
浏览文件 @
e65f893b
...
...
@@ -39,12 +39,6 @@ import javax.servlet.ServletException;
* @author Kohsuke Kawaguchi
*/
public
class
FreeStyleProject
extends
Project
<
FreeStyleProject
,
FreeStyleBuild
>
implements
TopLevelItem
{
/**
* See {@link #setCustomWorkspace(String)}.
*
* @since 1.216
*/
private
String
customWorkspace
;
/**
* @deprecated as of 1.390
...
...
@@ -62,43 +56,6 @@ public class FreeStyleProject extends Project<FreeStyleProject,FreeStyleBuild> i
return
FreeStyleBuild
.
class
;
}
public
String
getCustomWorkspace
()
{
return
customWorkspace
;
}
/**
* User-specified workspace directory, or null if it's up to Hudson.
*
* <p>
* Normally a free-style project uses the workspace location assigned by its parent container,
* but sometimes people have builds that have hard-coded paths (which can be only built in
* certain locations. see http://www.nabble.com/Customize-Workspace-directory-tt17194310.html for
* one such discussion.)
*
* <p>
* This is not {@link File} because it may have to hold a path representation on another OS.
*
* <p>
* If this path is relative, it's resolved against {@link Node#getRootPath()} on the node where this workspace
* is prepared.
*
* @since 1.320
*/
public
void
setCustomWorkspace
(
String
customWorkspace
)
throws
IOException
{
this
.
customWorkspace
=
customWorkspace
;
save
();
}
@Override
protected
void
submit
(
StaplerRequest
req
,
StaplerResponse
rsp
)
throws
IOException
,
ServletException
,
Descriptor
.
FormException
{
if
(
req
.
hasParameter
(
"customWorkspace"
))
customWorkspace
=
req
.
getParameter
(
"customWorkspace.directory"
);
else
customWorkspace
=
null
;
super
.
submit
(
req
,
rsp
);
}
public
DescriptorImpl
getDescriptor
()
{
return
DESCRIPTOR
;
}
...
...
maven-plugin/src/main/resources/hudson/maven/MavenModuleSet/configure-entries.jelly
浏览文件 @
e65f893b
...
...
@@ -92,7 +92,8 @@ THE SOFTWARE.
<f:optionalBlock name="maven.resolveDependencies" title="${%Resolve Dependencies during Pom parsing}"
checked="${it.isResolveDependencies()}" />
<f:optionalBlock name="maven.processPlugins" title="${%Process Plugins during Pom parsing}"
checked="${it.isProcessPlugins()}" />
checked="${it.isProcessPlugins()}" />
<p:config-customWorkspace />
<j:set var="mavenValidationLevels" value="${it.descriptor.mavenValidationLevels}" />
<f:entry title="${%Maven Validation Level}">
...
...
@@ -114,4 +115,4 @@ THE SOFTWARE.
<p:config-buildWrappers />
<p:config-publishers />
</j:jelly>
\ No newline at end of file
</j:jelly>
war/src/main/webapp/help/project-config/custom-workspace.html
浏览文件 @
e65f893b
...
...
@@ -6,11 +6,10 @@
<p>
Once such situation is where paths are hard-coded and the code needs to be built on a specific location.
(and you can find one such discussion
<a
href=
"http://www.nabble.com/Customize-Workspace-directory-tt17194310.html"
>
here
</a>
.)
While there's no doubt that such a build is not ideal, this option allows you to get going in such a situation.
<p>
Another situation where this is useful is when you are using the
free-style
project type not to perform
Another situation where this is useful is when you are using the project type not to perform
a software build, but execution of a certain batch task, perhaps as a cron replacement. In such case,
you can use this option to map the relevant directory as the workspace, so that people can look at files
through the Jenkins web UI, and you can kick relevant commands more easily.
...
...
war/src/main/webapp/help/project-config/custom-workspace_de.html
浏览文件 @
e65f893b
...
...
@@ -7,12 +7,11 @@
<p>
In einer solchen Situation verwenden Sie beispielsweise "festverdrahtete" Dateipfade und
der Code muß daher an einer bestimmten Stelle im Dateisystem gebaut werden
(
<a
href=
"http://www.nabble.com/Customize-Workspace-directory-tt17194310.html"
>
mehr dazu
</a>
).
der Code muß daher an einer bestimmten Stelle im Dateisystem gebaut werden.
Zweifellos ist dies kein Idealfall eines Builds, aber diese Option erlaubt es Ihnen,
auch in einer solchen Situation weiterzukommmen.
<p>
In einer anderen Situation verwenden Sie ein
"Free-Style"-
Projekt nicht um einen
In einer anderen Situation verwenden Sie ein Projekt nicht um einen
Software-Build auszuführen, sondern um eine Batch-Aufgabe auszuführen, z.B. als Cron-Ersatz.
In diesem Fall können Sie diese Option verwenden, um ein relevantes Verzeichnis als
Arbeitsverzeichnis einzustellen, so daß Anwender Dateien in diesem Verzeichnis über
...
...
war/src/main/webapp/help/project-config/custom-workspace_fr.html
浏览文件 @
e65f893b
...
...
@@ -7,8 +7,7 @@
<p>
Un exemple d'une telle situation est quand les chemins sont codés en dur et que le code a besoin
d'être construit à partir d'un emplacement spécifique (voir la discussion
<a
href=
"http://www.nabble.com/Customize-Workspace-directory-tt17194310.html"
>
ici
</a>
).
d'être construit à partir d'un emplacement spécifique.
Il est certain qu'une telle configuration de build est déconseillée, mais cette option vous
permet néanmoins d'avencer dans ces circonstances.
...
...
war/src/main/webapp/help/project-config/custom-workspace_tr.html
浏览文件 @
e65f893b
...
...
@@ -6,11 +6,10 @@
<p>
Once such situation is where paths are hard-coded and the code needs to be built on a specific location.
(and you can find one such discussion
<a
href=
"http://www.nabble.com/Customize-Workspace-directory-tt17194310.html"
>
here
</a>
.)
While there's no doubt that such a build is not ideal, this option allows you to get going in such a situation.
<p>
Another situation where this is useful is when you are using the
free-style
project type not to perform
Another situation where this is useful is when you are using the project type not to perform
a software build, but execution of a certain batch task, perhaps as a cron replacement. In such case,
you can use this option to map the relevant directory as the workspace, so that people can look at files
through the Jenkins web UI, and you can kick relevant commands more easily.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录