fix(pipelines): More robust handling of missing cron trigger id's
* fix(pipelines): More robust handling of missing cron trigger id's
Needed because we sometimes generate the pipeline id outside Front50 (e.g. https://github.com/spinnaker/orca/pull/2754)
* Set an explicit flag in orca when we need to update cron trigger id's
@@ -108,12 +108,15 @@ class PipelineController {
pipeline.name = pipeline.getName().trim()
pipeline = ensureCronTriggersHaveIdentifier(pipeline)
- if (!pipeline.id) {
+ if (!pipeline.id || pipeline.regenerateCronTriggerIds) {
// ensure that cron triggers are assigned a unique identifier for new pipelines
def triggers = (pipeline.triggers ?: []) as List<Map>
triggers.findAll { it.type == "cron" }.each { Map trigger ->
trigger.id = UUID.randomUUID().toString()
}
+ if (pipeline.regenerateCronTriggerIds) {
+ pipeline.remove("regenerateCronTriggerIds")
+ }
}
return pipelineDAO.create(pipeline.id as String, pipeline)
