From 06279ed2598818ad26c76c7524c77ea113ec551c Mon Sep 17 00:00:00 2001 From: Shalabh Chaturvedi Date: Tue, 10 Oct 2023 09:23:20 -0700 Subject: [PATCH 1/4] Allow a full deployment not called 'prod' --- src/deploy_pex.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/deploy_pex.py b/src/deploy_pex.py index 42c305a..b4a1d91 100755 --- a/src/deploy_pex.py +++ b/src/deploy_pex.py @@ -34,7 +34,7 @@ def main(): deployment_name = get_branch_deployment_name(project_dir) else: print("Going to do a full deployment.", flush=True) - deployment_name = None + deployment_name = os.getenv("DAGSTER_CLOUD_DEPLOYMENT", "prod") ubuntu_version = get_runner_ubuntu_version() print("Running on Ubuntu", ubuntu_version, flush=True) From 6d846b5de0087a187917d3510e2ed56784b1994b Mon Sep 17 00:00:00 2001 From: Shalabh Chaturvedi Date: Fri, 13 Oct 2023 10:41:32 -0700 Subject: [PATCH 2/4] Add deployment: input to pex deploy workflow --- actions/build_deploy_python_executable/action.yml | 4 ++++ src/deploy_pex.py | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/actions/build_deploy_python_executable/action.yml b/actions/build_deploy_python_executable/action.yml index 08d6720..8609412 100644 --- a/actions/build_deploy_python_executable/action.yml +++ b/actions/build_deploy_python_executable/action.yml @@ -8,6 +8,10 @@ inputs: description: 'Python version string, major.minor only, eg "3.8"' required: false default: '3.8' + deployment: + required: false + description: "The deployment to push to, defaults to 'prod'. Ignored for pull requests where the branch deployment is used." + default: "prod" deploy: description: 'Whether to upload the code files and update the code location' required: false diff --git a/src/deploy_pex.py b/src/deploy_pex.py index b4a1d91..4589dc2 100755 --- a/src/deploy_pex.py +++ b/src/deploy_pex.py @@ -34,7 +34,8 @@ def main(): deployment_name = get_branch_deployment_name(project_dir) else: print("Going to do a full deployment.", flush=True) - deployment_name = os.getenv("DAGSTER_CLOUD_DEPLOYMENT", "prod") + # INPUT_DEPLOYMENT is automatically set by github to the `deployment:` input value, if provided + deployment_name = os.getenv("INPUT_DEPLOYMENT", "prod") ubuntu_version = get_runner_ubuntu_version() print("Running on Ubuntu", ubuntu_version, flush=True) From d9993f7cc9879f38f29fd91bd1be8493eac5f263 Mon Sep 17 00:00:00 2001 From: Shalabh Chaturvedi Date: Fri, 13 Oct 2023 10:45:35 -0700 Subject: [PATCH 3/4] Better logs --- src/deploy_pex.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/deploy_pex.py b/src/deploy_pex.py index 4589dc2..c56d499 100755 --- a/src/deploy_pex.py +++ b/src/deploy_pex.py @@ -33,9 +33,9 @@ def main(): project_dir = os.path.dirname(dagster_cloud_yaml) deployment_name = get_branch_deployment_name(project_dir) else: - print("Going to do a full deployment.", flush=True) # INPUT_DEPLOYMENT is automatically set by github to the `deployment:` input value, if provided deployment_name = os.getenv("INPUT_DEPLOYMENT", "prod") + print(f"Deploying to a full deployment: {deployment_name}", flush=True) ubuntu_version = get_runner_ubuntu_version() print("Running on Ubuntu", ubuntu_version, flush=True) From 93f78e50107ea4a1212251caa402c75ad4fb114b Mon Sep 17 00:00:00 2001 From: Shalabh Chaturvedi Date: Fri, 13 Oct 2023 10:55:58 -0700 Subject: [PATCH 4/4] Pass through INPUT_DEPLOYMENT --- actions/build_deploy_python_executable/action.yml | 1 + src/deploy_pex.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/actions/build_deploy_python_executable/action.yml b/actions/build_deploy_python_executable/action.yml index 8609412..5fe8895 100644 --- a/actions/build_deploy_python_executable/action.yml +++ b/actions/build_deploy_python_executable/action.yml @@ -65,6 +65,7 @@ runs: - if: ${{ inputs.deploy == 'true' }} run: > cd $ACTION_REPO && + INPUT_DEPLOYMENT=${{ inputs.deployment }} /usr/bin/python src/deploy_pex.py ${{ inputs.dagster_cloud_file }} --python-version=${{ inputs.python_version }} diff --git a/src/deploy_pex.py b/src/deploy_pex.py index c56d499..207b424 100755 --- a/src/deploy_pex.py +++ b/src/deploy_pex.py @@ -33,7 +33,7 @@ def main(): project_dir = os.path.dirname(dagster_cloud_yaml) deployment_name = get_branch_deployment_name(project_dir) else: - # INPUT_DEPLOYMENT is automatically set by github to the `deployment:` input value, if provided + # INPUT_DEPLOYMENT is to the `deployment:` input value in action.yml deployment_name = os.getenv("INPUT_DEPLOYMENT", "prod") print(f"Deploying to a full deployment: {deployment_name}", flush=True)