Skip to content

Commit a8486ba

Browse files
committed
fix(cloudrun): clean up before sharing for internal review
1 parent 48f54a7 commit a8486ba

File tree

2 files changed

+7
-14
lines changed

2 files changed

+7
-14
lines changed

run/service-auth/build_image.py

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@
44
import time
55

66
from google.cloud.devtools import cloudbuild_v1
7-
from google.cloud.devtools.cloudbuild_v1.types import Build, BuildStep, BuildOptions, Source, StorageSource
7+
from google.cloud.devtools.cloudbuild_v1.types import Build, BuildStep, Source, StorageSource
88
from google.cloud import storage
99

10-
# from google.api_core.exceptions import NotFound
11-
1210
from deploy import deploy_cloud_run_service
1311

1412
PROJECT_ID = os.environ["GOOGLE_CLOUD_PROJECT"]
@@ -76,9 +74,6 @@ def build_image_from_source(
7674
)
7775
],
7876
timeout={"seconds": 1200},
79-
options=BuildOptions(
80-
# Example: machine_type=BuildOptions.MachineType.E2_MEDIUM
81-
)
8277
)
8378

8479
print(f"Starting Cloud Build for image {full_image_uri}...")
@@ -123,13 +118,11 @@ def build_image_from_source(
123118
SOURCE_DIRECTORY = "./source/"
124119
GCS_BUILD_BUCKET = f"{PROJECT_ID}_cloudbuild_sources"
125120

126-
ENVIRONMENT_VARIABLES = {
127-
# "APP_MESSAGE": "Deployed from source via Python!",
128-
}
121+
ENVIRONMENT_VARIABLES = {}
129122

130123
built_image_uri = None
131124
try:
132-
print(f"--- Step 1: Building image for {SERVICE_NAME} from source {SOURCE_DIRECTORY} ---")
125+
print(f"Step 1: Building image for {SERVICE_NAME} from source {SOURCE_DIRECTORY}.")
133126
built_image_uri = build_image_from_source(
134127
project_id=PROJECT_ID,
135128
region=REGION,
@@ -139,7 +132,7 @@ def build_image_from_source(
139132
)
140133

141134
if built_image_uri:
142-
print(f"\n--- Step 2: Deploying image {built_image_uri} to Cloud Run service {SERVICE_NAME} ---")
135+
print(f"\nStep 2: Deploying image {built_image_uri} to Cloud Run service {SERVICE_NAME}.")
143136
deploy_cloud_run_service(
144137
project_id=PROJECT_ID,
145138
region=REGION,
@@ -148,11 +141,11 @@ def build_image_from_source(
148141
env_vars=ENVIRONMENT_VARIABLES,
149142
allow_unauthenticated=True,
150143
)
151-
print(f"\n--- Deployment process for {SERVICE_NAME} finished ---")
144+
print(f"\nDeployment process for {SERVICE_NAME} finished.")
152145
else:
153146
print(f"Image build failed for {SERVICE_NAME}. Deployment aborted.")
154147

155148
except Exception as e:
156149
print(f"An error occurred during the build or deployment process: {e}")
157150
import traceback
158-
traceback.print_exc()
151+
traceback.print_exc()

run/service-auth/deploy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def deploy_cloud_run_service(
8989
print(f"An error occurred during service deployment: {e}")
9090
raise
9191

92-
# --- Allow unauthenticated requests if requested ---
92+
# Allow unauthenticated requests if requested
9393
if deployed_service and allow_unauthenticated:
9494
try:
9595
print(f"Attempting to allow unauthenticated access for {service_name}...")

0 commit comments

Comments
 (0)