I forked the perforce-pluigin repo and I believe the changes required are
straight forward. I'm not currently set up to build / test Jenkins plugins
(I'll look into this when I have time). Should I submit a ticket for this
request?
Here are the changes I'm proposing:
old new ... ... @@ -1715,7 +1715,7 @@ public class PerforceSCM extends SCM {
1715 1715 String p4Client = this.p4Client;
1716 1716 p4Client =
MacroStringHelper.substituteParameters(p4Client, build, env);
1717 1717 try {
1718 - p4Client = getEffectiveClientName(p4Client, buildNode);
1718 + p4Client = getEffectiveClientName(p4Client, buildNode,
env);
1719 1719 } catch (Exception e) {
1720 1720 new
StreamTaskListener(System.out).getLogger().println(
1721 1721 "Could not get effective client name: " +
e.getMessage());
... ... @@ -1726,10 +1726,11 @@ public class PerforceSCM extends SCM {
1726 1726 private String getDefaultEffectiveClientName(AbstractProject
project, Node buildNode, FilePath workspace)
1727 1727 throws IOException, InterruptedException {
1728 1728 String basename =
MacroStringHelper.substituteParametersNoCheck(this.p4Client,
getDefaultSubstitutions(project));
1729 - return getEffectiveClientName(basename, buildNode);
1729 + Map<String,String> emptyEnv = new Hashtable<String,String>();
1730 + return getEffectiveClientName(basename, buildNode, emptyEnv);
1730 1731 }
1731 1732
1732 - private String getEffectiveClientName(String basename, Node
buildNode)
1733 + private String getEffectiveClientName(String basename, Node
buildNode, Map<String,String> env)
1733 1734 throws IOException, InterruptedException {
1734 1735
1735 1736 String p4Client = basename;
... ... @@ -1757,6 +1758,7 @@ public class PerforceSCM extends SCM {
1757 1758 substitutions.put("hostname", host);
1758 1759 substitutions.put("hash", hash);
1759 1760 substitutions.put("basename", basename);
1761 + substitutions.putAll(env);
1760 1762
1761 1763 p4Client =
MacroStringHelper.substituteParametersNoCheck(getSlaveClientNameFormat(),
substitutions);
1762 1764 }
On Wednesday, 30 April 2014 15:43:44 UTC-7, Stuart Rowe wrote:
>
> Our builds are typically parameterized with a "branch" to build against.
> The client specs used by our nodes are already using a <nodename>_<branch>
> naming convention. I would like to use this format for the slave client
> names in the peforce plugin.
>
> The only supported tokens are:
>
> ${basename} - The client name as configured in the above section
> ${hostname} - The hostname of the slave
> ${nodename} - The name of the slave in the CI server. Use this with
> caution.
> ${hash} - The hash code of the slave name
>
>
> Because of this limitation, our underlying builds handle syncing, but I
> would really like to start using the perforce plugin to take advantage of
> the Jenkins features related to SCM.
>
> Would it be difficult to support additional tokens in this field? Or is
> this task relatively easy for someone without any Jenkins plugin
> development experience?
>
> Thanks,
> Stuart
>
>
>
--
You received this message because you are subscribed to the Google Groups
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.