-
Notifications
You must be signed in to change notification settings - Fork 150
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
Conversation
9c944ff
to
181cc42
Compare
cmd/generator/main.go
Outdated
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 { |
There was a problem hiding this comment.
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 😇
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 🙇
There was a problem hiding this comment.
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.
…flow artifact Signed-off-by: Alper Rifat Ulucinar <ulucinar@users.noreply.github.com>
cmd/generator/main.go
Outdated
pipeline.Run(config.GetProvider(), absRootDir) | ||
p := config.GetProvider() | ||
pipeline.Run(p, absRootDir) | ||
if fp := os.Getenv("SKIPPED_RESOURCES_CSV"); len(fp) != 0 { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
…nerator Signed-off-by: Alper Rifat Ulucinar <ulucinar@users.noreply.github.com>
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 (ofcheck-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 runningmake generate
a second time or computing the diff from the JSON schema and the generated files), and thus preferred to generate the CSV in theCheck Diff
step.I have:
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