From 768c2109ab2d5ddb98a1d521fb74b5e508a3ee07 Mon Sep 17 00:00:00 2001 From: Alan Quach Date: Tue, 9 Jul 2019 12:13:50 -0700 Subject: [PATCH] fix(executions): Correctly populate trigger when rerunning an execution (#7205) --- .../manualPipelineExecution.controller.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/scripts/modules/core/src/pipeline/manualExecution/manualPipelineExecution.controller.js b/app/scripts/modules/core/src/pipeline/manualExecution/manualPipelineExecution.controller.js index b1fd0ae500b..3088dcb521f 100644 --- a/app/scripts/modules/core/src/pipeline/manualExecution/manualPipelineExecution.controller.js +++ b/app/scripts/modules/core/src/pipeline/manualExecution/manualPipelineExecution.controller.js @@ -122,7 +122,18 @@ module.exports = angular // these on a subsequent run. trigger.artifacts = []; } - this.command.trigger = trigger || _.head(this.triggers); + if (trigger) { + // Find the pipeline.trigger that matches trigger (the trigger from the execution being re-run) + this.command.trigger = this.triggers.find(t => + Object.keys(t) + .filter(k => k !== 'description') + .every(k => t[k] === trigger[k]), + ); + // If we found a match, rehydrate it with everything from trigger, otherwise just default back to setting it to trigger + this.command.trigger = this.command.trigger ? Object.assign(this.command.trigger, trigger) : trigger; + } else { + this.command.trigger = _.head(this.triggers); + } }; const updatePipelinePlan = pipeline => {