Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
jenkins
提交
7fdb8a82
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,发现更多精彩内容 >>
提交
7fdb8a82
编写于
6月 29, 2011
作者:
A
Alex Earl
提交者:
Kohsuke Kawaguchi
7月 05, 2011
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[FIXED JENKINS-8446] Implementing via update to patch attached to JIRA item.
上级
c49e7501
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
83 addition
and
1 deletion
+83
-1
core/src/main/java/hudson/model/Job.java
core/src/main/java/hudson/model/Job.java
+29
-0
core/src/main/java/jenkins/model/Jenkins.java
core/src/main/java/jenkins/model/Jenkins.java
+54
-1
未找到文件。
core/src/main/java/hudson/model/Job.java
浏览文件 @
7fdb8a82
...
...
@@ -27,6 +27,7 @@ import static javax.servlet.http.HttpServletResponse.SC_BAD_REQUEST;
import
static
javax
.
servlet
.
http
.
HttpServletResponse
.
SC_NO_CONTENT
;
import
com.infradna.tool.bridge_method_injector.WithBridgeMethods
;
import
hudson.EnvVars
;
import
hudson.ExtensionPoint
;
import
hudson.PermalinkList
;
import
hudson.Extension
;
...
...
@@ -73,6 +74,9 @@ import java.util.Map;
import
java.util.SortedMap
;
import
java.util.LinkedList
;
import
javax.naming.Context
;
import
javax.naming.InitialContext
;
import
javax.naming.NamingException
;
import
javax.servlet.ServletException
;
import
jenkins.model.Jenkins
;
...
...
@@ -635,6 +639,31 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
* @see RunMap
*/
protected
File
getBuildDir
()
{
// check JNDI for the home directory first
try
{
InitialContext
iniCtxt
=
new
InitialContext
();
Context
env
=
(
Context
)
iniCtxt
.
lookup
(
"java:comp/env"
);
String
value
=
(
String
)
env
.
lookup
(
"JENKINS_BUILDS"
);
if
(
value
!=
null
&&
value
.
trim
().
length
()>
0
)
return
new
File
(
value
.
trim
());
// look at one more place. See issue #1314
value
=
(
String
)
iniCtxt
.
lookup
(
"JENKINS_BUILDS"
);
if
(
value
!=
null
&&
value
.
trim
().
length
()>
0
)
return
new
File
(
value
.
trim
()
+
"/"
+
getSearchName
());
}
catch
(
NamingException
e
)
{
// ignore
}
// finally check the system property
String
sysProp
=
System
.
getProperty
(
"JENKINS_BUILDS"
);
if
(
sysProp
!=
null
)
return
new
File
(
sysProp
.
trim
()
+
"/"
+
getSearchName
());
// look at the env var next
String
env
=
EnvVars
.
masterEnvVars
.
get
(
"JENKINS_BUILDS"
);
if
(
env
!=
null
)
return
new
File
(
env
.
trim
()
+
"/"
+
getSearchName
()).
getAbsoluteFile
();
return
new
File
(
getRootDir
(),
"builds"
);
}
...
...
core/src/main/java/jenkins/model/Jenkins.java
浏览文件 @
7fdb8a82
...
...
@@ -30,6 +30,7 @@ import com.thoughtworks.xstream.XStream;
import
hudson.BulkChange
;
import
hudson.DNSMultiCast
;
import
hudson.DescriptorExtensionList
;
import
hudson.EnvVars
;
import
hudson.Extension
;
import
hudson.ExtensionList
;
import
hudson.ExtensionPoint
;
...
...
@@ -175,6 +176,9 @@ import org.kohsuke.stapler.jelly.JellyRequestDispatcher;
import
org.xml.sax.InputSource
;
import
javax.crypto.SecretKey
;
import
javax.naming.Context
;
import
javax.naming.InitialContext
;
import
javax.naming.NamingException
;
import
javax.servlet.RequestDispatcher
;
import
javax.servlet.ServletContext
;
import
javax.servlet.ServletException
;
...
...
@@ -305,6 +309,11 @@ public class Jenkins extends AbstractCIBase implements ModifiableItemGroup<TopLe
*/
private
volatile
SecurityRealm
securityRealm
=
SecurityRealm
.
NO_AUTHENTICATION
;
/**
* Root directory for the workspaces.
*/
private
String
configuredWorkspaceRoot
=
null
;
/**
* Message displayed in the top page.
*/
...
...
@@ -1687,8 +1696,52 @@ public class Jenkins extends AbstractCIBase implements ModifiableItemGroup<TopLe
return
root
;
}
private
String
getConfiguredWorkspaceRoot
()
{
if
(
configuredWorkspaceRoot
==
null
)
{
try
{
InitialContext
iniCtxt
=
new
InitialContext
();
Context
env
=
(
Context
)
iniCtxt
.
lookup
(
"java:comp/env"
);
String
value
=
(
String
)
env
.
lookup
(
"JENKINS_WORKSPACES"
);
if
(
value
!=
null
&&
value
.
trim
().
length
()>
0
)
{
configuredWorkspaceRoot
=
value
.
trim
();
return
configuredWorkspaceRoot
;
}
// look at one more place. See issue #1314
value
=
(
String
)
iniCtxt
.
lookup
(
"JENKINS_WORKSPACES"
);
if
(
value
!=
null
&&
value
.
trim
().
length
()>
0
)
{
configuredWorkspaceRoot
=
value
.
trim
();
return
configuredWorkspaceRoot
;
}
}
catch
(
NamingException
e
)
{
// ignore
}
// finally check the system property
String
sysProp
=
System
.
getProperty
(
"JENKINS_WORKSPACES"
);
if
(
sysProp
!=
null
)
{
configuredWorkspaceRoot
=
sysProp
.
trim
();
return
configuredWorkspaceRoot
;
}
// look at the env var next
String
env
=
EnvVars
.
masterEnvVars
.
get
(
"JENKINS_WORKSPACES"
);
if
(
env
!=
null
)
{
configuredWorkspaceRoot
=
env
.
trim
();
return
configuredWorkspaceRoot
;
}
//not set
configuredWorkspaceRoot
=
""
;
}
return
configuredWorkspaceRoot
;
}
public
FilePath
getWorkspaceFor
(
TopLevelItem
item
)
{
return
new
FilePath
(
new
File
(
item
.
getRootDir
(),
WORKSPACE_DIRNAME
));
if
(
getConfiguredWorkspaceRoot
().
equals
(
""
))
{
return
new
FilePath
(
new
File
(
item
.
getRootDir
(),
WORKSPACE_DIRNAME
));
}
else
{
return
new
FilePath
(
new
File
(
getConfiguredWorkspaceRoot
()
+
"/"
+
item
.
getName
(),
WORKSPACE_DIRNAME
));
}
}
public
FilePath
getRootPath
()
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录