Skip to content

Commit

Permalink
Post jobs should inherit parent environment variables (#1107)
Browse files Browse the repository at this point in the history
* Post jobs should inherit parent environment variables

Environment variables set to parent jobs can be useful for post job frames.

* Revert import * change
  • Loading branch information
DiegoTavares committed Apr 8, 2022
1 parent 6436623 commit c570483
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions cuebot/src/main/java/com/imageworks/spcue/service/JobSpec.java
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,12 @@ private BuildableJob handleJobTag(Element jobTag) {
job.priority = Integer.valueOf(jobTag.getChildTextTrim("priority"));
}


Element envTag = jobTag.getChild("env");
if (envTag != null) {
handleEnvironmentTag(envTag, buildableJob.env);
}

handleLayerTags(buildableJob, jobTag);

if (buildableJob.getBuildableLayers().size() > MAX_LAYERS) {
Expand All @@ -353,11 +359,6 @@ private BuildableJob handleJobTag(Element jobTag) {
+ " has no layers");
}

Element envTag = jobTag.getChild("env");
if (envTag != null) {
handleEnvironmentTag(envTag, buildableJob.env);
}

return buildableJob;
}

Expand Down Expand Up @@ -958,6 +959,11 @@ private BuildableJob initPostJob(BuildableJob parent) {
job.deptName = parent.detail.deptName;

BuildableJob postJob = new BuildableJob(job);

for (String key : parent.env.keySet()) {
postJob.env.put(key, parent.env.get(key));
}

return postJob;
}

Expand Down

0 comments on commit c570483

Please sign in to comment.