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

Update Cloud Deploy CustomTargetType resource to include Cloud Build V2 repo support for Skaffold configs #10513

Closed
wants to merge 20 commits into from

Conversation

katiexzhang
Copy link
Contributor

@katiexzhang katiexzhang commented Apr 23, 2024

Fixes hashicorp/terraform-provider-google#17935

Release Note Template for Downstream PRs (will be copied)

clouddeploy: added `google_cloud_build_repo` field to `google_clouddeploy_custom_target_type` resource

Copy link

Hello! I am a robot. Tests will require approval from a repository maintainer to run.

@shuyama1, a repository maintainer, has been assigned to review your changes. If you have not received review feedback within 2 business days, please leave a comment on this PR asking them to take a look.

You can help make sure that review is quick by doing a self-review and by running impacted tests locally.

@github-actions github-actions bot requested a review from shuyama1 April 23, 2024 19:09
@modular-magician modular-magician added awaiting-approval Pull requests that needs reviewer's approval to run presubmit tests and removed awaiting-approval Pull requests that needs reviewer's approval to run presubmit tests labels Apr 23, 2024
@shuyama1
Copy link
Member

@katiexzhang Thank for making the change! You can follow the steps at go/terraform-contribution-guide#before-you-begin to get tests automatically triggered for your PRs.

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 3 files changed, 138 insertions(+), 3 deletions(-))
google-beta provider: Diff ( 3 files changed, 138 insertions(+), 3 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 52 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 27
Passed tests: 24
Skipped tests: 2
Affected tests: 1

Click here to see the affected service packages
  • clouddeploy

Action taken

Found 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccClouddeployCustomTargetType_update

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{red}{\textsf{Tests failed during RECORDING mode:}}$
TestAccClouddeployCustomTargetType_update[Error message] [Debug log]

$\textcolor{red}{\textsf{Please fix these to complete your PR.}}$
View the build log or the debug log for each test

@modular-magician modular-magician added awaiting-approval Pull requests that needs reviewer's approval to run presubmit tests and removed awaiting-approval Pull requests that needs reviewer's approval to run presubmit tests labels Apr 23, 2024
Copy link
Member

@shuyama1 shuyama1 left a comment

Choose a reason for hiding this comment

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

Test failed due to a permadiff (more details on permadiff at https://googlecloudplatform.github.io/magic-modules/develop/permadiff):

vcr_utils.go:152: Step 3/4 error: After applying this test step, the plan was not empty.
        stdout:
        
        
        Terraform used the selected providers to generate the following execution
        plan. Resource actions are indicated with the following symbols:
          ~ update in-place
        
        Terraform will perform the following actions:
        
          # google_clouddeploy_custom_target_type.custom-target-type will be updated in-place
          ~ resource "google_clouddeploy_custom_target_type" "custom-target-type" {
                id                    = "projects/ci-test-project-188019/locations/us-central1/customTargetTypes/tf-test-my-custom-target-typeqihvoxv3n8"
                name                  = "tf-test-my-custom-target-typeqihvoxv3n8"
                # (13 unchanged attributes hidden)
        
              ~ custom_actions {
                    # (2 unchanged attributes hidden)
        
                  ~ include_skaffold_modules {
                        # (1 unchanged attribute hidden)
        
                      + google_cloud_build_repo {
                          + path       = "configs/skaffold.yaml"
                          + ref        = "main"
                          + repository = "projects/777/locations/us-central1/connections/git/repositories/repo"
                        }
                    }
        
                    # (2 unchanged blocks hidden)
                }
            }
        
        Plan: 0 to add, 1 to change, 0 to destroy.

It doesn't look like the API returns these fields(?)

@@ -0,0 +1,17 @@
resource "google_clouddeploy_custom_target_type" "<%= ctx[:primary_resource_id] %>" {
Copy link
Member

Choose a reason for hiding this comment

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

You'll need to register this example in the CustomTargetType.yaml file. More details at https://googlecloudplatform.github.io/magic-modules/develop/test/test/#add-a-create-test

Copy link
Member

@shuyama1 shuyama1 Apr 25, 2024

Choose a reason for hiding this comment

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

Sorry I was probably not clear previously. You'll need to add something like https://github.com/katiexzhang/magic-modules/blob/main/mmv1/products/clouddeploy/CustomTargetType.yaml#L57-L62 in the CustomTargetType.yaml file so that this example will be generated in both tests and web docs.

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 3 files changed, 138 insertions(+), 3 deletions(-))
google-beta provider: Diff ( 3 files changed, 138 insertions(+), 3 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 52 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 27
Passed tests: 24
Skipped tests: 2
Affected tests: 1

Click here to see the affected service packages
  • clouddeploy

Action taken

Found 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccClouddeployCustomTargetType_update

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{red}{\textsf{Tests failed during RECORDING mode:}}$
TestAccClouddeployCustomTargetType_update[Error message] [Debug log]

$\textcolor{red}{\textsf{Please fix these to complete your PR.}}$
View the build log or the debug log for each test

@katiexzhang
Copy link
Contributor Author

When I click on the details of the VCR-test, it takes me to a build that was successful.

@shuyama1
Copy link
Member

shuyama1 commented Apr 23, 2024

When I click on the details of the VCR-test, it takes me to a build that was successful.

the GCB status only show the tests are triggered successfully. We use comment to post test result, like #10513 (comment). You can click on [Error message] for view test errors and [Debug log] for debug logs which contain request/response pairs

@github-actions github-actions bot requested a review from shuyama1 April 24, 2024 18:55
@modular-magician modular-magician added the awaiting-approval Pull requests that needs reviewer's approval to run presubmit tests label Apr 24, 2024
@katiexzhang
Copy link
Contributor Author

Thanks for the pointers, updated the test file.

@modular-magician modular-magician removed the awaiting-approval Pull requests that needs reviewer's approval to run presubmit tests label Apr 25, 2024
@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 3 files changed, 225 insertions(+), 3 deletions(-))
google-beta provider: Diff ( 3 files changed, 225 insertions(+), 3 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 85 insertions(+))

Missing test report

Your PR includes resource fields which are not covered by any test.

Resource: google_clouddeploy_custom_target_type (11 total tests)
Please add an acceptance test which includes these fields. The test should include the following:

resource "google_clouddeploy_custom_target_type" "primary" {
  custom_actions {
    include_skaffold_modules {
      google_cloud_build_repo_v2 {
        connection = # value needed
        path       = # value needed
        project_id = # value needed
        ref        = # value needed
        region     = # value needed
        repo       = # value needed
      }
    }
  }
}

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 27
Passed tests: 24
Skipped tests: 2
Affected tests: 1

Click here to see the affected service packages
  • clouddeploy

Action taken

Found 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccClouddeployCustomTargetType_update

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 27
Passed tests: 24
Skipped tests: 2
Affected tests: 1

Click here to see the affected service packages
  • clouddeploy

Action taken

Found 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccClouddeployCustomTargetType_update

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{red}{\textsf{Tests failed during RECORDING mode:}}$
TestAccClouddeployCustomTargetType_update[Error message] [Debug log]

$\textcolor{red}{\textsf{Please fix these to complete your PR.}}$
View the build log or the debug log for each test

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 3 files changed, 138 insertions(+), 3 deletions(-))
google-beta provider: Diff ( 3 files changed, 138 insertions(+), 3 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 52 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 27
Passed tests: 24
Skipped tests: 2
Affected tests: 1

Click here to see the affected service packages
  • clouddeploy

Action taken

Found 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccClouddeployCustomTargetType_update

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{red}{\textsf{Tests failed during RECORDING mode:}}$
TestAccClouddeployCustomTargetType_update[Error message] [Debug log]

$\textcolor{red}{\textsf{Please fix these to complete your PR.}}$
View the build log or the debug log for each test

Copy link
Member

@shuyama1 shuyama1 left a comment

Choose a reason for hiding this comment

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

You can follow https://googlecloudplatform.github.io/magic-modules/get-started/generate-providers/ to generate providers and https://googlecloudplatform.github.io/magic-modules/develop/test/run-tests/#run-tests to run tests locally which may help you view the test result faster.

Please let me know if you have any questions.

@@ -0,0 +1,17 @@
resource "google_clouddeploy_custom_target_type" "<%= ctx[:primary_resource_id] %>" {
Copy link
Member

@shuyama1 shuyama1 Apr 25, 2024

Choose a reason for hiding this comment

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

Sorry I was probably not clear previously. You'll need to add something like https://github.com/katiexzhang/magic-modules/blob/main/mmv1/products/clouddeploy/CustomTargetType.yaml#L57-L62 in the CustomTargetType.yaml file so that this example will be generated in both tests and web docs.

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 5 files changed, 152 insertions(+), 3 deletions(-))
google-beta provider: Diff ( 5 files changed, 152 insertions(+), 3 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 52 insertions(+))
Open in Cloud Shell: Diff ( 1 file changed, 2 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 27
Passed tests: 20
Skipped tests: 2
Affected tests: 5

Click here to see the affected service packages
  • clouddeploy

Action taken

Found 5 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccClouddeployCustomTargetTypeIamBindingGenerated|TestAccClouddeployCustomTargetTypeIamMemberGenerated|TestAccClouddeployCustomTargetTypeIamPolicyGenerated|TestAccClouddeployCustomTargetType_clouddeployCustomTargetTypeBasicExample|TestAccClouddeployCustomTargetType_update

Get to know how VCR tests work

@github-actions github-actions bot requested a review from shuyama1 April 25, 2024 21:03
@modular-magician
Copy link
Collaborator

$\textcolor{green}{\textsf{Tests passed during RECORDING mode:}}$
TestAccClouddeployCustomTargetTypeIamBindingGenerated[Debug log]
TestAccClouddeployCustomTargetTypeIamMemberGenerated[Debug log]
TestAccClouddeployCustomTargetTypeIamPolicyGenerated[Debug log]
TestAccClouddeployCustomTargetType_clouddeployCustomTargetTypeBasicExample[Debug log]

$\textcolor{green}{\textsf{No issues found for passed tests after REPLAYING rerun.}}$


$\textcolor{red}{\textsf{Tests failed during RECORDING mode:}}$
TestAccClouddeployCustomTargetType_update[Error message] [Debug log]

$\textcolor{red}{\textsf{Please fix these to complete your PR.}}$
View the build log or the debug log for each test

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 5 files changed, 226 insertions(+), 3 deletions(-))
google-beta provider: Diff ( 5 files changed, 226 insertions(+), 3 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 52 insertions(+))
Open in Cloud Shell: Diff ( 5 files changed, 120 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 28
Passed tests: 24
Skipped tests: 2
Affected tests: 2

Click here to see the affected service packages
  • clouddeploy

Action taken

Found 2 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccClouddeployCustomTargetType_clouddeployCustomTargetTypeGcbRepoSkaffoldModulesExample|TestAccClouddeployCustomTargetType_update

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{red}{\textsf{Tests failed during RECORDING mode:}}$
TestAccClouddeployCustomTargetType_clouddeployCustomTargetTypeGcbRepoSkaffoldModulesExample[Error message] [Debug log]
TestAccClouddeployCustomTargetType_update[Error message] [Debug log]

$\textcolor{red}{\textsf{Please fix these to complete your PR.}}$
View the build log or the debug log for each test

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 5 files changed, 226 insertions(+), 3 deletions(-))
google-beta provider: Diff ( 5 files changed, 226 insertions(+), 3 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 52 insertions(+))
Open in Cloud Shell: Diff ( 5 files changed, 120 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 28
Passed tests: 24
Skipped tests: 2
Affected tests: 2

Click here to see the affected service packages
  • clouddeploy

Action taken

Found 2 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccClouddeployCustomTargetType_clouddeployCustomTargetTypeGcbRepoSkaffoldModulesExample|TestAccClouddeployCustomTargetType_update

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{red}{\textsf{Tests failed during RECORDING mode:}}$
TestAccClouddeployCustomTargetType_clouddeployCustomTargetTypeGcbRepoSkaffoldModulesExample[Error message] [Debug log]
TestAccClouddeployCustomTargetType_update[Error message] [Debug log]

$\textcolor{red}{\textsf{Please fix these to complete your PR.}}$
View the build log or the debug log for each test

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 4 files changed, 212 insertions(+), 3 deletions(-))
google-beta provider: Diff ( 4 files changed, 212 insertions(+), 3 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 52 insertions(+))
Open in Cloud Shell: Diff ( 4 files changed, 118 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 28
Passed tests: 20
Skipped tests: 2
Affected tests: 6

Click here to see the affected service packages
  • clouddeploy

Action taken

Found 6 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccClouddeployCustomTargetTypeIamBindingGenerated|TestAccClouddeployCustomTargetTypeIamMemberGenerated|TestAccClouddeployCustomTargetTypeIamPolicyGenerated|TestAccClouddeployCustomTargetType_clouddeployCustomTargetTypeBasicExample|TestAccClouddeployCustomTargetType_clouddeployCustomTargetTypeGcbRepoSkaffoldModulesExample|TestAccClouddeployCustomTargetType_update

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{green}{\textsf{Tests passed during RECORDING mode:}}$
TestAccClouddeployCustomTargetTypeIamBindingGenerated[Debug log]
TestAccClouddeployCustomTargetTypeIamMemberGenerated[Debug log]
TestAccClouddeployCustomTargetTypeIamPolicyGenerated[Debug log]
TestAccClouddeployCustomTargetType_clouddeployCustomTargetTypeBasicExample[Debug log]

$\textcolor{green}{\textsf{No issues found for passed tests after REPLAYING rerun.}}$


$\textcolor{red}{\textsf{Tests failed during RECORDING mode:}}$
TestAccClouddeployCustomTargetType_clouddeployCustomTargetTypeGcbRepoSkaffoldModulesExample[Error message] [Debug log]
TestAccClouddeployCustomTargetType_update[Error message] [Debug log]

$\textcolor{red}{\textsf{Please fix these to complete your PR.}}$
View the build log or the debug log for each test

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 4 files changed, 212 insertions(+), 3 deletions(-))
google-beta provider: Diff ( 4 files changed, 212 insertions(+), 3 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 52 insertions(+))
Open in Cloud Shell: Diff ( 4 files changed, 118 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 28
Passed tests: 24
Skipped tests: 2
Affected tests: 2

Click here to see the affected service packages
  • clouddeploy

Action taken

Found 2 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccClouddeployCustomTargetType_clouddeployCustomTargetTypeGcbRepoSkaffoldModulesExample|TestAccClouddeployCustomTargetType_update

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{red}{\textsf{Tests failed during RECORDING mode:}}$
TestAccClouddeployCustomTargetType_clouddeployCustomTargetTypeGcbRepoSkaffoldModulesExample[Error message] [Debug log]
TestAccClouddeployCustomTargetType_update[Error message] [Debug log]

$\textcolor{red}{\textsf{Please fix these to complete your PR.}}$
View the build log or the debug log for each test

@katiexzhang
Copy link
Contributor Author

You can follow https://googlecloudplatform.github.io/magic-modules/get-started/generate-providers/ to generate providers and https://googlecloudplatform.github.io/magic-modules/develop/test/run-tests/#run-tests to run tests locally which may help you view the test result faster.

Please let me know if you have any questions.

Ahh thanks, I missed that block in the CustomTargetType.yaml file. I'm running the tests locally but am running into an undefined email error (https://paste.googleplex.com/5201371749416960#l=31).

I manually added all these files following a previous example (https://github.com/GoogleCloudPlatform/magic-modules/pull/9950/files), although reading the docs it seems like some of them should be generated? I'm not sure if this error is a result of me manually editing the files, or a deeper error of some sort.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cloud Deploy CustomTargetType remote Skaffold config support with Cloud Build repositories
3 participants