Skip to content

Commit 38662dd

Browse files
authored
new init action that uses dg plus deploy and does not require a dagster_cloud.yaml (#221)
Summary: For now uses dagster-cloud ci for other steps since those work out of the box and do not yet have dg equivalents. This should allow us to deploy to dagster+ without requiring a scaffolded dagster_cloud.yaml file.
1 parent 5492897 commit 38662dd

File tree

2 files changed

+62
-0
lines changed

2 files changed

+62
-0
lines changed

actions/utils/dg-cli/action.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: "dg cli <command>"
2+
description: "Run a dg cli command"
3+
inputs:
4+
command:
5+
required: true
6+
description: "The dg cli command to run"
7+
8+
runs:
9+
using: "composite"
10+
steps:
11+
- id: dg-cli
12+
run: $GITHUB_ACTION_PATH/../../../generated/gha/dagster-cloud.pex -m dagster_dg.cli.entrypoint ${{ inputs.command }}
13+
shell: bash
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: "Initialize Deploy Session"
2+
description: "Initialize a new deploy session to Dagster+"
3+
inputs:
4+
project_dir:
5+
required: true
6+
description: "The root directory of the dg project or workspace."
7+
deployment:
8+
required: false
9+
description: "The deployment name to deploy. For pull requests, this deployment will be used as the base deployment."
10+
default: "prod"
11+
location_names:
12+
required: false
13+
description: "JSON list containing names of locations to deploy. If unspecified, all locations are deployed."
14+
15+
runs:
16+
using: "composite"
17+
steps:
18+
- name: init-env-vars
19+
run: >
20+
echo "DAGSTER_CLOUD_PEX=$GITHUB_ACTION_PATH/../../../generated/gha/dagster-cloud.pex" >> $GITHUB_ENV &&
21+
echo "DAGSTER_BUILD_STATEDIR=/tmp/statedir-$GITHUB_RUN_ID" >> $GITHUB_ENV
22+
shell: bash
23+
24+
- name: set-location-names
25+
if: ${{ inputs.location_names }}
26+
run: echo ${{ format('LOCATION_NAMES_FLAG=--location-name={0}', join(fromJSON(inputs.location_names), ' --location-name=')) }} >> $GITHUB_ENV
27+
shell: bash
28+
29+
# Initialize the deploy session
30+
- id: start-deploy-session
31+
run: >
32+
$DAGSTER_CLOUD_PEX -m dagster_dg.cli.entrypoint plus deploy start
33+
--path=${{ inputs.project_dir }}
34+
--deployment=${{ inputs.deployment }}
35+
--status-url=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
36+
--git-url=${{ github.server_url }}/${{ github.repository }}/tree/${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
37+
--commit-hash=${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
38+
--yes
39+
$LOCATION_NAMES_FLAG
40+
shell: bash
41+
42+
- id: ci-status
43+
run: $DAGSTER_CLOUD_PEX -m dagster_cloud_cli.entrypoint ci status
44+
shell: bash
45+
46+
# Create a PR comment if necessary
47+
- id: ci-notify
48+
run: $DAGSTER_CLOUD_PEX -m dagster_cloud_cli.entrypoint ci notify --project-dir=${{ inputs.project_dir }}
49+
shell: bash

0 commit comments

Comments
 (0)