Skip to content

Commit 6e5cfb6

Browse files
authored
Merge branch 'main' into fix-max-pathlen
2 parents 73fad58 + 111bee7 commit 6e5cfb6

File tree

18 files changed

+246
-41
lines changed

18 files changed

+246
-41
lines changed

.github/.keep

Whitespace-only changes.

build/int.cloudbuild.yaml

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,27 +28,33 @@ steps:
2828
fi
2929
3030
git fetch --unshallow
31-
git diff origin/${_BASE_BRANCH} --name-only > _changed_files
32-
sed 's/\/.*/\//' _changed_files > _changed_folders
31+
git diff origin/main --name-only > _changed_files
32+
sed 's:[^/]*$::' _changed_files > _changed_folders
33+
sort -u -o _changed_folders{,}
34+
echo Folders with changes:
35+
cat _changed_folders
3336
3437
# Do not prune if changing tests themselves
35-
_INFRA_FOLDERS="build test .github"
36-
for d in _changed_folders; do
37-
if [[ "${_INFRA_FOLDERS}" =~ "$d" ]]; then
38-
echo "Infrastructure folders have changed; no tests will be pruned."
38+
while read d; do
39+
if [[ "build test .github" =~ "${d%/}" ]]; then
40+
echo "Infrastructure folder ${d%/} has changed; no tests will be pruned."
3941
exit 0 # do not prune
4042
fi
41-
done
43+
done < _changed_folders
4244
43-
for d in */; do
44-
if ! grep -q "^$d" _changed_folders && [[ "$d" != "test/" ]]; then
45-
rm -rf $d;
45+
# Remove leaf folders without changes or non-tf resources
46+
for d in `find . -type d -name 'test' -prune -o -links 2 -printf '%P\n'`; do
47+
if ! grep -q "^$d" _changed_folders && ! [ -n "$(find $d -maxdepth 1 -not -name '*.tf' -type f -print -quit)" ]; then
48+
rm -rf $d
4649
fi
4750
done
4851
52+
# Remove any empty folders
53+
find . -empty -type d -delete
54+
4955
# Report remaining folders
5056
echo Folders in scope for tests:
51-
for d in */; do echo $d; done
57+
find . -type d -printf '%P\n'
5258
5359
- id: prepare
5460
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'

composer/.keep

Whitespace-only changes.

compute/.keep

Whitespace-only changes.
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
/**
2+
* Copyright 2024 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
/**
18+
* Made to resemble:
19+
* gcloud alpha compute instance-groups managed create flex-igm --project=$PROJECT --region=us-central1 \
20+
* --target-distribution-shape=any-single-zone --instance-redistribution-type NONE \
21+
* --template example-template --size 3 \
22+
* --instance-selection "rank=1,name=best-choice,machine-type=n1-standard-1,n1-standard-2" \
23+
* --instance-selection "rank=2,name=still-ok,machine-type=n2-standard-1" \
24+
* --instance-selection "rank=3,name=if-nothing-else,machine-type=e2-standard-2"
25+
*/
26+
27+
28+
terraform {
29+
required_providers {
30+
google = {
31+
source = "hashicorp/google-beta"
32+
version = ">= 6.12.0"
33+
}
34+
}
35+
}
36+
37+
# [START compute_region_igm_instance_flexibility_policy_parent_tag]
38+
resource "google_compute_instance_template" "default" {
39+
name = "example-template"
40+
machine_type = "e2-medium"
41+
disk {
42+
source_image = "debian-cloud/debian-11"
43+
}
44+
network_interface {
45+
network = "default"
46+
}
47+
}
48+
49+
# [START compute_region_igm_instance_flexibility_policy]
50+
resource "google_compute_region_instance_group_manager" "default" {
51+
name = "flex-igm"
52+
base_instance_name = "tf-test-flex-igm"
53+
region = "us-central1"
54+
55+
target_size = 3
56+
distribution_policy_target_shape = "ANY_SINGLE_ZONE"
57+
58+
version {
59+
instance_template = google_compute_instance_template.default.id
60+
}
61+
62+
instance_flexibility_policy {
63+
instance_selections {
64+
name = "best-choice"
65+
rank = 1
66+
machine_types = ["n1-standard-1", "n1-standard-2"]
67+
}
68+
instance_selections {
69+
name = "still-ok"
70+
rank = 2
71+
machine_types = ["n2-standard-1"]
72+
}
73+
instance_selections {
74+
name = "if-nothing-else"
75+
rank = 3
76+
machine_types = ["e2-standard-2"]
77+
}
78+
}
79+
80+
update_policy {
81+
instance_redistribution_type = "NONE"
82+
type = "OPPORTUNISTIC"
83+
minimal_action = "REPLACE"
84+
max_surge_fixed = 0
85+
max_unavailable_fixed = 6
86+
}
87+
}
88+
# [END compute_region_igm_instance_flexibility_policy]
89+
# [END compute_region_igm_instance_flexibility_policy_parent_tag]

dns/.keep

Whitespace-only changes.

eventarc/.keep

Whitespace-only changes.

functions/.keep

Whitespace-only changes.

gke/standard/regional/labels/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# [START gke_standard_regional_labels_cluster]
1919
resource "google_container_cluster" "default" {
2020
name = "gke-standard-regional-labels"
21-
location = "us-west1"
21+
location = "us-central1"
2222
initial_node_count = 2
2323

2424
resource_labels = {
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/**
2+
* Copyright 2024 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
# [START integrationconnectors_endpoint_attachment_example]
18+
resource "google_integration_connectors_endpoint_attachment" "default" {
19+
name = "test-endpoint-attachment"
20+
location = "us-central1"
21+
description = "tf created description"
22+
service_attachment = "projects/connectors-example/regions/us-central1/serviceAttachments/test"
23+
labels = {
24+
foo = "bar"
25+
}
26+
}
27+
# [END integrationconnectors_endpoint_attachment_example]
28+

0 commit comments

Comments
 (0)