Skip to content

Commit

Permalink
fix(controller): fix multiple same env on console (#3014)
Browse files Browse the repository at this point in the history
  • Loading branch information
anda-ren authored Nov 22, 2023
1 parent 34d2018 commit 314934e
Showing 1 changed file with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,22 @@ private String rewriteSpecEnvForRequest(
if (null == env) {
env = new ArrayList<>();
}
env.addAll(envSupplier.get());
s.setEnv(env);
Map<String, String> envMap = env.stream().collect(Collectors.toMap(Env::getName, Env::getValue));
//if ENV vars in user's step spec conflicts with controller's, use controller's ENV
List<Env> controllerEnvs = envSupplier.get();
if (null != controllerEnvs) {
envMap.putAll(
controllerEnvs.stream()
.filter(e -> null != e.getValue())
.collect(Collectors.toMap(Env::getName, Env::getValue))
);
}
s.setEnv(
envMap.entrySet()
.stream()
.map(entry -> new Env(entry.getKey(), entry.getValue()))
.collect(Collectors.toList())
);
s.verifyStepSpecArgs();
}
stepSpecOverWrites = Constants.yamlMapper.writeValueAsString(steps);
Expand Down

0 comments on commit 314934e

Please sign in to comment.