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

pubsys: fix bug preventing multiple ssm promotions #3137

Merged
merged 1 commit into from
May 23, 2023

Conversation

cbgbt
Copy link
Contributor

@cbgbt cbgbt commented May 23, 2023

Issue number:

Closes #3103

Description of changes:
The goal of this feature is to keep a file of all published SSM parameters for the current Bottlerocket build.

During promotions, we parse the existing SSM file then add any newly created SSM parameter.

Prior to this change, the code which combines prior state with the newly-created parameters falsely assumed that all constructed promoted parameters would have a 1:1 mapping with a parameter that already exists in the file. This fails in some cases, e.g. when performing tiered promotions where the first tier is largely irrelevant when performing a promotion from the second to the third tier.

The change modifies the code to simply concatenate the existing data with any newly-created parameter, overwriting if the key exists.

Testing done:

  • unit tests pass
  • manual testing of a tiered promotion

Terms of contribution:

By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.

@cbgbt cbgbt requested review from zmrow, etungsten and yeazelm May 23, 2023 20:17
@cbgbt cbgbt force-pushed the pubsys-ssm-file branch 2 times, most recently from 3069d94 to 945a00a Compare May 23, 2023 20:33
Copy link
Contributor

@zmrow zmrow left a comment

Choose a reason for hiding this comment

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

Looks good; great simplification! 🎆

Provided the manual testing goes well, I'm happy.

"test3-parameter-value".to_string(),
),
(
SsmKey::new(
Copy link
Contributor

Choose a reason for hiding this comment

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

This is just an additional key yeah? I'm not missing more context there?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correct! The idea was that this key isn't involved in the promotion.

This test would fail on the previous commit.

Copy link
Contributor

@stmcginnis stmcginnis left a comment

Choose a reason for hiding this comment

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

Just some lint issues to resolve.

@cbgbt
Copy link
Contributor Author

cbgbt commented May 23, 2023

^ fixes clippy warnings.

@cbgbt cbgbt marked this pull request as ready for review May 23, 2023 21:49
@cbgbt cbgbt merged commit 07b1762 into bottlerocket-os:develop May 23, 2023
38 checks passed
etungsten added a commit that referenced this pull request May 24, 2023
@cbgbt cbgbt deleted the pubsys-ssm-file branch August 15, 2023 23:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pubsys: Using promote-ssm in a tiered promotion structure causes pubsys to panic
5 participants