diff --git a/orca-echo/src/main/groovy/com/netflix/spinnaker/orca/echo/config/EchoConfiguration.groovy b/orca-echo/src/main/groovy/com/netflix/spinnaker/orca/echo/config/EchoConfiguration.groovy index 7fb6547a2a..68972e8b20 100644 --- a/orca-echo/src/main/groovy/com/netflix/spinnaker/orca/echo/config/EchoConfiguration.groovy +++ b/orca-echo/src/main/groovy/com/netflix/spinnaker/orca/echo/config/EchoConfiguration.groovy @@ -16,6 +16,7 @@ package com.netflix.spinnaker.orca.echo.config +import com.fasterxml.jackson.databind.ObjectMapper import com.netflix.spinnaker.orca.front50.Front50Service import groovy.transform.CompileStatic import com.netflix.spinnaker.orca.echo.EchoService @@ -45,6 +46,7 @@ class EchoConfiguration { @Autowired RetrofitClient retrofitClient @Autowired RestAdapter.LogLevel retrofitLogLevel + @Autowired ObjectMapper objectMapper @Bean Endpoint echoEndpoint( @@ -71,7 +73,8 @@ class EchoConfiguration { @Bean EchoNotifyingExecutionListener echoNotifyingPipelineExecutionListener(EchoService echoService, - Front50Service front50Service) { - new EchoNotifyingExecutionListener(echoService, front50Service) + Front50Service front50Service, + ObjectMapper objectMapper) { + new EchoNotifyingExecutionListener(echoService, front50Service, objectMapper) } } diff --git a/orca-echo/src/main/groovy/com/netflix/spinnaker/orca/echo/spring/EchoNotifyingExecutionListener.groovy b/orca-echo/src/main/groovy/com/netflix/spinnaker/orca/echo/spring/EchoNotifyingExecutionListener.groovy index 28c86b3493..59666e60f5 100644 --- a/orca-echo/src/main/groovy/com/netflix/spinnaker/orca/echo/spring/EchoNotifyingExecutionListener.groovy +++ b/orca-echo/src/main/groovy/com/netflix/spinnaker/orca/echo/spring/EchoNotifyingExecutionListener.groovy @@ -1,8 +1,10 @@ package com.netflix.spinnaker.orca.echo.spring +import com.fasterxml.jackson.databind.ObjectMapper import com.netflix.spinnaker.orca.front50.Front50Service import com.netflix.spinnaker.orca.front50.model.ApplicationNotifications +import com.netflix.spinnaker.orca.pipeline.util.ContextParameterProcessor import groovy.transform.CompileStatic import groovy.util.logging.Slf4j import com.netflix.spinnaker.orca.ExecutionStatus @@ -20,9 +22,12 @@ class EchoNotifyingExecutionListener implements ExecutionListener { private final Front50Service front50Service - EchoNotifyingExecutionListener(EchoService echoService, Front50Service front50Service) { + private final ObjectMapper objectMapper + + EchoNotifyingExecutionListener(EchoService echoService, Front50Service front50Service, ObjectMapper objectMapper) { this.echoService = echoService this.front50Service = front50Service + this.objectMapper = objectMapper } @Override @@ -89,6 +94,9 @@ class EchoNotifyingExecutionListener implements ExecutionListener { if (notifications) { notifications.getPipelineNotifications().each { appNotification -> + Map executionMap = objectMapper.convertValue(pipeline, Map) + + appNotification = ContextParameterProcessor.process(appNotification, executionMap, false) Map targetMatch = pipeline.notifications.find { pipelineNotification -> pipelineNotification.address == appNotification.address && pipelineNotification.type == appNotification.type diff --git a/orca-echo/src/test/groovy/com/netflix/spinnaker/orca/echo/spring/EchoEventIntegrationSpec.groovy b/orca-echo/src/test/groovy/com/netflix/spinnaker/orca/echo/spring/EchoEventIntegrationSpec.groovy index a5192805df..5b5a926fdb 100644 --- a/orca-echo/src/test/groovy/com/netflix/spinnaker/orca/echo/spring/EchoEventIntegrationSpec.groovy +++ b/orca-echo/src/test/groovy/com/netflix/spinnaker/orca/echo/spring/EchoEventIntegrationSpec.groovy @@ -16,6 +16,7 @@ package com.netflix.spinnaker.orca.echo.spring +import com.fasterxml.jackson.databind.ObjectMapper import com.netflix.spinnaker.orca.TaskResult import com.netflix.spinnaker.orca.batch.SpringBatchExecutionRunner import com.netflix.spinnaker.orca.batch.TaskTaskletAdapterImpl @@ -196,7 +197,7 @@ abstract class EchoEventIntegrationSpec extends Speci @Bean EchoNotifyingExecutionListener echoNotifyingExecutionListener(EchoService echoService, Front50Service front50Service) { - new EchoNotifyingExecutionListener(echoService, front50Service) + new EchoNotifyingExecutionListener(echoService, front50Service, new ObjectMapper()) } @Bean diff --git a/orca-echo/src/test/groovy/com/netflix/spinnaker/orca/echo/spring/EchoNotifyingExecutionListenerSpec.groovy b/orca-echo/src/test/groovy/com/netflix/spinnaker/orca/echo/spring/EchoNotifyingExecutionListenerSpec.groovy index 09d437d425..1108bfc776 100644 --- a/orca-echo/src/test/groovy/com/netflix/spinnaker/orca/echo/spring/EchoNotifyingExecutionListenerSpec.groovy +++ b/orca-echo/src/test/groovy/com/netflix/spinnaker/orca/echo/spring/EchoNotifyingExecutionListenerSpec.groovy @@ -16,6 +16,7 @@ package com.netflix.spinnaker.orca.echo.spring +import com.fasterxml.jackson.databind.ObjectMapper import com.netflix.spinnaker.orca.ExecutionStatus import com.netflix.spinnaker.orca.echo.EchoService import com.netflix.spinnaker.orca.front50.Front50Service @@ -30,9 +31,10 @@ class EchoNotifyingExecutionListenerSpec extends Specification { def echoService = Mock(EchoService) def front50Service = Mock(Front50Service) + def objectMapper = new ObjectMapper() @Subject - def echoListener = new EchoNotifyingExecutionListener(echoService, front50Service) + def echoListener = new EchoNotifyingExecutionListener(echoService, front50Service, objectMapper) @Shared ApplicationNotifications notifications = new ApplicationNotifications()