Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Job to aggregate can contain variable, expand it before use #72

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import hudson.model.AbstractBuild;
import hudson.model.AbstractProject;
import hudson.model.AutoCompletionCandidates;
import hudson.EnvVars;
import hudson.Extension;
import hudson.Launcher;
import hudson.Util;
Expand Down Expand Up @@ -95,9 +96,20 @@ public AggregatedTestResultPublisher(String jobs, boolean includeFailedBuilds) {

public boolean perform(AbstractBuild<?,?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
// add a TestResult just so that it can show up later.
build.addAction(new TestResultAction(jobs, includeFailedBuilds, build));
// Expand the jobs String as it can contain variable
String expandedJobs = this.getJobs(build.getEnvironment(listener));
build.addAction(new TestResultAction(expandedJobs, includeFailedBuilds, build));
return true;
}

/**
* Return the expanded job list
* @param env
* @return
*/
public String getJobs(EnvVars env) {
return (env != null ? env.expand(this.jobs) : this.jobs);
}

public BuildStepMonitor getRequiredMonitorService() {
return BuildStepMonitor.NONE;
Expand Down