Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
91bba2d
add a --wait flag
cnolanminich Aug 11, 2025
674e513
add debugging
cnolanminich Aug 12, 2025
8947606
Add optional wait parameter to job launch action
cnolanminich Aug 12, 2025
59375e8
Fix action.yml arguments for utils/run action
cnolanminich Aug 12, 2025
3f3e020
Revert "Fix action.yml arguments for utils/run action"
cnolanminich Aug 12, 2025
f8e2e06
Revert "Add optional wait parameter to job launch action"
cnolanminich Aug 12, 2025
f6a4feb
Revert "add debugging"
cnolanminich Aug 12, 2025
74c55e5
use release branch
cnolanminich Aug 12, 2025
19e9cbf
update script to accept add-wait-param as rc name
cnolanminich Aug 12, 2025
6f75181
update .gitignore
cnolanminich Aug 12, 2025
b7336ca
use add-wait-param package
cnolanminich Aug 12, 2025
79c1d4c
use linux/amd64
cnolanminich Aug 12, 2025
6729339
Update release.py
cnolanminich Aug 12, 2025
17e8161
Fix run ID extraction when using --wait flag
cnolanminich Aug 12, 2025
5da64d1
work with multiple lines in stdout
cnolanminich Aug 12, 2025
5a622bd
Add comprehensive tests for wait parameter functionality
cnolanminich Aug 12, 2025
d35369c
Fix regex patterns for run ID extraction to handle test data
cnolanminich Aug 12, 2025
10c08c5
clean up debugging and remove tests
cnolanminich Aug 12, 2025
1a2afc6
Remove generated dagster-cloud.pex file
cnolanminich Aug 12, 2025
15b168b
Create dagster-cloud.pex
cnolanminich Aug 12, 2025
4bf9945
remove references to add-wait-param branch
cnolanminich Aug 13, 2025
173d0ff
fix more references
cnolanminich Aug 13, 2025
3f3b958
add interval flag to github action if wait is enabled
cnolanminich Aug 13, 2025
156ed73
stream output of dagster-cloud job launch
cnolanminich Aug 13, 2025
cdc0431
use add-wait-param for rc
cnolanminich Aug 15, 2025
f93ac54
update wait behavior
cnolanminich Aug 15, 2025
32186bd
use tee piped output again
cnolanminich Aug 15, 2025
e0a8699
change streaming strategy
cnolanminich Aug 15, 2025
99d4382
remove streaming behavior
cnolanminich Aug 18, 2025
412dabc
remove streaming behavior
cnolanminich Aug 18, 2025
61f351b
Update dagster-cloud.pex
cnolanminich Aug 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ src/pex-builder/build
wheels/*whl

# PyCharm IDE Config files
.idea/
.idea/
.env
9 changes: 9 additions & 0 deletions actions/launch_job/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ inputs:
job_name:
required: true
description: "The name of the job to launch."
wait:
required: false
default: "false"
description: "Whether to wait for the job to complete before exiting. When true, the action will wait for the run to finish and fail if the run fails."
interval:
required: false
description: "Interval in seconds between status checks when waiting for job completion. Can only be used when wait is true."
runs:
using: "composite"
steps:
Expand Down Expand Up @@ -53,5 +60,7 @@ runs:
location_name: ${{ inputs.location_name }}
repository_name: ${{ inputs.repository_name }}
job_name: ${{ inputs.job_name }}
wait: ${{ inputs.wait }}
interval: ${{ inputs.interval }}
env:
DAGSTER_CLOUD_API_TOKEN: ${{ inputs.dagster_cloud_api_token }}
2 changes: 1 addition & 1 deletion actions/utils/copy_template/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ inputs:
description: "A string of the base image name for the deployed code location image."
runs:
using: "docker"
image: "docker://ghcr.io/dagster-io/dagster-cloud-action:dev"
image: "docker://ghcr.io/dagster-io/dagster-cloud-action:add-wait-param"
entrypoint: "/copy_template.sh"
2 changes: 1 addition & 1 deletion actions/utils/deploy/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ outputs:
description: "The Cloud deployment associated with this branch."
runs:
using: "docker"
image: "docker://ghcr.io/dagster-io/dagster-cloud-action:dev"
image: "docker://ghcr.io/dagster-io/dagster-cloud-action:add-wait-param"
entrypoint: "/deploy.sh"
args:
- ${{ inputs.pr }}
2 changes: 1 addition & 1 deletion actions/utils/get_branch_deployment/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ outputs:
description: "The Cloud deployment associated with this branch."
runs:
using: "docker"
image: "docker://ghcr.io/dagster-io/dagster-cloud-action:dev"
image: "docker://ghcr.io/dagster-io/dagster-cloud-action:add-wait-param"
entrypoint: "/get_branch_deployment.sh"
2 changes: 1 addition & 1 deletion actions/utils/notify/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ inputs:

runs:
using: "docker"
image: "docker://ghcr.io/dagster-io/dagster-cloud-action:dev"
image: "docker://ghcr.io/dagster-io/dagster-cloud-action:add-wait-param"
entrypoint: "/notify.sh"
args:
- ${{ inputs.pr }}
2 changes: 1 addition & 1 deletion actions/utils/registry_info/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ inputs:
description: "Alternative to providing organization ID. The URL of your Dagster Cloud organization."
runs:
using: "docker"
image: "docker://ghcr.io/dagster-io/dagster-cloud-action:dev"
image: "docker://ghcr.io/dagster-io/dagster-cloud-action:add-wait-param"
entrypoint: "/registry_info.sh"
9 changes: 8 additions & 1 deletion actions/utils/run/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ inputs:
required: false
description: "A JSON dict of config to apply to the run, input as a string."
default: "{}"
wait:
required: false
default: "false"
description: "Whether to wait for the job to complete before exiting. When true, the action will wait for the run to finish and fail if the run fails."
interval:
required: false
description: "Interval in seconds between status checks when waiting for job completion. Can only be used when wait is true."
dagster_cloud_url:
required: false
description: "Alternative to providing organization ID. The URL of your Dagster Cloud organization."
Expand All @@ -35,7 +42,7 @@ outputs:
description: "The ID of the launched run."
runs:
using: "docker"
image: "docker://ghcr.io/dagster-io/dagster-cloud-action:dev"
image: "docker://ghcr.io/dagster-io/dagster-cloud-action:add-wait-param"
entrypoint: "/run.sh"
args:
- ${{ inputs.pr }}
Binary file modified generated/gha/dagster-cloud.pex
Binary file not shown.
6 changes: 3 additions & 3 deletions gitlab/dbt/serverless-ci-dbt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ deploy-branch:
stage: deploy
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
image: ghcr.io/dagster-io/dagster-cloud-action:dev
image: ghcr.io/dagster-io/dagster-cloud-action:add-wait-param
script:
# first create the branch deployment
- export PR_TIMESTAMP=$(git log -1 --format='%cd' --date=unix)
Expand Down Expand Up @@ -51,7 +51,7 @@ deploy-branch:

close_branch:
stage: deploy
image: ghcr.io/dagster-io/dagster-cloud-action:dev
image: ghcr.io/dagster-io/dagster-cloud-action:add-wait-param
when: manual
only:
- merge_requests
Expand All @@ -76,7 +76,7 @@ deploy:
stage: deploy
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
image: ghcr.io/dagster-io/dagster-cloud-action:dev
image: ghcr.io/dagster-io/dagster-cloud-action:add-wait-param
script:
# install dbt package
- pip install pip --upgrade
Expand Down
8 changes: 4 additions & 4 deletions gitlab/hybrid-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ workflow:

initialize:
stage: setup
image: ghcr.io/dagster-io/dagster-cloud-action:dev
image: ghcr.io/dagster-io/dagster-cloud-action:add-wait-param
script:
- export
- dagster-cloud ci check --project-dir=$DAGSTER_PROJECT_DIR --dagster-cloud-yaml-path=$DAGSTER_CLOUD_YAML_PATH
Expand Down Expand Up @@ -75,7 +75,7 @@ deploy-docker:
dependencies:
- build-image
- initialize
image: ghcr.io/dagster-io/dagster-cloud-action:dev
image: ghcr.io/dagster-io/dagster-cloud-action:add-wait-param
script:
- dagster-cloud ci set-build-output --image-tag=$IMAGE_TAG
- dagster-cloud ci deploy
Expand All @@ -87,7 +87,7 @@ deploy-docker-branch:
dependencies:
- build-image
- initialize
image: ghcr.io/dagster-io/dagster-cloud-action:dev
image: ghcr.io/dagster-io/dagster-cloud-action:add-wait-param
script:
- dagster-cloud ci set-build-output --image-tag=$IMAGE_TAG
- dagster-cloud ci deploy
Expand All @@ -97,7 +97,7 @@ deploy-docker-branch:

close-branch:
stage: deploy
image: ghcr.io/dagster-io/dagster-cloud-action:dev
image: ghcr.io/dagster-io/dagster-cloud-action:add-wait-param
when: manual
only:
- merge_requests
Expand Down
6 changes: 3 additions & 3 deletions gitlab/serverless-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ deploy-branch:
stage: deploy
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
image: ghcr.io/dagster-io/dagster-cloud-action:dev
image: ghcr.io/dagster-io/dagster-cloud-action:add-wait-param
script:
# first create the branch deployment
- export PR_TIMESTAMP=$(git log -1 --format='%cd' --date=unix)
Expand Down Expand Up @@ -37,7 +37,7 @@ deploy-branch:

close_branch:
stage: deploy
image: ghcr.io/dagster-io/dagster-cloud-action:dev
image: ghcr.io/dagster-io/dagster-cloud-action:add-wait-param
when: manual
only:
- merge_requests
Expand All @@ -62,6 +62,6 @@ deploy:
stage: deploy
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
image: ghcr.io/dagster-io/dagster-cloud-action:dev
image: ghcr.io/dagster-io/dagster-cloud-action:add-wait-param
script:
- /gitlab_action/deploy.py ./dagster_cloud.yaml
10 changes: 5 additions & 5 deletions gitlab/serverless-legacy-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ workflow:

parse-workspace:
stage: setup
image: ghcr.io/dagster-io/dagster-cloud-action:dev
image: ghcr.io/dagster-io/dagster-cloud-action:add-wait-param
script:
- python /gitlab_action/parse_workspace.py dagster_cloud.yaml >> build.env
- cp /Dockerfile.template .
Expand All @@ -23,7 +23,7 @@ parse-workspace:

fetch-registry-info:
stage: setup
image: ghcr.io/dagster-io/dagster-cloud-action:dev
image: ghcr.io/dagster-io/dagster-cloud-action:add-wait-param
script: dagster-cloud serverless registry-info --url $DAGSTER_CLOUD_URL/prod --api-token $DAGSTER_CLOUD_API_TOKEN | grep '=' >> registry.env
artifacts:
reports:
Expand Down Expand Up @@ -53,7 +53,7 @@ deploy-docker:
- build-image
- parse-workspace
- fetch-registry-info
image: ghcr.io/dagster-io/dagster-cloud-action:dev
image: ghcr.io/dagster-io/dagster-cloud-action:add-wait-param
script:
- dagster-cloud workspace add-location
--url $DAGSTER_CLOUD_URL/prod
Expand All @@ -74,7 +74,7 @@ deploy-docker-branch:
- build-image
- parse-workspace
- fetch-registry-info
image: ghcr.io/dagster-io/dagster-cloud-action:dev
image: ghcr.io/dagster-io/dagster-cloud-action:add-wait-param
script:
- export PR_TIMESTAMP=$(git log -1 --format='%cd' --date=unix)
- export PR_MESSAGE=$(git log -1 --format='%s')
Expand Down Expand Up @@ -109,7 +109,7 @@ deploy-docker-branch:

close_branch:
stage: deploy
image: ghcr.io/dagster-io/dagster-cloud-action:dev
image: ghcr.io/dagster-io/dagster-cloud-action:add-wait-param
when: manual
only:
- merge_requests
Expand Down
5 changes: 3 additions & 2 deletions scripts/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def build_docker_action(version_tag: str, publish_docker_action: bool = True):
".",
"-f",
"src/Dockerfile",
"--platform=linux/amd64",
"-t",
image_name,
],
Expand Down Expand Up @@ -201,7 +202,7 @@ def update_docker_action_references(
glob_patterns: List[str] = ["**/*yaml", "**/*yml"],
):
image_name = get_docker_action_image_name(version_tag)
previous_image_name = get_docker_action_image_name("dev")
previous_image_name = get_docker_action_image_name("add-wait-param")
info(f"Updating references from {previous_image_name} to {image_name}")
with chdir("."):
for pattern in glob_patterns:
Expand All @@ -228,7 +229,7 @@ def create_rc(
branch = ensure_in_branch()
info(f"Preparing a new RC in {branch}")

if version_tag != "dev" and not re.match(r"^[0-9.]+$", version_tag):
if version_tag != "add-wait-param" and not re.match(r"^[0-9.]+$", version_tag):
error(f"Invalid version tag {version_tag}")
sys.exit(1)

Expand Down
84 changes: 72 additions & 12 deletions src/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,80 @@ if [ -z $DAGSTER_CLOUD_URL ]; then
fi
fi

RUN_ID=$(
dagster-cloud job launch \
--url "${DAGSTER_CLOUD_URL}" \
--deployment "${INPUT_DEPLOYMENT}" \
--api-token "$DAGSTER_CLOUD_API_TOKEN" \
--location "${INPUT_LOCATION_NAME}" \
--repository "${INPUT_REPOSITORY_NAME}" \
--job "${INPUT_JOB_NAME}" \
--tags "${INPUT_TAGS_JSON}" \
--config-json "${INPUT_CONFIG_JSON}"
# Check for wait flag - handle various true values
wait_flag=""
interval_flag=""
case "$(echo "${INPUT_WAIT}" | tr '[:upper:]' '[:lower:]')" in
"true"|"1"|"yes"|"on")
wait_flag="--wait"
# Only add interval flag if wait is enabled and interval is provided
if [ -n "${INPUT_INTERVAL}" ]; then
interval_flag="--interval ${INPUT_INTERVAL}"
fi
;;
*)
# Validate that interval is not used without wait
if [ -n "${INPUT_INTERVAL}" ]; then
echo "ERROR: interval parameter can only be used when wait is true"
exit 1
fi
;;
esac

echo "Launching dagster-cloud job..."

# Build the command args array to handle empty flags properly
cmd_args=(
"dagster-cloud" "job" "launch"
"--url" "${DAGSTER_CLOUD_URL}"
"--deployment" "${INPUT_DEPLOYMENT}"
"--api-token" "$DAGSTER_CLOUD_API_TOKEN"
"--location" "${INPUT_LOCATION_NAME}"
"--repository" "${INPUT_REPOSITORY_NAME}"
"--job" "${INPUT_JOB_NAME}"
"--tags" "${INPUT_TAGS_JSON}"
"--config-json" "${INPUT_CONFIG_JSON}"
)

if [ -z $RUN_ID ]; then
echo "Failed to launch run"
# Add wait flag if set
if [ -n "${wait_flag}" ]; then
cmd_args+=("${wait_flag}")
fi

# Add interval flag if set
if [ -n "${interval_flag}" ]; then
cmd_args+=(${interval_flag}) # This will split --interval and the value
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a potential issue with how the interval flag is being added to the command arguments array. The unquoted ${interval_flag} will undergo word splitting by the shell, which could cause problems if the interval value contains spaces or special characters.

Consider either:

  1. Keeping it quoted to preserve it as a single element:

    cmd_args+=("${interval_flag}")
  2. Or if the intention is to split --interval and its value into separate array elements, explicitly handle that:

    if [ -n "${INPUT_INTERVAL}" ]; then
        cmd_args+=("--interval" "${INPUT_INTERVAL}")
    fi

The second approach is likely more robust for command-line argument handling.

Suggested change
cmd_args+=(${interval_flag}) # This will split --interval and the value
if [ -n "${INPUT_INTERVAL}" ]; then
cmd_args+=("--interval" "${INPUT_INTERVAL}")
fi

Spotted by Diamond

Is this helpful? React 👍 or 👎 to let us know.

fi

# Run the command directly - this will naturally block if --wait is used
COMMAND_OUTPUT=$("${cmd_args[@]}" 2>&1)
DAGSTER_EXIT_CODE=$?

# Display the output after command completion
echo "$COMMAND_OUTPUT"

# Check if the command failed
if [ $DAGSTER_EXIT_CODE -ne 0 ]; then
echo "ERROR: dagster-cloud job launch failed with exit code $DAGSTER_EXIT_CODE"
exit $DAGSTER_EXIT_CODE
fi

# Extract run ID from the output
# Look for patterns like "Run <run-id> is in progress" or "Run <run-id> finished"
RUN_ID=""
if [[ "$COMMAND_OUTPUT" =~ Run\ ([a-f0-9-]+) ]]; then
RUN_ID="${BASH_REMATCH[1]}"
else
# Try to get the first line if it looks like a run ID (for non-wait mode)
FIRST_LINE=$(echo "$COMMAND_OUTPUT" | head -n1 | tr -d '\n\r')
if [[ "$FIRST_LINE" =~ ^[a-zA-Z0-9-]+$ ]]; then
RUN_ID="$FIRST_LINE"
fi
fi

if [ -z "$RUN_ID" ]; then
echo "Failed to launch run or extract run ID"
echo "Command output was: $COMMAND_OUTPUT"
exit 1
else
echo "Successfully launched run: ${RUN_ID}"
Expand Down
Loading
Loading