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(bake): Fix the fix for inconsistent names in parallel bakes #3236

Merged
merged 6 commits into from
Oct 18, 2019

Conversation

luispollo
Copy link
Contributor

This complements #3219 by ensuring that we only look at the image names for parallel bake stages associated with the top-level bake stage that the CompleteParallelBakeTest cares about when trying to decide whether to fail a parallel bake on inconsistent image names. This avoids failing the stage if there are unrelated bake stages in the pipeline (which would obviously generate different image names).

While troubleshooting this, I found that this task includes context information from the parallel bake stages of unrelated top-level bake stages in the pipeline, which is clearly visible in the execution JSON of such pipelines. I don't know if that is itself a bug or is by design, so I just left a note in a comment for now, but would be happy to correct that if it's not expected behavior.

@luispollo luispollo changed the title Lpollo spin 5023 fix(bake): Fix the fix for inconsistent names in parallel bakes Oct 17, 2019
@spinnakerbot
Copy link
Contributor

The following commits need their title changed:

  • 9fd197e: Merge remote-tracking branch 'upstream/master' into lpollo-spin-5023

  • a1269cc: Merge remote-tracking branch 'upstream/master' into lpollo-spin-5023

  • 80ffc38: Merge remote-tracking branch 'upstream/master' into lpollo-spin-5023

Please format your commit title into the form:

<type>(<scope>): <subject>, e.g. fix(kubernetes): address NPE in status check

This allows us to easily generate changelogs & determine semantic version numbers when cutting releases. You can read more about commit conventions here.

@luispollo luispollo changed the title fix(bake): Fix the fix for inconsistent names in parallel bakes fix(bake): (WIP) Fix the fix for inconsistent names in parallel bakes Oct 17, 2019
@luispollo luispollo changed the title fix(bake): (WIP) Fix the fix for inconsistent names in parallel bakes fix(bake): Fix the fix for inconsistent names in parallel bakes Oct 18, 2019
@luispollo
Copy link
Contributor Author

@marchello2000 @aravindmd Please review.

@luispollo
Copy link
Contributor Author

@cfieber FYI if you want to take a look a well.

.map({details -> details['imageName']})
// find distinct image names in bake stages that are actually related to the stage passed into the task
def distinctImageNames = relatedBakeStages
.findAll { it.parentStageId == stage.id && (it.context.ami || it.context.imageId) }
Copy link
Contributor

Choose a reason for hiding this comment

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

is the (it.context.ami || it.context.imageId) to determine whether this is a bake stage?

would checking it.type == 'bake' accomplish this instead?

alternatively would it.context.imageName be more appropriate to check since we are mapping to that on L169?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was following what was done here:

deploymentDetails: relatedBakeStages.findAll{it.context.ami || it.context.imageId}.collect { Stage bakeStage ->

...which I guessed was filtering for stages that actually had bake output information in them (without ami or imageId in the context, the bake probably failed?).

Does that make sense? Maybe I could encapsulate that in a method like hasValidBakeContext(stage) to make that clearer and reusable?

Copy link
Contributor

Choose a reason for hiding this comment

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

then it's probably more appropriate to use:

Suggested change
.findAll { it.parentStageId == stage.id && (it.context.ami || it.context.imageId) }
.findAll { it.parentStageId == stage.id && (it.context.imageName) }

since that's what you actually use for comparison on L169

Copy link
Contributor Author

@luispollo luispollo Oct 18, 2019

Choose a reason for hiding this comment

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

@marchello2000 Am I guaranteed to have imageName in the context if the bake succeeded? But, yeah, agreed in principle.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed it to use imageName. Better?

type = "bake"
context = [
"region": "us-east-1",
"regions": ["eu-east-1"]
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"regions": ["eu-east-1"]
"regions": ["us-east-1"]

seems odd that this wouldn't be a superset of the single region

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I know, right? But based on what I saw, only the regions field is actually used? I don't know what the singular region is used for, if anything...

Copy link
Contributor

@cfieber cfieber left a comment

Choose a reason for hiding this comment

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

couple minor comments otherwise LGTM


when:
new BakeStage.CompleteParallelBakeTask(dynamicConfigService).execute(pipeline.stageById("1"))

Copy link
Contributor

Choose a reason for hiding this comment

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

Minor... You expect some other exception to be thrown here ? If not we can say noExceptionThrown() here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was advised to use a specific exception from kork for this case, so here I'm looking for that specific exception. If any other type of exception is thrown, it's unexpected in this test and it should fail.

@luispollo
Copy link
Contributor Author

@gal-yardeni FYI as well!

@marchello2000 marchello2000 added the ready to merge Approved and ready for merge label Oct 18, 2019
@luispollo
Copy link
Contributor Author

While troubleshooting this, I found that this task includes context information from the parallel bake stages of unrelated top-level bake stages in the pipeline, which is clearly visible in the execution JSON of such pipelines. I don't know if that is itself a bug or is by design, so I just left a note in a comment for now, but would be happy to correct that if it's not expected behavior.

@cfieber BTW, was curious if you knew the history behind this?

@mergify mergify bot merged commit a31cde3 into spinnaker:master Oct 18, 2019
@luispollo luispollo deleted the lpollo-spin-5023 branch October 18, 2019 18:18
@marchello2000 marchello2000 added the auto merged Merged automatically by a bot label Oct 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto merged Merged automatically by a bot ready to merge Approved and ready for merge target-release/1.17
Projects
None yet
5 participants