-
Notifications
You must be signed in to change notification settings - Fork 900
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(pipeline_templates): Display "Force Rebake" checkbox for MPT #5854
feat(pipeline_templates): Display "Force Rebake" checkbox for MPT #5854
Conversation
@spinnaker/reviewers PTAL |
18361b1
to
01b7af0
Compare
I'm not sure I'm comfortable with this, but I don't know MPT well enough to offer a better suggestion |
It's awkward for sure, but is the pattern we've gone with on the backend as well for outlier behaviors in MPT. |
) { | ||
const previousSuccessfulExecution = executions.find(e => e.stages.length > 0); | ||
if (previousSuccessfulExecution) { | ||
pipeline.stages = previousSuccessfulExecution.stages; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you plan the pipeline here instead? Just a thought.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
075dcb0
to
35b528c
Compare
@@ -109,6 +110,21 @@ module.exports = angular | |||
this.command.trigger = suppliedTriggerCanBeInvoked ? trigger : _.head(this.triggers); | |||
}; | |||
|
|||
const updatePipelinePlan = pipeline => { | |||
if (pipeline.type === 'templatedPipeline' && (pipeline.stages === undefined || pipeline.stages.length === 0)) { | |||
PipelineTemplateReader.getPipelinePlan(pipeline) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getPipelinePlan
takes an optional second parameter executionId
. Ideally I should've used the build selected in the build drop down if available, but that turned out to be a rabbit hole. The builds in that list only have the CI build number, not the executionId
. The executions
variable only have a few executions for each pipeline (depending on the number of pipelines being displayed). And since the dropdown is a react component, I have to use a $watch expression to detect when it changes.
So the current implementation will only consider the newest version of the pipeline when deciding wether to show the force rebake box or not. But I think this is Good Enough™, for the same reasons mentioned earlier. It's certainly better than never showing it.
Take 2! It's not perfect, but it's better. I have implemented the plan suggestion from @danielpeach, which is of course the way it should have been done. The implementation is still a bit naïve, but I don't think it's worth it to put a lot more effort into this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
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.
35b528c
to
27060e9
Compare
57b1e49 chore(core/presentation): Update formik from 0.11.11 to 1.3.1 (spinnaker#5917) c0842ad fix(provider/cf): fetch services on a per-region basis f22fecd feat(core/presentation): Introduce Validation class for reusable validation fns. (spinnaker#5913) 9eacd0c chore(core/pipeline): Cleaning up imports (spinnaker#5914) b08bab2 refactor(core/projects): Simplify TrashButton click handler 1abc6ba refactor(core): Remove invalid <g> from HoverablePopover (spinnaker#5904) 8523bbd test(core/cluster): fix lint error unused variable (spinnaker#5910) cc68c9c feat(core): Support a date constraint on trigger parameters (spinnaker#5907) 9488e33 feat(pipeline_templates): Display "Force Rebake" checkbox for MPT (spinnaker#5854)
57b1e49 chore(core/presentation): Update formik from 0.11.11 to 1.3.1 (#5917) c0842ad fix(provider/cf): fetch services on a per-region basis f22fecd feat(core/presentation): Introduce Validation class for reusable validation fns. (#5913) 9eacd0c chore(core/pipeline): Cleaning up imports (#5914) b08bab2 refactor(core/projects): Simplify TrashButton click handler 1abc6ba refactor(core): Remove invalid <g> from HoverablePopover (#5904) 8523bbd test(core/cluster): fix lint error unused variable (#5910) cc68c9c feat(core): Support a date constraint on trigger parameters (#5907) 9488e33 feat(pipeline_templates): Display "Force Rebake" checkbox for MPT (#5854)
…innaker#5854) * feat(pipeline_templates): Display "Force Rebake" checkbox for MPT 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 plans a new execution and adds the stages to the pipeline, so that the bake stage magic is executed. It might result in false positives or 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.
57b1e49 chore(core/presentation): Update formik from 0.11.11 to 1.3.1 (spinnaker#5917) c0842ad fix(provider/cf): fetch services on a per-region basis f22fecd feat(core/presentation): Introduce Validation class for reusable validation fns. (spinnaker#5913) 9eacd0c chore(core/pipeline): Cleaning up imports (spinnaker#5914) b08bab2 refactor(core/projects): Simplify TrashButton click handler 1abc6ba refactor(core): Remove invalid <g> from HoverablePopover (spinnaker#5904) 8523bbd test(core/cluster): fix lint error unused variable (spinnaker#5910) cc68c9c feat(core): Support a date constraint on trigger parameters (spinnaker#5907) 9488e33 feat(pipeline_templates): Display "Force Rebake" checkbox for MPT (spinnaker#5854)
This fix was first introduced in spinnaker#5854, but went MIA when the manual execution modal was converted to React.
spinnaker#7558) This fix was first introduced in spinnaker#5854, but went MIA when the manual execution modal was converted to React.
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 theplans a new execution and adds the stages to the pipeline, so that the bake stage magic is executed.It might result in false positives or 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.