Skip to content

Commit

Permalink
[FIXED JENKINS-23599] - Substitute Matrix Axis values in PerforceSCM
Browse files Browse the repository at this point in the history
Behavior:
* MatrixConfiguration: Inject Values
* MatrixProject: Inject the first value or empty string if it is not available

Signed-off-by: Oleg Nenashev <o.v.nenashev@gmail.com>
  • Loading branch information
oleg-nenashev committed Jun 27, 2014
1 parent bd0d0cf commit a35f1fe
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/main/java/hudson/plugins/perforce/utils/MacroStringHelper.java
Expand Up @@ -25,6 +25,9 @@
package hudson.plugins.perforce.utils;

import hudson.EnvVars;
import hudson.matrix.Axis;
import hudson.matrix.MatrixConfiguration;
import hudson.matrix.MatrixProject;
import hudson.model.AbstractBuild;
import hudson.model.AbstractProject;
import hudson.model.Hudson;
Expand All @@ -39,6 +42,7 @@
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.TreeMap;
import java.util.logging.Level;
import java.util.logging.Logger;
Expand Down Expand Up @@ -377,5 +381,17 @@ private static void getDefaultSubstitutions(
}
}
}

// Handle Matrix Axes
if (project instanceof MatrixConfiguration) {
MatrixConfiguration matrixConfiguration = (MatrixConfiguration) project;
subst.putAll(matrixConfiguration.getCombination());
}
if (project instanceof MatrixProject) {
MatrixProject matrixProject = (MatrixProject) project;
for (Axis axis : matrixProject.getAxes()) {
subst.put(axis.name, axis.size() >0 ? axis.value(0) : "");
}
}
}
}

0 comments on commit a35f1fe

Please sign in to comment.