So this as of commit 2da2bf91851f3593a56c7d4a9408ec15e5d8aa79 as far as I can tell
During SCM checkout, when getting the perforce workspace, the first step is to get the effective client name.
1) Try to get the effective client name using the current project and build node (see call stack below)
hudson.plugins.perforce.PerforceSCM.getEffectiveClientName(PerforceSCM.java:1702)
hudson.plugins.perforce.PerforceSCM.getPerforceWorkspace(PerforceSCM.java:1581)
hudson.plugins.perforce.PerforceSCM.getPerforceWorkspace(PerforceSCM.java:1569)
hudson.plugins.perforce.PerforceSCM.checkout(PerforceSCM.java:867)
hudson.model.AbstractProject.checkout(AbstractProject.java:1024)
hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:479)
hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:411)
hudson.model.Run.run(Run.java:1198)
hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
hudson.model.ResourceController.execute(ResourceController.java:88)
hudson.model.Executor.run(Executor.java:122)
Digging deeper, if on a remote build node, then substitute tokens in the slave client name format. The problem is that the parameter maps being used for substitution don't include the current build's parameters. The substitution map is gathering entries from a number of default sources, including a set of default substitutions for the project:
hudson.plugins.perforce.utils.MacroStringHelper.getDefaultSubstitutions(MacroStringHelper.java:369)
hudson.plugins.perforce.utils.MacroStringHelper.substituteParametersNoCheck(MacroStringHelper.java:244)
hudson.plugins.perforce.utils.MacroStringHelper.substituteParameters(MacroStringHelper.java:110)
hudson.plugins.perforce.PerforceSCM.getEffectiveClientName(PerforceSCM.java:1735)
hudson.plugins.perforce.PerforceSCM.getEffectiveClientName(PerforceSCM.java:1702)
hudson.plugins.perforce.PerforceSCM.getPerforceWorkspace(PerforceSCM.java:1581)
hudson.plugins.perforce.PerforceSCM.getPerforceWorkspace(PerforceSCM.java:1569)
hudson.plugins.perforce.PerforceSCM.checkout(PerforceSCM.java:867)
hudson.model.AbstractProject.checkout(AbstractProject.java:1024)
hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:479)
hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:411)
hudson.model.Run.run(Run.java:1198)
hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
hudson.model.ResourceController.execute(ResourceController.java:88)
hudson.model.Executor.run(Executor.java:122)
At this point, if the slave client name format contains a token referencing a build parameter, it will be substituted by the default value of that parameter. (e.g. my_node_name_${paramA} --> my_node_name_defaultValue, as I described above in the issue). The token is now replaced and can't be substituted correctly if the build provides a different value for that parameter.
2) Finally attempt to substitute any remaining tokens using the build and current environment map. For the example I described, there's no tokens left to replace and the substitution returns:
hudson.plugins.perforce.utils.MacroStringHelper.substituteParametersNoCheck(MacroStringHelper.java:266)
hudson.plugins.perforce.utils.MacroStringHelper.substituteParameters(MacroStringHelper.java:148)
hudson.plugins.perforce.PerforceSCM.getEffectiveClientName(PerforceSCM.java:1707)
hudson.plugins.perforce.PerforceSCM.getPerforceWorkspace(PerforceSCM.java:1581)
hudson.plugins.perforce.PerforceSCM.getPerforceWorkspace(PerforceSCM.java:1569)
hudson.plugins.perforce.PerforceSCM.checkout(PerforceSCM.java:867)
hudson.model.AbstractProject.checkout(AbstractProject.java:1024)
hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:479)
hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:411)
hudson.model.Run.run(Run.java:1198)
hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
hudson.model.ResourceController.execute(ResourceController.java:88)
hudson.model.Executor.run(Executor.java:122)
Can you please explain this statement? Other parameter substitutions work fine, and use the exact same process for performing replacements.