Index: src/main/java/hudson/plugins/clearcase/action/SnapshotCheckoutAction.java =================================================================== --- src/main/java/hudson/plugins/clearcase/action/SnapshotCheckoutAction.java (revision 30613) +++ src/main/java/hudson/plugins/clearcase/action/SnapshotCheckoutAction.java (working copy) @@ -88,4 +88,8 @@ return true; } + public ConfigSpec getConfigSpec() { + return configSpec; + } + } Index: src/main/java/hudson/plugins/clearcase/ClearCaseSCM.java =================================================================== --- src/main/java/hudson/plugins/clearcase/ClearCaseSCM.java (revision 30613) +++ src/main/java/hudson/plugins/clearcase/ClearCaseSCM.java (working copy) @@ -26,6 +26,7 @@ import static hudson.Util.fixEmpty; import static hudson.Util.fixEmptyAndTrim; +import hudson.Util; import hudson.model.AbstractBuild; import hudson.model.Hudson; import hudson.model.ModelObject; @@ -142,11 +143,12 @@ @Override protected CheckOutAction createCheckOutAction(VariableResolver variableResolver, ClearToolLauncher launcher, AbstractBuild build) { CheckOutAction action; + String effectiveConfigSpec = Util.replaceMacro(configSpec, variableResolver); if (isUseDynamicView()) { - action = new DynamicCheckoutAction(createClearTool(variableResolver, launcher), configSpec, doNotUpdateConfigSpec, useTimeRule, isCreateDynView(), + action = new DynamicCheckoutAction(createClearTool(variableResolver, launcher), effectiveConfigSpec, doNotUpdateConfigSpec, useTimeRule, isCreateDynView(), getNormalizedWinDynStorageDir(variableResolver), getNormalizedUnixDynStorageDir(variableResolver), build); } else { - action = new SnapshotCheckoutAction(createClearTool(variableResolver, launcher),new ConfigSpec(configSpec, launcher.getLauncher().isUnix()), getViewPaths(),isUseUpdate()); + action = new SnapshotCheckoutAction(createClearTool(variableResolver, launcher),new ConfigSpec(effectiveConfigSpec, launcher.getLauncher().isUnix()), getViewPaths(),isUseUpdate()); } return action; } Index: src/test/java/hudson/plugins/clearcase/ClearCaseSCMTest.java =================================================================== --- src/test/java/hudson/plugins/clearcase/ClearCaseSCMTest.java (revision 30768) +++ src/test/java/hudson/plugins/clearcase/ClearCaseSCMTest.java (working copy) @@ -34,6 +34,8 @@ import hudson.model.AbstractProject; import hudson.model.Build; import hudson.model.Computer; +import hudson.plugins.clearcase.action.DynamicCheckoutAction; +import hudson.plugins.clearcase.action.SnapshotCheckoutAction; import hudson.plugins.clearcase.base.BaseHistoryAction; import hudson.plugins.clearcase.util.BuildVariableResolver; import hudson.util.VariableResolver; @@ -226,9 +228,31 @@ true, "/view", null, false, false, false, null, null, false, false, cleartool, clearCaseScmDescriptor, computer); // Create actions - VariableResolver variableResolver = new BuildVariableResolver(build, scm.getCurrentComputer()); - + VariableResolver variableResolver = new BuildVariableResolver(build, scm.getCurrentComputer()); + BaseHistoryAction action = (BaseHistoryAction) scm.createHistoryAction(variableResolver, clearToolLauncher, build); assertEquals("The extended view path is incorrect", "/view/viewname-ClearCase/", action.getExtendedViewPath()); } + + @Test + public void assertConfigSpecCanUseVariables() throws Exception { + classContext.checking(new Expectations() { + { + allowing(build).getParent(); will(returnValue(project)); + one(project).getName(); will(returnValue("ClearCase")); + allowing(launcher).isUnix(); will(returnValue(true)); + } + }); + context.checking(new Expectations() { + { + allowing(clearToolLauncher).getLauncher(); will(returnValue(launcher)); + } + }); + ClearCaseSCM scm = new ClearCaseSCMDummy("branchone", "${JOB_NAME}", "viewname-${JOB_NAME}", true, "vob", false, "/view", null, false, false, false, + null, null, false, false, cleartool, clearCaseScmDescriptor, computer); + // Create actions + VariableResolver variableResolver = new BuildVariableResolver(build, scm.getCurrentComputer()); + SnapshotCheckoutAction action = (SnapshotCheckoutAction) scm.createCheckOutAction(variableResolver, clearToolLauncher, build); + assertEquals("Variables haven't been resolved in config spec", "ClearCase", action.getConfigSpec().getRaw()); + } }