Skip to content

Commit

Permalink
fix(MPT): Propagate notifications from pipeline config
Browse files Browse the repository at this point in the history
One can specify notification on the pipeline in deck (even if pipeline is templated)
However, those notifications are not respected because they don't end up in the
pipeline config. Copy them there so notifications work as expected.
  • Loading branch information
marchello2000 committed Feb 27, 2019
1 parent cd0f2ae commit 7bf131e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@

import com.fasterxml.jackson.annotation.JsonProperty;
import com.netflix.spinnaker.kork.artifacts.model.ExpectedArtifact;
import com.netflix.spinnaker.orca.pipelinetemplate.v1schema.model.NamedHashMap;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand All @@ -30,6 +32,7 @@ public class TemplatedPipelineRequest {
Map<String, Object> trigger = new HashMap<>();
Map<String, Object> config;
Map<String, Object> template;
List<NamedHashMap> notifications = new ArrayList<>();
String executionId;
Boolean plan = false;
boolean limitConcurrent = true;
Expand Down Expand Up @@ -92,6 +95,14 @@ public Map<String, Object> getTemplate() {
return template;
}

public void setNotifications(List<NamedHashMap> notifications) {
this.notifications = notifications;
}

public List<NamedHashMap> getNotifications() {
return notifications;
}

public void setTemplate(Map<String, Object> template) {
this.template = template;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class V1TemplateLoaderHandler(

override fun handle(chain: HandlerChain, context: PipelineTemplateContext) {
val config = objectMapper.convertValue(context.getRequest().config, TemplateConfiguration::class.java)
config.configuration.notifications.addAll(context.getRequest().notifications)

// Allow template inlining to perform plans without publishing the template
if (context.getRequest().plan && context.getRequest().template != null) {
Expand Down

0 comments on commit 7bf131e

Please sign in to comment.