Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Allow the job name to do variable interpolation

  • Loading branch information...
commit 91b896373757803e82eaf4818d46a3b62fba8efc 1 parent c9c2960
@jzaefferer jzaefferer authored
View
7 src/main/java/com/appendto/hudson/testswarm/TestSwarmIntegrationBuilder.java
@@ -54,6 +54,7 @@
//job name
private String jobName;
+ private String jobNameCopy;
//user name
private String userName;
@@ -336,12 +337,16 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis
private void expandRuntimeVariables(BuildListener listener, AbstractBuild build) throws IOException, InterruptedException {
VariableResolver<String> varResolver = build.getBuildVariableResolver();
EnvVars env = build.getEnvironment(listener);
+ this.jobNameCopy = Util.replaceMacro(this.getJobName(), varResolver);
+ this.jobNameCopy = Util.replaceMacro(this.jobNameCopy, env);
this.testswarmServerUrlCopy = Util.replaceMacro(this.getTestswarmServerUrl(), varResolver);
this.testswarmServerUrlCopy = Util.replaceMacro(this.testswarmServerUrlCopy, env);
for (int i = testSuiteListCopy.length - 1; i >= 0; i--) {
//Ignore testcase if disbled
if(!testSuiteListCopy[i].isDisableTest()){
+ testSuiteListCopy[i].setTestName(Util.replaceMacro(testSuiteListCopy[i].getTestName(), varResolver));
+ testSuiteListCopy[i].setTestName(Util.replaceMacro(testSuiteListCopy[i].getTestName(), env));
testSuiteListCopy[i].setTestUrl(Util.replaceMacro(testSuiteListCopy[i].getTestUrl(), varResolver));
testSuiteListCopy[i].setTestUrl(Util.replaceMacro(testSuiteListCopy[i].getTestUrl(), env));
}
@@ -353,7 +358,7 @@ private void populateStaticDataInRequestString(StringBuffer requestStr) throws E
//Populate static data like user credentials and other properties
requestStr.append("client_id=").append(CLIENT_ID)
.append("&state=").append(STATE)
- .append("&job_name=").append(URLEncoder.encode(getJobName(), CHAR_ENCODING))
+ .append("&job_name=").append(URLEncoder.encode(this.jobNameCopy, CHAR_ENCODING))
.append("&user=").append(getUserName())
.append("&auth=").append(getAuthToken())
.append("&max=").append(getMaxRuns())
Please sign in to comment.
Something went wrong with that request. Please try again.