Skip to content

Commit

Permalink
feat(pipeline_templates): Display "Force Rebake" checkbox for MPT
Browse files Browse the repository at this point in the history
When manually executing templated pipelines, the "Force Rebake" checkbox is missing, even though the pipeline contains a bake stage. Templated pipelines do not contain any stages before runtime, so the bake stage is never asked to inject its custom logic into the manual execution modal.
This is a simple 90/10-solution that just iterates through previous executions, finds the previous execution that actually ran, and naïvely copies the stages to the pipeline, so that the bake stage magic is executed. It might result in false positives and negatives if you are changing the pipeline template, but as the main structure of a pipeline rarely changes and the fact that there are no bad consequences of displaying a force rebake checkbox when there is no bake stage, I think this is good enough.
  • Loading branch information
jervi committed Oct 23, 2018
1 parent 4652ab9 commit 18361b1
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,13 @@ module.exports = angular
const pipeline = this.command.pipeline,
executions = application.executions.data || [];

if (pipeline.type === 'templatedPipeline' && executions.length > 0) {
const previousSuccessfulExecution = executions.find(e => e.stages.length > 0);
if (previousSuccessfulExecution) {
pipeline.stages = previousSuccessfulExecution.stages;
}
}

pipelineNotifications = pipeline.notifications || [];
synchronizeNotifications();

Expand Down

0 comments on commit 18361b1

Please sign in to comment.