Skip to content
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

fix(RRB): fix NPE introduced in https://github.com/spinnaker/orca/pull/3031 #3050

Merged
merged 2 commits into from
Jul 21, 2019

Conversation

marchello2000
Copy link
Contributor

When there is no source server group and a validation pipeline has been specified
RRB flow composition will fail (erroneously) trying to construct parameters to be
passed into the validation pipeline (even though the source isn't even necessary!).

This fix does two things:

  1. Correctly calculate parameters passed into the validation pipeline
  2. Don't even bother composing the flow if we are being called during the beforeStages
    since all these stages will be discared anyway (none of the stages have STAGE_BEFORE synthetic)

Medium term: all of this should just go away - we shouldn't be using aroundStages which is a
source of lots of confusion. I will be refactoring this code to take advantage of newer
beforeStages and afterStages

@@ -122,6 +114,14 @@ class RollingRedBlackStrategy implements Strategy, ApplicationContextAware {

Stage parentCreateServerGroupStage = stage.directAncestors().find() { it.type == CreateServerGroupStage.PIPELINE_CONFIG_TYPE }

if (parentCreateServerGroupStage.status == ExecutionStatus.NOT_STARTED) {
// No point in composing the flow if we are called to plan "beforeStages" since we don't have any STAGE_BEFOREs.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see an explicit connection between the condition being checked and being called to plan beforeStages, can you elaborate?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happens is:
DeployStrategyStage implemented aroundStages which calls our composeFlow
the DeployStrategyStage::aroundStages is called from StageDefinitionBuilder::beforeStages (java) which is called from StageDefinitionBuilder::buildBeforeStages (kotlin), which is called from RunStageHandler

When there is no source server group and a validation pipeline has been specified
RRB flow composition will fail (erroneously) trying to construct parameters to be
passed into the validation pipeline (even though the source isn't even necessary!).

This fix does two things:
1. Correctly calculate parameters passed into the validation pipeline
2. Don't even bother composing the flow if we are being called during the `beforeStages`
   since all these stages will be discared anyway (none of the stages have `STAGE_BEFORE` synthetic)

Medium term: all of this should just go away - we shouldn't be using `aroundStages` which is a
source of lots of confusion. I will be refactoring this code to take advantage of newer
`beforeStages` and `afterStages`
@marchello2000
Copy link
Contributor Author

@dreynaud i am going to merge this so we can potentially deploy it on monday. Let me know if you have any comments

@marchello2000 marchello2000 merged commit 6eb1718 into spinnaker:master Jul 21, 2019
@marchello2000 marchello2000 deleted the mark/rrb_fix_npe branch March 11, 2020 22:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants