Skip to content

Commit 7b80beb

Browse files
committed
pass python version to pack
1 parent a30521a commit 7b80beb

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

run/django/e2e_test.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from collections.abc import Iterator
1919
import os
2020
import subprocess
21+
import sys
2122
import uuid
2223

2324
import backoff
@@ -27,6 +28,7 @@
2728
# Unique suffix to create distinct service names
2829
SUFFIX = uuid.uuid4().hex[:10]
2930

31+
PYTHON_VERSION = f"{sys.version_info.major}.{sys.version_info.minor}"
3032
SAMPLE_VERSION = os.environ.get("SAMPLE_VERSION", None)
3133
GOOGLE_CLOUD_PROJECT = os.environ["GOOGLE_CLOUD_PROJECT"]
3234
REGION = "us-central1"
@@ -89,6 +91,7 @@ def run_shell_cmd(args: list) -> subprocess.CompletedProcess:
8991
def deployed_service() -> str:
9092
substitutions = [
9193
f"_VERSION={SUFFIX},"
94+
f"_PYTHON_VERSION={PYTHON_VERSION},"
9295
f"_SERVICE={SERVICE},"
9396
f"_REGION={REGION},"
9497
f"_DB_PASS={POSTGRES_PASSWORD},"

run/django/e2e_test_setup.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ steps:
7070
7171
- id: "Build Container Image"
7272
name: gcr.io/k8s-skaffold/pack
73-
args: ["build", "${_IMAGE_NAME}", "--builder=gcr.io/buildpacks/builder"]
73+
args: ["build", "${_IMAGE_NAME}", "--builder=gcr.io/buildpacks/builder",
74+
"--env", "GOOGLE_PYTHON_VERSION=${_PYTHON_VERSION}"]
7475

7576
- id: "Push Container Image"
7677
name: "gcr.io/cloud-builders/docker"
@@ -134,6 +135,7 @@ options:
134135
substitutions:
135136
_SERVICE: django
136137
_VERSION: manual
138+
_PYTHON_VERSION: 3.12
137139
_REGION: us-central1
138140
_ARTIFACT_REGISTRY: cloud-run-source-deploy
139141
_IMAGE_NAME: ${_REGION}-docker.pkg.dev/${PROJECT_ID}/${_ARTIFACT_REGISTRY}/django-${_VERSION}

0 commit comments

Comments
 (0)