Skip to content

Commit 8a31416

Browse files
Android Build Filesystem (ABFS) Teamsce-taid
authored andcommitted
feat: add CWS_custom_images defaults & refactor examples
PiperOrigin-RevId: 811798407
1 parent 04dba9c commit 8a31416

File tree

5 files changed

+301
-140
lines changed

5 files changed

+301
-140
lines changed

examples/simple/outputs.tf

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,24 @@ output "spanner_database_schema_creation" {
2626
value = var.abfs_spanner_database_create_tables ? (
2727
"# The abfs_spanner_database_create_tables variable was set to true; no further action required."
2828
) : (
29-
join(" ", [
30-
"gcloud --project ${data.google_project.project.project_id}",
31-
"spanner databases ddl update",
32-
"--instance ${module.abfs_server.abfs_spanner_instance.name}",
33-
"${module.abfs_server.abfs_spanner_database.name}",
34-
"--ddl-file ${module.abfs_server.abfs_spanner_database_schema_file}",
35-
])
29+
<<-EOT
30+
# Execute the following command to create the Spanner database schema:
31+
gcloud --project ${data.google_project.project.project_id} \
32+
spanner databases ddl update \
33+
--instance ${module.abfs_server.abfs_spanner_instance.name} \
34+
${module.abfs_server.abfs_spanner_database.name} \
35+
--ddl-file ${module.abfs_server.abfs_spanner_database_schema_file}
36+
EOT
3637
)
3738
}
39+
40+
output "webhook_setup_instructions" {
41+
description = "Instructions to set up the webhook trigger."
42+
value = var.create_cloud_workstation_resources ? module.cicd_foundation[0].webhook_setup_instructions : null
43+
sensitive = true
44+
}
45+
46+
output "webhook_setup_instructions_display" {
47+
description = "Instructions to set up the webhook trigger."
48+
value = var.create_cloud_workstation_resources ? module.cicd_foundation[0].webhook_setup_instructions_display : null
49+
}

examples/simple/services.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ module "project-services-cloud-resource-manager" {
1717
version = "18.0.0"
1818

1919
project_id = var.project_id
20+
enable_apis = var.enable_apis
2021
disable_services_on_destroy = false
2122
activate_apis = [
2223
"cloudresourcemanager.googleapis.com"
@@ -28,6 +29,7 @@ module "project-services" {
2829
version = "18.0.0"
2930

3031
project_id = var.project_id
32+
enable_apis = var.enable_apis
3133
disable_services_on_destroy = false
3234
activate_apis = [
3335
"compute.googleapis.com",

examples/simple/terraform.tfvars.example

Lines changed: 58 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,16 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
project_id = "YOUR_PROJECT_ID"
16-
region = "europe-west1"
17-
zone = "europe-west1-c"
15+
project_id = "YOUR_PROJECT_ID"
16+
region = "europe-west1"
17+
zone = "europe-west1-c"
18+
artifact_registry_region = "europe-west1"
19+
cloud_build_region = "europe-west1"
20+
secret_manager_region = "europe-west1"
21+
secure_source_manager_region = "europe-west4"
22+
23+
# If you don't need or want to enable APIs, set this to false.
24+
#enable_apis = false
1825

1926
# If you don't need private access to Artifact Registry, set this to false.
2027
#create_dns_zones = false
@@ -57,16 +64,16 @@ abfs_spanner_database_create_tables = true
5764

5865
create_cloud_workstation_resources = true
5966
cws_clusters = {
60-
"cws-abfs-cluster" = {
67+
"cws" = {
6168
network = "default"
6269
region = "europe-west1"
6370
subnetwork = "default"
6471
}
6572
}
6673
cws_configs = {
67-
"cws-abfs-config" = {
68-
cws_cluster = "cws-abfs-cluster"
69-
idle_timeout = 3600
74+
"cws-abfs" = {
75+
cws_cluster = "cws"
76+
idle_timeout_seconds = 3600
7077
machine_type = "e2-standard-8"
7178
boot_disk_size_gb = 64
7279
disable_public_ip_addresses = true
@@ -76,13 +83,19 @@ cws_configs = {
7683
persistent_disk_fs_type = "ext4"
7784
persistent_disk_type = "pd-ssd"
7885
persistent_disk_reclaim_policy = "RETAIN"
86+
custom_image_names = [
87+
"android-studio",
88+
"android-studio-for-platform",
89+
"code-oss",
90+
"repo-builder"
91+
]
7992
creators = [
8093
8194
]
8295
instances = [
8396
{
84-
name = "cws-abfs-instance"
85-
users = ["[email protected]"]
97+
name = "cws-abfs"
98+
# users = ["[email protected]"]
8699
}
87100
]
88101
}
@@ -91,10 +104,41 @@ cws_configs = {
91104
# Example for custom images for Cloud Workstations.
92105
# The key of the map is the name of the image to be built.
93106
cws_custom_images = {
94-
"asfp" = {
95-
# Optional: The region for the Cloud Scheduler job, defaults to the region of the Cloud Build trigger.
96-
scheduler_region = "europe-west1"
97-
# Optional: The schedule for the image rebuild, defaults to daily at 3 AM.
98-
ci_schedule = "0 3 * * *"
107+
"android-studio" : {
108+
build = {
109+
# Optional: The relative path to the Dockerfile within the repository.
110+
dockerfile_path = "examples/images/android/android-studio"
111+
# Optional: The timeout for the build in seconds, defaults to 7200.
112+
timeout_seconds = 7200
113+
# Optional: The machine type to use for the build, defaults to "UNSPECIFIED".
114+
machine_type = "E2_HIGHCPU_32"
115+
}
116+
#workstation_config = {
117+
# # Optional: The region for the Cloud Scheduler job, defaults to the region of the Cloud Build trigger.
118+
# scheduler_region = "europe-west1"
119+
# # Optional: The schedule for the image rebuild, defaults to daily at 3 AM.
120+
# ci_schedule = "0 3 * * *"
121+
#}
122+
},
123+
"android-studio-for-platform" = {
124+
build = {
125+
dockerfile_path = "examples/images/android-open-source-project/android-studio-for-platform"
126+
timeout_seconds = 7200
127+
machine_type = "E2_HIGHCPU_32"
128+
}
99129
}
130+
"code-oss" : {
131+
build = {
132+
dockerfile_path = "examples/images/android-open-source-project/code-oss"
133+
timeout_seconds = 7200
134+
machine_type = "E2_HIGHCPU_32"
135+
}
136+
},
137+
"repo-builder" : {
138+
build = {
139+
dockerfile_path = "examples/images/android-open-source-project/repo-builder"
140+
timeout_seconds = 7200
141+
machine_type = "E2_HIGHCPU_32"
142+
}
143+
},
100144
}

0 commit comments

Comments
 (0)