-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Adding Missing Cloud Build Attributes #3627
Adding Missing Cloud Build Attributes #3627
Conversation
Hello! I am a robot who works on Magic Modules PRs. I have detected that you are a community contributor, so your PR will be assigned to someone with a commit-bit on this repo for initial review. Thanks for your contribution! A human will be with you soon. @SirGitsalot, please review this PR or find an appropriate assignee. |
I have not added |
Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are. Diff report:Terraform GA: Diff ( 2 files changed, 711 insertions(+)) |
I have triggered VCR tests based on this PR's diffs. See the results here: "https://ci-oss.hashicorp.engineering/viewQueued.html?itemId=119503" |
@danawillow any feedback for this? I'm not sure if the auto-assigning to @SirGitsalot is valid in light of #3592 🤔 |
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.
Looks like the right direction to me! I wouldn't suggest overriding anything in terraform.yaml until you have a specific reason why you would need to- usually I find it becomes apparent when testing my changes.
For testing, I'd recommend creating an example (see cloudbuild_trigger_filename for the current one for this resource) that sets some/all of the new fields, and then adding it to terraform.yaml. That'll generate a test that sets them. After that, I'd also recommend adding the new fields to the existing (or a new) update test in https://github.com/GoogleCloudPlatform/magic-modules/blob/master/third_party/terraform/tests/resource_cloudbuild_trigger_test.go) so we know they can be updated.
Let me know if you have further questions!
products/cloudbuild/api.yaml
Outdated
- !ruby/object:Api::Type::NestedObject | ||
name: 'storageSource' | ||
exactly_one_of: | ||
- storageSource |
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.
Unfortunately we can't do exactly_one_of
on elements of lists: hashicorp/terraform-plugin-sdk#470. I'd recommend just documenting the behavior (we actually already do that elsewhere in this resource: https://github.com/GoogleCloudPlatform/magic-modules/blob/master/products/cloudbuild/terraform.yaml#L38-L40)
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.
Great catch - addressed here
I copied the approach for the branchName
, tagName
, and commitSHA
from the other ones in the file (not overriding, just putting into the description).
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.
Looks like it's still here. Check out the generated code as well to see what it ends up doing: https://github.com/modular-magician/terraform-provider-google-beta/compare/auto-pr-3627-old..auto-pr-3627#diff-f0c51a3d504e195b74aeb122b2747c9eR318.
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.
Okay explicitly removed here
Hey @tanjinP, just wanted to check if you're still working on this! Let me know if you have any more questions. |
Appreciate you checking in @danawillow - yes I was on break for a while and started up my laptop last night to address the feedback for this PR and make tests and quickly feel asleep before doing anything 😴 😅 I will have the next pass complete by tomorrow morning and will make the PR ready for review as well as re-request you. Apologies for taking so long - I know a few folks are looking to get this so will get right on it. |
Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are. Diff report:Terraform GA: Diff ( 2 files changed, 711 insertions(+)) |
Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are. Diff report:Terraform GA: Diff ( 4 files changed, 809 insertions(+)) |
Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are. Diff report:Terraform GA: Diff ( 4 files changed, 812 insertions(+)) |
@danawillow - according to the original issue (#3576) I'm still missing a few attributes in this PR but I wanted to take this opportunity to do a quick gut check on the iteration thus far. Your feedback was great, and I did my best to implement some of it (but not as thorough as I would like it to be, ie more tests, fields, etc. - will you comment on that). I did have a strange issue when running
and would get errors like:
Then I'd go to the terraform directory in my $GOPATH and run:
I have not done the beta yet but will shortly. Hope that wasn't too much - thanks again for the guidance 🙂 |
Are you running on a mac? If so I fix that error by running |
Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are. Diff report:Terraform GA: Diff ( 4 files changed, 807 insertions(+)) |
Hey, just wanted to pop in and let you know I haven't forgotten about this! I've had a bunch of other things on my plate, but I should be able to look at this again next week. |
@@ -0,0 +1,29 @@ | |||
resource "google_cloudbuild_trigger" "<%= ctx[:primary_resource_id] %>" { |
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.
The test generated from this example fails:
------- Stdout: -------
=== RUN TestAccCloudBuildTrigger_cloudbuildTriggerBuildExample
=== PAUSE TestAccCloudBuildTrigger_cloudbuildTriggerBuildExample
=== CONT TestAccCloudBuildTrigger_cloudbuildTriggerBuildExample
TestAccCloudBuildTrigger_cloudbuildTriggerBuildExample: testing.go:674: Step 0 error: config is invalid: "github": one of `github,trigger_template` must be specified
--- FAIL: TestAccCloudBuildTrigger_cloudbuildTriggerBuildExample (0.46s)
FAIL
My guess is even when that is fixed, the test will probably still fail because some of the references in this example are to things that don't exist. https://github.com/GoogleCloudPlatform/magic-modules#testing-your-changes talks about testing changes. We can run the tests for you, but it's obviously faster if you can iterate on them yourself before sending it back :)
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.
Oh this is strange I thought I did run all the tests and confirm they passed before making PRs ready. Will look at this again this evening 🤔
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.
@danawillow okay I see it was because I was testing with the general Terraform provider, when I ran the test on the Terraform beta provider I got the same error. I made a the correction to the test example here and now all tests are passing again 🤷
Anything else to look at?
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.
Want to note I still need to fill out some of the specific sub resources mentioned in the original ticket. Just want to ensure things are looking good before I proceed and knock the rest out (including a test that includes a comprehensive build example)
Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are. Diff report:Terraform GA: Diff ( 4 files changed, 817 insertions(+)) |
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.
LGTM, just one last thing I noticed. I'm happy to have you fix this and then merge this in and do the rest in a follow up (that way people can start using them sooner), but if you'd prefer to do the rest in this PR that's fine too.
Location of the source in an archive file in Google Cloud Storage. | ||
properties: | ||
- !ruby/object:Api::Type::String | ||
name: 'bucket' |
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 this and object
be required?
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.
Fair point - wasn't explicitly called out in REST reference which may explain why I missed it.
Just ran tests on latest commit and confirmed it's passing. Hmmm, in that case let's go ahead and get this merged in and I can make a follow up PR with the rest of the items. Am generally a fan of the iterative approach and this seems a good a time as any 🙂 |
Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are. Diff report:Terraform GA: Diff ( 4 files changed, 821 insertions(+)) |
Ref: hashicorp/terraform-provider-google#6531
Ref: #3576
Q for reviewer/maintainer (while in draft): want to ensure I am going in the right direction with what was done thus far. Should I be adding test? Overriding in
terraform.yaml
? Open to hearing anything and everything 🙂Release Note Template for Downstream PRs (will be copied)