From 2de6020a27028735910b5fe250d5f1910e9cbdc5 Mon Sep 17 00:00:00 2001 From: Maxime Armstrong <46797220+maximearmstrong@users.noreply.github.com> Date: Tue, 28 May 2024 11:19:40 -0400 Subject: [PATCH] Add Python version env var for GitLab (#174) * Add Python version env var for GitLab * Update gitlab deploy.py * Add comments * Update comments * Update comments --- gitlab/dbt/serverless-ci-dbt.yml | 2 ++ gitlab/serverless-ci.yml | 2 ++ src/gitlab_action/deploy.py | 4 ++++ 3 files changed, 8 insertions(+) diff --git a/gitlab/dbt/serverless-ci-dbt.yml b/gitlab/dbt/serverless-ci-dbt.yml index cedc6601..a10f2a5a 100644 --- a/gitlab/dbt/serverless-ci-dbt.yml +++ b/gitlab/dbt/serverless-ci-dbt.yml @@ -5,6 +5,8 @@ variables: DAGSTER_DBT_PROJECT_NAME: $DAGSTER_DBT_LOCATION_NAME DAGSTER_DBT_PROJECT_DIR: "${CI_PROJECT_DIR}" DAGSTER_DBT_PACKAGE_DATA_DIR: "${CI_PROJECT_DIR}/$DAGSTER_DBT_PROJECT_NAME/dbt-project" + # Python versions 3.8 to 3.11 are supported + PYTHON_VERSION: '3.8' deploy-branch: stage: deploy diff --git a/gitlab/serverless-ci.yml b/gitlab/serverless-ci.yml index 1a74fddc..ee49d856 100644 --- a/gitlab/serverless-ci.yml +++ b/gitlab/serverless-ci.yml @@ -2,6 +2,8 @@ variables: DISABLE_FAST_DEPLOYS: DAGSTER_CLOUD_URL: $DAGSTER_CLOUD_URL DAGSTER_CLOUD_API_TOKEN: $DAGSTER_CLOUD_API_TOKEN + # Python versions 3.8 to 3.11 are supported + PYTHON_VERSION: '3.8' deploy-branch: stage: deploy diff --git a/src/gitlab_action/deploy.py b/src/gitlab_action/deploy.py index 8b869252..887e87c0 100755 --- a/src/gitlab_action/deploy.py +++ b/src/gitlab_action/deploy.py @@ -8,6 +8,9 @@ def deploy(dagster_cloud_yaml_file, deployment=None): + # Use 3.8 as default version for backward compatibility + python_version = os.getenv("PYTHON_VERSION", "3.8") + url = os.environ["DAGSTER_CLOUD_URL"] if not os.getenv("SERVERLESS_BASE_IMAGE_PREFIX"): base_image_prefix = "657821118200.dkr.ecr.us-west-2.amazonaws.com/dagster-cloud-serverless-base-" @@ -39,6 +42,7 @@ def deploy(dagster_cloud_yaml_file, deployment=None): f"--deps-cache-to={deps_cache}", f"--commit-hash={commit}", f"--git-url={commit_url}", + f"--python-version={python_version}", ] if deployment: command_args.append(f"--url={url}/{deployment}")