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 passing non-string variables for other bundle actions #101

Merged
merged 3 commits into from
Nov 30, 2022

Conversation

carolynvs
Copy link
Member

The install action had been updated in #91 to work with complex data types by using a json parser to read and then write out variables when converting them from porter.yaml values to -var flags.
This ensures that primitive data types are printed without unexpected formatting, such as quotes around a string value, while arrays and objects are printed in json.

This patch applies the same fix to the other bundle actions: upgrade, invoke and uninstall. I've also extracted that common logic into a function with tests so that we can be sure all the actions are using it correctly.

Consolidate test bundle and example bundle

The test bundle had a lot of great edge cases and examples for how to use terraform in a bundle that would be useful to make people aware of in our example bundle. I have updated the basic-tf-example bundle with the contents of our test bundle. I also added defaults for all the parameters so that it doesn't require any additional config to run.

This is also good because our example bundle is tested in CI now.

The install action had been updated in getporter#91 to work with complex data types by using a json parser to read and then write out variables when convertig them from porter.yaml values to -var flags.
This ensures that primitive data types are printed without unexpected formatting, such as quotes around a string value, while arrays and objects are printed in json.

This patch applies the same fix to the other bundle actions: upgrade, invoke and uninstall. I've also extracted that common logic into a function with tests so that we can be sure all the actions are using it correctly.

Signed-off-by: Carolyn Van Slyck <me@carolynvanslyck.com>
The test bundle had a lot of great edge cases and examples for how to use terraform in a bundle that would be useful to make people aware of in our example bundle. I have updated the basic-tf-example bundle with the contents of our test bundle. I also added defaults for all the parameters so that it doesn't require any additional config to run.

This is also good because our example bundle is tested in CI now.

Signed-off-by: Carolyn Van Slyck <me@carolynvanslyck.com>
@getporterbot getporterbot added this to In Progress in Porter and Mixins Nov 30, 2022
@@ -50,21 +113,51 @@ show:
plan:
- terraform:
description: "Invoke 'terraform plan'"
flags:
Copy link
Member Author

Choose a reason for hiding this comment

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

I removed these because they aren't helpful in an example, we don't actually want to suppress plan output or turn off color.

Signed-off-by: Carolyn Van Slyck <me@carolynvanslyck.com>
@carolynvs carolynvs marked this pull request as ready for review November 30, 2022 16:03
Copy link

@sgettys sgettys 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, nice catch on adding this to all of the actions totally missed that.

@carolynvs carolynvs merged commit 002b07b into getporter:main Nov 30, 2022
Porter and Mixins automation moved this from In Progress to Done Nov 30, 2022
@carolynvs carolynvs deleted the non-string-vars branch November 30, 2022 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants