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

Make not-generated Terraform resources CSV available as a Github workflow artifact #139

Merged
merged 2 commits into from
Nov 14, 2022

Conversation

ulucinar
Copy link
Contributor

@ulucinar ulucinar commented Nov 10, 2022

Description of your changes

This PR proposes a change where a CSV file of Terraform resource names which are available in the Terraform provider's schema but not generated as managed resources is produced and made available as a Github workflow artifact.

Currently, the artifact is generated when the generate make target is run as a dependency (of check-diff). This is a little bit implicit and as an alternative we can generate the CSV on its own step. But I did not want to add to our build times (by running make generate a second time or computing the diff from the JSON schema and the generated files), and thus preferred to generate the CSV in the Check Diff step.

I have:

  • Run make reviewable test to ensure this PR is ready for review.

How has this code been tested

Tested with the following workflow run:
https://github.com/upbound/provider-aws/actions/runs/3438916965

@ulucinar ulucinar marked this pull request as draft November 10, 2022 15:03
@ulucinar ulucinar force-pushed the fix-867 branch 6 times, most recently from 9c944ff to 181cc42 Compare November 10, 2022 17:47
p := config.GetProvider()
pipeline.Run(p, absRootDir)
if fp := os.Getenv("SKIPPED_RESOURCES_CSV"); len(fp) != 0 {
if err := os.WriteFile(fp, []byte(strings.Join(p.GetSkippedResourceNames(), ",")), 0o600); err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

should these be using ; so each resource is on its own row? looks like all the resources are generated into a single row now. Not sure which is better, it's just the first thing I noticed when opening the csv is that you have to scroll horizontally forever because they are in one row 😇

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Replaced the separator char with ;. @jbw976, which spreadsheet editor are you using? After seeing your comment, I gave it a try and it's opened by Numbers. With Numbers, both , and ; result in a table with a single row. If we would prefer a table with a single column, then we may use \n as the separator char here.

Copy link
Member

@jbw976 jbw976 Nov 13, 2022

Choose a reason for hiding this comment

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

yes sir, Pages gets opened by default on my Mac. When I mentioned ;, I didn't try it out or think it through :)

My personal opinion is that whatever works to make it a single column (e.g., \n) instead of single row is a more friendly scrolling experience. But that is not a super strong opinion and you can make the call 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.

Then, let's proceed with a \n as the separator char to get a single column table.

@ulucinar ulucinar marked this pull request as ready for review November 11, 2022 08:54
…flow artifact

Signed-off-by: Alper Rifat Ulucinar <ulucinar@users.noreply.github.com>
pipeline.Run(config.GetProvider(), absRootDir)
p := config.GetProvider()
pipeline.Run(p, absRootDir)
if fp := os.Getenv("SKIPPED_RESOURCES_CSV"); len(fp) != 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

You may consider using a cli parsing library and accept both flags and env vars to keep argument parsing consistent like in uptest.

But it is totally up to you to deal with it now or later if we need more inputs. But at least a comment on why we use env here would be helpful.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Moved to the kingpin.v2 package for argument parsing in the generator.

@pull-request-size pull-request-size bot added size/M and removed size/S labels Nov 11, 2022
…nerator

Signed-off-by: Alper Rifat Ulucinar <ulucinar@users.noreply.github.com>
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.

3 participants