Skip to content

Commit dacf76b

Browse files
Merge branch 'GoogleCloudPlatform:main' into main
2 parents beec2f4 + cc2d986 commit dacf76b

File tree

277 files changed

+13030
-865
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

277 files changed

+13030
-865
lines changed

.ci/containers/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ Before you begin, set up Docker (including configuring it to [authenticate with
2424
```
2525
4. Update cloudbuild yaml files to reference the image you just pushed by adding the `:testing` suffix
2626
5. Update files that will cause the cloudbuild yaml changes (and therefore your changes) to be exercised
27-
- Tip: Modifying `mmv1/third_party/terraform/services/compute/metadata.go.erb` will trigger builds for TPG, TPGB, and TGC.
27+
- Tip: Modifying `mmv1/third_party/terraform/services/compute/metadata.go.tmpl` will trigger builds for TPG, TPGB, and TGC.
2828
6. Create a PR with these changes.
2929
7. Verify that the cloudbuild steps that should use your testing image _are_ using your testing image (in the Execution Details tab for the step.)

.ci/gcb-vcr-nightly.yml

+10-3
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,15 @@
22
steps:
33
- name: 'gcr.io/graphite-docker-images/go-plus'
44
id: gcb-vcr-nightly
5-
entrypoint: '/workspace/.ci/scripts/go-plus/vcr-cassette-update/vcr_cassette_update.sh'
6-
secretEnv: ["GOOGLE_BILLING_ACCOUNT", "GOOGLE_CUST_ID", "GOOGLE_IDENTITY_USER", "GOOGLE_MASTER_BILLING_ACCOUNT", "GOOGLE_ORG", "GOOGLE_ORG_2", "GOOGLE_ORG_DOMAIN", "GOOGLE_PROJECT", "GOOGLE_PROJECT_NUMBER", "GOOGLE_SERVICE_ACCOUNT", "SA_KEY", "GOOGLE_PUBLIC_AVERTISED_PREFIX_DESCRIPTION"]
5+
entrypoint: '/workspace/.ci/scripts/go-plus/magician/exec.sh'
6+
secretEnv: ["GOOGLE_BILLING_ACCOUNT", "GOOGLE_CUST_ID", "GOOGLE_IDENTITY_USER", "GOOGLE_MASTER_BILLING_ACCOUNT", "GOOGLE_ORG", "GOOGLE_ORG_2", "GOOGLE_ORG_DOMAIN", "GOOGLE_PROJECT", "GOOGLE_PROJECT_NUMBER", "GOOGLE_SERVICE_ACCOUNT", "SA_KEY", "GOOGLE_PUBLIC_AVERTISED_PREFIX_DESCRIPTION", "GITHUB_TOKEN_CLASSIC"]
7+
env:
8+
- "GOOGLE_REGION=us-central1"
9+
- "GOOGLE_ZONE=us-central1-a"
10+
- "USER=magician"
711
args:
8-
- $BUILD_ID
12+
- 'vcr-cassette-update'
13+
- $BUILD_ID
914

1015
# Long timeout to enable waiting on VCR test
1116
timeout: 20000s
@@ -39,3 +44,5 @@ availableSecrets:
3944
env: SA_KEY
4045
- versionName: projects/673497134629/secrets/ci-test-public-advertised-prefix-description/versions/latest
4146
env: GOOGLE_PUBLIC_AVERTISED_PREFIX_DESCRIPTION
47+
- versionName: projects/673497134629/secrets/github-classic--repo-workflow/versions/latest
48+
env: GITHUB_TOKEN_CLASSIC

.ci/magician/cmd/templates/vcr/vcr_cassettes_update_recording.tmpl

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ The provider crashed while running the VCR tests in RECORDING mode
55
{{- else -}}
66
#################################
77
RECORDING Tests Report
8+
#################################
89

910
{{if .RecordingResult.PassedTests}}
1011
Tests passed during RECORDING mode:
@@ -18,7 +19,7 @@ Tests failed during RECORDING mode:
1819

1920
{{if .HasTerminatedTests}}Several tests got terminated during RECORDING mode{{end}}
2021

21-
{{if .RecordingErr}}Errors occurred during RECORDING mode.{{end}}
22+
{{if .RecordingErr}}Errors occurred during RECORDING mode: {{.RecordingErr}}.{{end}}
2223

2324
{{if .AllRecordingPassed}}All tests passed!{{end}}
2425

.ci/magician/cmd/templates/vcr/vcr_cassettes_update_replaying.tmpl

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ The provider crashed while running the VCR tests in REPLAYING mode
33
{{- else}}
44
#################################
55
Tests Analytics
6+
#################################
7+
68
Total tests: {{add (add (len .ReplayingResult.PassedTests) (len .ReplayingResult.SkippedTests)) (len .ReplayingResult.FailedTests) }}
79
Passed tests: {{len .ReplayingResult.PassedTests}}
810
Skipped tests: {{len .ReplayingResult.SkippedTests}}
@@ -15,7 +17,7 @@ Affected tests list:
1517
{{- end}}
1618
{{if .ReplayingErr}}
1719
#################################
18-
Errors occurred during REPLAYING mode.
20+
Errors occurred during REPLAYING mode: {{.ReplayingErr}}.
1921
#################################
2022
{{- end}}
2123
{{if .AllReplayingPassed}}

.ci/magician/cmd/vcr_cassette_update.go

+8-6
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,12 @@ func execVCRCassetteUpdate(buildID, today string, rnr ExecRunner, ctlr *source.C
133133
// upload replay build and test logs
134134
buildLogPath := filepath.Join(rnr.GetCWD(), "testlogs", fmt.Sprintf("%s_test.log", vcr.Replaying.Lower()))
135135
if _, err := uploadLogsToGCS(buildLogPath, bucketPrefix+"/logs/replaying/", rnr); err != nil {
136-
return fmt.Errorf("error uploading replaying test log: %w", err)
136+
fmt.Printf("Warning: error uploading replaying test log: %s\n", err)
137137
}
138138

139139
testLogPath := vt.LogPath(vcr.Replaying, provider.Beta)
140140
if _, err := uploadLogsToGCS(filepath.Join(testLogPath, "*"), bucketPrefix+"/logs/build-log/", rnr); err != nil {
141-
return fmt.Errorf("error uploading replaying build log: %w", err)
141+
fmt.Printf("Warning: error uploading replaying build log: %s\n", err)
142142
}
143143

144144
replayingData := vcrCassetteUpdateReplayingResult{
@@ -169,17 +169,19 @@ func execVCRCassetteUpdate(buildID, today string, rnr ExecRunner, ctlr *source.C
169169
// uploading cassettes failed because recording not work
170170
buildLogPath := filepath.Join(rnr.GetCWD(), "testlogs", fmt.Sprintf("%s_test.log", vcr.Recording.Lower()))
171171
if _, err := uploadLogsToGCS(buildLogPath, bucketPrefix+"/logs/recording/", rnr); err != nil {
172-
return fmt.Errorf("error uploading recording test log: %w", err)
172+
fmt.Printf("Warning: error uploading recording test log: %s\n", err)
173173
}
174174

175175
testLogPath := vt.LogPath(vcr.Recording, provider.Beta)
176176
if _, err := uploadLogsToGCS(filepath.Join(testLogPath, "*"), bucketPrefix+"/logs/build-log/", rnr); err != nil {
177-
return fmt.Errorf("error uploading recording build log: %w", err)
177+
fmt.Printf("Warning: error uploading recording build log: %s\n", err)
178178
}
179+
179180
if len(recordingResult.PassedTests) > 0 {
180181
cassettesPath := vt.CassettePath(provider.Beta)
181-
if _, err := uploadCassettesToGCS(cassettesPath, "gs://ci-vcr-cassettes/beta/fixtures/", rnr); err != nil {
182-
return fmt.Errorf("error uploading cassettes: %w", err)
182+
if _, err := uploadCassettesToGCS(cassettesPath+"/*", "gs://ci-vcr-cassettes/beta/fixtures/", rnr); err != nil {
183+
// There could be cases that the tests do not generate any cassettes.
184+
fmt.Printf("Warning: error uploading cassettes: %s\n", err)
183185
}
184186
} else {
185187
fmt.Println("No tests passed in recording mode, not uploading cassettes.")

.ci/magician/cmd/vcr_cassette_update_test.go

+16-4
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ func TestFormatVCRCassettesUpdateReplaying(t *testing.T) {
3434
[]string{
3535
"#################################",
3636
"Tests Analytics",
37+
"#################################",
38+
"",
3739
"Total tests: 5",
3840
"Passed tests: 2",
3941
"Skipped tests: 1",
@@ -47,7 +49,8 @@ func TestFormatVCRCassettesUpdateReplaying(t *testing.T) {
4749
"#################################",
4850
"",
4951
"#################################",
50-
"Errors occurred during REPLAYING mode.", "#################################",
52+
"Errors occurred during REPLAYING mode: some error.",
53+
"#################################",
5154
},
5255
"\n",
5356
),
@@ -65,6 +68,8 @@ func TestFormatVCRCassettesUpdateReplaying(t *testing.T) {
6568
[]string{
6669
"#################################",
6770
"Tests Analytics",
71+
"#################################",
72+
"",
6873
"Total tests: 3",
6974
"Passed tests: 2",
7075
"Skipped tests: 1",
@@ -74,7 +79,8 @@ func TestFormatVCRCassettesUpdateReplaying(t *testing.T) {
7479
"",
7580
"",
7681
"#################################",
77-
"All tests passed in REPLAYING mode.", "#################################",
82+
"All tests passed in REPLAYING mode.",
83+
"#################################",
7884
},
7985
"\n",
8086
),
@@ -93,6 +99,8 @@ func TestFormatVCRCassettesUpdateReplaying(t *testing.T) {
9399
[]string{
94100
"#################################",
95101
"Tests Analytics",
102+
"#################################",
103+
"",
96104
"Total tests: 5",
97105
"Passed tests: 2",
98106
"Skipped tests: 1",
@@ -160,6 +168,7 @@ func TestFormatVCRCassettesUpdateRecording(t *testing.T) {
160168
[]string{
161169
"#################################",
162170
"RECORDING Tests Report",
171+
"#################################",
163172
"",
164173
"",
165174
"Tests passed during RECORDING mode:",
@@ -173,7 +182,7 @@ func TestFormatVCRCassettesUpdateRecording(t *testing.T) {
173182
"",
174183
"",
175184
"",
176-
"Errors occurred during RECORDING mode.",
185+
"Errors occurred during RECORDING mode: some error.",
177186
},
178187
"\n",
179188
),
@@ -190,6 +199,7 @@ func TestFormatVCRCassettesUpdateRecording(t *testing.T) {
190199
[]string{
191200
"#################################",
192201
"RECORDING Tests Report",
202+
"#################################",
193203
"",
194204
"",
195205
"Tests passed during RECORDING mode:",
@@ -219,6 +229,7 @@ func TestFormatVCRCassettesUpdateRecording(t *testing.T) {
219229
[]string{
220230
"#################################",
221231
"RECORDING Tests Report",
232+
"#################################",
222233
"",
223234
"",
224235
"Tests passed during RECORDING mode:",
@@ -264,6 +275,7 @@ func TestFormatVCRCassettesUpdateRecording(t *testing.T) {
264275
[]string{
265276
"#################################",
266277
"RECORDING Tests Report",
278+
"#################################",
267279
"",
268280
"",
269281
"Tests passed during RECORDING mode:",
@@ -371,7 +383,7 @@ func TestExecVCRCassetteUpdate(t *testing.T) {
371383
}},
372384
{"/mock/dir/magic-modules/.ci/magician", "gsutil", []string{"-h", "Content-Type:text/plain", "-q", "cp", "-r", "/mock/dir/magic-modules/.ci/magician/testlogs/recording_test.log", "gs://vcr-nightly/beta/2024-07-08/buildID/logs/recording/"}, map[string]string(nil)},
373385
{"/mock/dir/magic-modules/.ci/magician", "gsutil", []string{"-h", "Content-Type:text/plain", "-q", "cp", "-r", "/mock/dir/magic-modules/.ci/magician/testlogs/recording/beta/*", "gs://vcr-nightly/beta/2024-07-08/buildID/logs/build-log/"}, map[string]string(nil)},
374-
{"/mock/dir/magic-modules/.ci/magician", "gsutil", []string{"-m", "-q", "cp", "/mock/dir/magic-modules/.ci/magician/cassettes/beta", "gs://ci-vcr-cassettes/beta/fixtures/"}, map[string]string(nil)},
386+
{"/mock/dir/magic-modules/.ci/magician", "gsutil", []string{"-m", "-q", "cp", "/mock/dir/magic-modules/.ci/magician/cassettes/beta/*", "gs://ci-vcr-cassettes/beta/fixtures/"}, map[string]string(nil)},
375387
},
376388
},
377389
},

.ci/magician/github/membership_data.go

+12-7
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ var (
3535
// startDate: newDate(2024, 3, 28, pdtLoc),
3636
// endDate: newDate(2024, 4, 2, pdtLoc),
3737
// },
38+
{
39+
id: "BBBmau",
40+
startDate: newDate(2024, 9, 26, pdtLoc),
41+
endDate: newDate(2024, 10, 2, pdtLoc),
42+
},
3843
{
3944
id: "hao-nan-li",
4045
startDate: newDate(2024, 9, 24, pdtLoc),
@@ -45,15 +50,10 @@ var (
4550
startDate: newDate(2024, 4, 30, pdtLoc),
4651
endDate: newDate(2024, 7, 31, pdtLoc),
4752
},
48-
{
49-
id: "SarahFrench",
50-
startDate: newDate(2024, 8, 2, bstLoc),
51-
endDate: newDate(2024, 8, 6, bstLoc),
52-
},
5353
{
5454
id: "shuyama1",
55-
startDate: newDate(2024, 5, 22, pdtLoc),
56-
endDate: newDate(2024, 5, 28, pdtLoc),
55+
startDate: newDate(2024, 9, 26, pdtLoc),
56+
endDate: newDate(2024, 10, 4, pdtLoc),
5757
},
5858
{
5959
id: "melinath",
@@ -95,5 +95,10 @@ var (
9595
startDate: newDate(2024, 9, 13, pdtLoc),
9696
endDate: newDate(2024, 9, 20, pdtLoc),
9797
},
98+
{
99+
id: "SarahFrench",
100+
startDate: newDate(2024, 9, 20, bstLoc),
101+
endDate: newDate(2024, 9, 23, bstLoc),
102+
},
98103
}
99104
)

GNUmakefile

+5
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@ tgc:
9595
bundle exec compiler -e terraform -f tgc -v beta -o $(OUTPUT_PATH)/tfplan2cai $(mmv1_compile);\
9696
bundle exec compiler -e terraform -f tgc_cai2hcl -v beta -o $(OUTPUT_PATH)/cai2hcl $(mmv1_compile);\
9797

98+
tgc-go:
99+
cd mmv1;\
100+
go run . --version beta --provider tgc --output $(OUTPUT_PATH)/tfplan2cai;\
101+
go run . --version beta --provider tgc_cai2hcl --output $(OUTPUT_PATH)/cai2hcl;\
102+
98103
tf-oics:
99104
cd mmv1;\
100105
bundle;\

docs/content/best-practices/_index.md

+6-5
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ When adding a new `labels` field, please make the changes below to support the n
6767
1. Use the type `KeyValueLabels` for the standard resource `labels` field. The standard resource `labels` field could be the top level `labels` field or the nested `labels` field inside the top level `metadata` field. Don't add `default_from_api: true` to this field or don't use this type for other `labels` fields in the resource. `KeyValueLabels` will add all of changes required for the new model automatically.
6868

6969
```yaml
70-
- !ruby/object:Api::Type::KeyValueLabels
71-
name: 'labels'
70+
- name: 'labels'
71+
type: KeyValueLabels
7272
description: |
7373
The labels associated with this dataset. You can use these to
7474
organize and group your datasets.
@@ -155,9 +155,10 @@ When adding a new `annotations` field, please make the changes below below to su
155155
1. Use the type `KeyValueAnnotations` for the standard resource `annotations` field. The standard resource `annotations` field could be the top level `annotations` field or the nested `annotations` field inside the top level `metadata` field. Don't add `default_from_api: true` to this field or don't use this type for other `annotations` fields in the resource. `KeyValueAnnotations` will add all of changes required for the new model automatically.
156156

157157
```yaml
158-
- !ruby/object:Api::Type::KeyValueAnnotations
159-
name: 'annotations'
160-
description: 'Client-specified annotations. This is distinct from labels.'
158+
- name: 'annotations'
159+
type: KeyValueAnnotations
160+
description: |
161+
Client-specified annotations. This is distinct from labels.
161162
```
162163
2. In the handwritten acceptance tests, add `annotations` to `ImportStateVerifyIgnore` if `annotations` field is in the configuration.
163164

docs/content/develop/add-handwritten-datasource.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ a new datasource there are 5 steps to doing so.
2424
1. Add Schema and Read operation implementation
2525
- If there is `labels` field with type `KeyValueLabels` in the corresponding resource, in the datasource Read operation implementation, after the resource read method, call the function `tpgresource.SetDataSourceLabels(d)` to make `labels` and `terraform_labels` have all of the labels on the resource.
2626
- If there is `annotations` field with type `KeyValueAnnotations` in the corresponding resource, in the datasource Read operation implementation, after the resource read method, call the function `tpgresource.SetDataSourceAnnotations(d)` to make `annotations` have all of the annotations on the resource.
27-
1. Register the datasource to `handwrittenDatasources` in [`magic-modules/mmv1/third_party/terraform/provider/provider_mmv1_resources.go.erb`](https://github.com/GoogleCloudPlatform/magic-modules/blob/main/mmv1/third_party/terraform/provider/provider_mmv1_resources.go.erb)
27+
1. Register the datasource to `handwrittenDatasources` in [`magic-modules/mmv1/third_party/terraform/provider/provider_mmv1_resources.go.tmpl`](https://github.com/GoogleCloudPlatform/magic-modules/blob/main/mmv1/third_party/terraform/provider/provider_mmv1_resources.go.tmpl)
2828
1. Implement a test which will create and resources and read the corresponding
2929
datasource
3030
1. [Add documentation](#add-documentation)

docs/content/develop/breaking-changes/make-a-breaking-change.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,11 @@ provider at runtime as well as in documentation.
9191
Set `deprecation_message` on the field. For example:
9292

9393
```yaml
94-
- !ruby/object:Api::Type::String
95-
name: 'apiFieldName'
94+
- name: 'apiFieldName'
95+
type: String
9696
description: |
9797
MULTILINE_FIELD_DESCRIPTION
98-
deprecation_message: "`api_field_name` is deprecated and will be removed in a future major release. Use `other_field_name` instead."
98+
deprecation_message: '`api_field_name` is deprecated and will be removed in a future major release. Use `other_field_name` instead.'
9999
```
100100
101101
Replace the second sentence with an appropriate short description of the replacement path and/or the reason for

docs/content/develop/client-side-fields.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ Instead of adding the field in `parameters` or `properties`, use a section calle
2121
Example:
2222
```yaml
2323
virtual_fields:
24-
- !ruby/object:Api::Type::Boolean
25-
name: 'deletion_protection'
24+
- name: 'deletion_protection'
25+
type: Boolean
2626
default_value: true
2727
description: |
2828
Whether Terraform will be prevented from destroying the CertificateAuthority.

0 commit comments

Comments
 (0)