Skip to content

Commit

Permalink
Use putAll to set envs
Browse files Browse the repository at this point in the history
  • Loading branch information
apoorvam committed Jul 4, 2019
1 parent bade57f commit 8807743
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,20 @@ public class DunnerTaskFileCreator {

public static final String taskFileDir = "gocd_dunner";
private DunnerTaskFile task;
private HashMap<String, String> envs = new HashMap<String, String>();
private Map<String, String> envs = new HashMap<String, String>();
private String pwd = "";

public DunnerTaskFileCreator(Config taskConfig, Context context) {
String[] taskCommands = clean(taskConfig.getCommands());
String[] taskMounts = clean(taskConfig.getMounts());
String[] taskEnvs = clean(taskConfig.getEnvs());
pwd = context.getWorkingDir();
envs = (HashMap<String, String>)context.getEnvironmentVariables();
Map goEnvs = context.getEnvironmentVariables();
if (goEnvs != null) {
envs = new HashMap<String, String>() {{
putAll(goEnvs);
}};
}
this.task = new DunnerTaskFile(taskConfig.getName(), taskConfig.getImage(), taskCommands, taskMounts, taskEnvs);
}

Expand Down

0 comments on commit 8807743

Please sign in to comment.