提交 61a83bd6 编写于 作者: K Kohsuke Kawaguchi

[FIXED JENKINS-12251]

Introduced ${ITEM_FULL_NAME} to address the ticket without causing the
backward compatibility problem.
上级 f440a540
......@@ -55,6 +55,10 @@ Upcoming changes</a>
<!-- Record your changes in the trunk here. -->
<div id="trunk" style="display:none"><!--=TRUNK-BEGIN=-->
<ul class=image>
<li class=bug>
${ITEM_FULLNAME} variable was not working for Maven projects on Windows,
so introduced ${ITEM_FULL_NAME} instead.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-12251">issue 12251</a>)
<li class=bug>
Lock contention issue in build history view.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-16831">issue 16831</a>)
......
......@@ -1933,7 +1933,8 @@ public class Jenkins extends AbstractCIBase implements ModifiableTopLevelItemGro
return new File(Util.replaceMacro(base, ImmutableMap.of(
"JENKINS_HOME", getRootDir().getPath(),
"ITEM_ROOTDIR", item.getRootDir().getPath(),
"ITEM_FULLNAME", item.getFullName())));
"ITEM_FULLNAME", item.getFullName(), // legacy, deprecated
"ITEM_FULL_NAME", item.getFullName().replace(':','$')))); // safe, see JENKINS-12251
}
public String getRawWorkspaceDir() {
......
......@@ -5,11 +5,11 @@
<ul>
<li><tt>${JENKINS_HOME}</tt> &mdash; Jenkins home directory
<li><tt>${ITEM_ROOTDIR}</tt> &mdash; Root directory of a job for which the workspace is allocated.
<li><tt>${ITEM_FULLNAME}</tt> &mdash; '/'-separated job name, like "foo/bar".
<li><tt>${ITEM_FULL_NAME}</tt> &mdash; '/'-separated job name, like "foo/bar".
</ul>
<p>
Changing this value allows you to put build records on a bigger but slow disk,
while keeping JENKINS_HOME on highly available backed up drive, for example.
Default value is <tt>${ITEM_ROOTDIR}/builds</tt>.
</div>
\ No newline at end of file
</div>
......@@ -5,7 +5,7 @@
<ul>
<li><tt>${JENKINS_HOME}</tt> &mdash; Jenkinsのホームディレクトリ
<li><tt>${ITEM_ROOTDIR}</tt> &mdash; ワークスペースを配置するジョブのルートディレクトリ
<li><tt>${ITEM_FULLNAME}</tt> &mdash; "foo/bar"のように、'/'区切りのジョブ名
<li><tt>${ITEM_FULL_NAME}</tt> &mdash; "foo/bar"のように、'/'区切りのジョブ名
</ul>
<p>
......
......@@ -5,10 +5,10 @@
<ul>
<li><tt>${JENKINS_HOME}</tt> &mdash; Jenkins home directory
<li><tt>${ITEM_ROOTDIR}</tt> &mdash; Root directory of a job for which the workspace is allocated.
<li><tt>${ITEM_FULLNAME}</tt> &mdash; '/'-separated job name, like "foo/bar".
<li><tt>${ITEM_FULL_NAME}</tt> &mdash; '/'-separated job name, like "foo/bar".
</ul>
<p>
Changing this value allows you to put workspaces on SSD, SCSI, or even ram disks.
Default value is <tt>${ITEM_ROOTDIR}/workspace</tt>.
</div>
\ No newline at end of file
</div>
......@@ -5,10 +5,10 @@
<ul>
<li><tt>${JENKINS_HOME}</tt> &mdash; Jenkinsのホームディレクトリ
<li><tt>${ITEM_ROOTDIR}</tt> &mdash; ワークスペースを配置するジョブのルートディレクトリ
<li><tt>${ITEM_FULLNAME}</tt> &mdash; "foo/bar"のように、'/'区切りのジョブ名
<li><tt>${ITEM_FULL_NAME}</tt> &mdash; "foo/bar"のように、'/'区切りのジョブ名
</ul>
<p>
この値を変更することで、ワークスペースをSSD、SCSIあるいはRAMディスク上にワークスペースを配置することができます。
デフォルト値は、<tt>${ITEM_ROOTDIR}/workspace</tt>です。
</div>
\ No newline at end of file
</div>
......@@ -24,6 +24,9 @@
package jenkins.model;
import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;
import com.gargoylesoftware.htmlunit.html.HtmlForm;
import hudson.maven.MavenModuleSet;
import hudson.maven.MavenModuleSetBuild;
import hudson.model.InvisibleAction;
import hudson.model.RootAction;
import hudson.model.UnprotectedRootAction;
......@@ -35,6 +38,7 @@ import hudson.util.FormValidation;
import org.junit.Test;
import org.jvnet.hudson.test.Bug;
import org.jvnet.hudson.test.ExtractResourceSCM;
import org.jvnet.hudson.test.HudsonTestCase;
import org.jvnet.hudson.test.TestExtension;
import org.kohsuke.stapler.HttpResponse;
......@@ -174,6 +178,23 @@ public class JenkinsTest extends HudsonTestCase {
Assert.assertEquals(FormValidation.Kind.WARNING, v.kind);
}
@Bug(12251)
public void testItemFullNameExpansion() throws Exception {
HtmlForm f = createWebClient().goTo("/configure").getFormByName("config");
f.getInputByName("_.rawBuildsDir").setValueAttribute("${JENKINS_HOME}/test12251_builds/${ITEM_FULL_NAME}");
f.getInputByName("_.rawWorkspaceDir").setValueAttribute("${JENKINS_HOME}/test12251_ws/${ITEM_FULL_NAME}");
submit(f);
// build a dummy project
MavenModuleSet m = createMavenProject();
m.setScm(new ExtractResourceSCM(getClass().getResource("/simple-projects.zip")));
MavenModuleSetBuild b = m.scheduleBuild2(0).get();
// make sure these changes are effective
assertTrue(b.getWorkspace().getRemote().contains("test12251_ws"));
assertTrue(b.getRootDir().toString().contains("test12251_builds"));
}
/**
* Makes sure access to "/foobar" for UnprotectedRootAction gets through.
*/
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册