Skip to content
This repository has been archived by the owner on Dec 21, 2022. It is now read-only.

Commit

Permalink
JENKINS-37752: Release profile appending is buggy
Browse files Browse the repository at this point in the history
fixed profile appending so that the parameter is appended only once
  • Loading branch information
shillner committed Aug 29, 2016
1 parent 300bb9b commit ca5c797
Showing 1 changed file with 7 additions and 10 deletions.
Expand Up @@ -20,6 +20,7 @@
import com.cloudbees.plugins.credentials.common.StandardUsernameCredentials;
import com.cloudbees.plugins.credentials.common.StandardUsernamePasswordCredentials;
import com.cloudbees.plugins.credentials.domains.URIRequirementBuilder;
import com.google.common.base.Joiner;
import com.google.common.base.Splitter;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
Expand Down Expand Up @@ -101,18 +102,14 @@ public void buildEnvVars(Map<String, String> env) {
// appends the profiles to the Maven call
if (StringUtils.isNotBlank(getProfiles())) {
Iterable<String> split = Splitter.on(',').split(getProfiles());
boolean isFirst = true;
List<String> profiles = Lists.newArrayList();
for (String profile : split) {
if (StringUtils.isBlank(profile)) {
continue;
if (StringUtils.isNotBlank(profile)) {
profiles.add(profile.trim());
}

if (isFirst) {
command.append(" -Dunleash.profiles=");
} else {
command.append(',');
}
command.append(profile.trim());
}
if (profiles.size() > 0) {
command.append(" -Dunleash.profiles=").append(Joiner.on(',').join(profiles));
}
}

Expand Down

0 comments on commit ca5c797

Please sign in to comment.