Skip to content

Commit

Permalink
fix(dryrun): remove pipeline config it for dry runs
Browse files Browse the repository at this point in the history
  • Loading branch information
robfletcher committed Oct 19, 2017
1 parent e2990b8 commit 45ddb81
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,15 @@
package com.netflix.spinnaker.config

import com.netflix.spinnaker.orca.dryrun.DryRunStage
import com.netflix.spinnaker.orca.listeners.ExecutionListener
import com.netflix.spinnaker.orca.listeners.Persister
import com.netflix.spinnaker.orca.pipeline.DefaultStageDefinitionBuilderFactory
import com.netflix.spinnaker.orca.pipeline.StageDefinitionBuilder
import com.netflix.spinnaker.orca.pipeline.StageDefinitionBuilderFactory
import com.netflix.spinnaker.orca.pipeline.model.Execution
import com.netflix.spinnaker.orca.pipeline.model.Pipeline
import com.netflix.spinnaker.orca.pipeline.model.Stage
import com.netflix.spinnaker.orca.pipeline.persistence.ExecutionRepository
import org.slf4j.LoggerFactory
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
import org.springframework.boot.context.properties.EnableConfigurationProperties
Expand Down Expand Up @@ -53,5 +57,15 @@ open class DryRunConfiguration {
}
}

@Bean
open fun dryRunPipelineInitializer(repository: ExecutionRepository) = object : ExecutionListener {
override fun beforeExecution(persister: Persister, execution: Execution<out Execution<*>>) {
if (execution is Pipeline && execution.trigger["type"] == "dryrun") {
execution.pipelineConfigId = null
repository.store(execution)
}
}
}

private val log = LoggerFactory.getLogger(javaClass)
}

0 comments on commit 45ddb81

Please sign in to comment.