Skip to content

Commit

Permalink
fix(dryrun): log dry run activity
Browse files Browse the repository at this point in the history
  • Loading branch information
robfletcher committed Oct 17, 2017
1 parent 79f1f73 commit 19635f5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,24 @@ import com.netflix.spinnaker.orca.pipeline.StageDefinitionBuilder
import com.netflix.spinnaker.orca.pipeline.StageDefinitionBuilderFactory
import com.netflix.spinnaker.orca.pipeline.model.Pipeline
import com.netflix.spinnaker.orca.pipeline.model.Stage
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression
import org.slf4j.LoggerFactory
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.ComponentScan
import org.springframework.context.annotation.Configuration

@Configuration
@ConditionalOnExpression("\${dryrun.enabled:true}")
@ConditionalOnProperty("dryrun.enabled")
@ComponentScan("com.netflix.spinnaker.orca.dryrun")
@EnableConfigurationProperties(DryRunProperties::class)
open class DryRunConfiguration {
@Bean
open fun dryRunStageDefinitionBuilderFactory(
stageDefinitionBuilders: Collection<StageDefinitionBuilder>
): StageDefinitionBuilderFactory =
object : DefaultStageDefinitionBuilderFactory(stageDefinitionBuilders) {
): StageDefinitionBuilderFactory {
log.info("Dry run trigger support enabled")
return object : DefaultStageDefinitionBuilderFactory(stageDefinitionBuilders) {
override fun builderFor(stage: Stage<*>): StageDefinitionBuilder =
stage.getExecution().let { execution ->
super.builderFor(stage).let {
Expand All @@ -49,4 +51,7 @@ open class DryRunConfiguration {
}
}
}
}

private val log = LoggerFactory.getLogger(javaClass)
}
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ class EchoNotifyingExecutionListener implements ExecutionListener {
@CompileDynamic
private void addDryRunNotifications(Pipeline pipeline) {
if (pipeline.pipelineConfigId in dryRunPipelineIds) {
log.info("Sending dry run notification for $pipeline.application $pipeline.name")
pipeline.notifications << [type: "dryrun"]
}
}
Expand Down

0 comments on commit 19635f5

Please sign in to comment.