From adcafbae22abfc09b7907df809167a901408e0ec Mon Sep 17 00:00:00 2001 From: Jeffrey Aven Date: Thu, 17 Sep 2026 10:36:09 +1000 Subject: [PATCH] doc updates --- .../workflows/stackql-deploy-actions-test.yml | 12 +-- .gitignore | 3 +- README.md | 2 + docs/OUTPUTS.md | 97 +++++++++++++++++++ 4 files changed, 107 insertions(+), 7 deletions(-) diff --git a/.github/workflows/stackql-deploy-actions-test.yml b/.github/workflows/stackql-deploy-actions-test.yml index f1b708c..414b175 100644 --- a/.github/workflows/stackql-deploy-actions-test.yml +++ b/.github/workflows/stackql-deploy-actions-test.yml @@ -17,7 +17,7 @@ jobs: AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} AWS_SESSION_TOKEN: ${{ secrets.AWS_SESSION_TOKEN }} steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@v7 - name: Deploy SSM Parameter uses: ./ with: @@ -76,7 +76,7 @@ jobs: AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} AWS_SESSION_TOKEN: ${{ secrets.AWS_SESSION_TOKEN }} steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@v7 # Uses a `|` block scalar with AWS_REGION on a non-first line so leading-whitespace # on continuation entries would break the required var if the parser didn't trim. # UNUSED_* pairs are noise entries the stack does not consume; their presence validates @@ -125,7 +125,7 @@ jobs: AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} AWS_SESSION_TOKEN: ${{ secrets.AWS_SESSION_TOKEN }} steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@v7 - name: Deploy SSM Parameter uses: ./ with: @@ -184,7 +184,7 @@ jobs: AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} AWS_SESSION_TOKEN: ${{ secrets.AWS_SESSION_TOKEN }} steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@v7 - name: Deploy SSM Parameter uses: ./ with: @@ -243,7 +243,7 @@ jobs: AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} AWS_SESSION_TOKEN: ${{ secrets.AWS_SESSION_TOKEN }} steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@v7 - name: Deploy SSM Parameter uses: ./ with: @@ -302,7 +302,7 @@ jobs: AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} AWS_SESSION_TOKEN: ${{ secrets.AWS_SESSION_TOKEN }} steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@v7 - name: Deploy SSM Parameter uses: ./ with: diff --git a/.gitignore b/.gitignore index d124f27..cf57a92 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ stackql* .stackql/ .env -.claude \ No newline at end of file +.claude +/tmp \ No newline at end of file diff --git a/README.md b/README.md index 2c69167..4319ef6 100644 --- a/README.md +++ b/README.md @@ -121,6 +121,8 @@ jobs: run: echo "Workspace is running, proceeding with next steps..." ``` +for a complete workflow that also uploads the output file as an artifact and consumes it from a separate job, see [docs/OUTPUTS.md](docs/OUTPUTS.md). + ### Test a stack this example shows how to test stack for a given environment: diff --git a/docs/OUTPUTS.md b/docs/OUTPUTS.md index ed664fd..81c3a8a 100644 --- a/docs/OUTPUTS.md +++ b/docs/OUTPUTS.md @@ -115,6 +115,103 @@ jobs: echo "Data from deploy job: ${{ needs.deploy.outputs.deployment_data }}" ``` +### Complete Workflow Example + +The following workflow brings the patterns above together. The `deploy` job deploys a stack, prints the outputs, parses individual values with `jq`, writes a table to the step summary, gates a follow-up step on an output value, and uploads the output file as a workflow artifact. A second `post-deploy` job downloads the artifact and reads the file directly. + +The JSON is passed to the shell through a step-level `env` variable rather than interpolated with `${{ }}` inside the script, so quotes in output values do not break the command. + +```yaml +name: StackQL Deploy with Outputs + +on: + push: + branches: [main] + workflow_dispatch: + +jobs: + deploy: + runs-on: ubuntu-latest + env: + GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CREDENTIALS }} # add additional cloud provider creds here as needed + + steps: + - name: Checkout + uses: actions/checkout@v7 + + - name: Deploy with StackQL + id: stackql-deploy + uses: stackql/stackql-deploy-action@v2 + with: + command: 'build' + stack_dir: './my-stack' + stack_env: 'prod' + output_file: 'deployment-outputs.json' + env_vars: | + PROJECT_ID=${{ secrets.GOOGLE_PROJECT_ID }} + REGION=us-central1 + + - name: Display deployment outputs + env: + DEPLOYMENT_OUTPUTS: ${{ steps.stackql-deploy.outputs.deployment_outputs }} + run: | + echo "Deployment completed successfully!" + echo "Raw outputs: $DEPLOYMENT_OUTPUTS" + + - name: Parse specific output values + env: + DEPLOYMENT_OUTPUTS: ${{ steps.stackql-deploy.outputs.deployment_outputs }} + run: | + WORKSPACE_NAME=$(echo "$DEPLOYMENT_OUTPUTS" | jq -r '.databricks_workspace_name // "N/A"') + WORKSPACE_ID=$(echo "$DEPLOYMENT_OUTPUTS" | jq -r '.databricks_workspace_id // "N/A"') + WORKSPACE_STATUS=$(echo "$DEPLOYMENT_OUTPUTS" | jq -r '.databricks_workspace_status // "N/A"') + + echo "Workspace Name: $WORKSPACE_NAME" + echo "Workspace ID: $WORKSPACE_ID" + echo "Workspace Status: $WORKSPACE_STATUS" + + # Add to GitHub Step Summary + echo "## Deployment Results" >> $GITHUB_STEP_SUMMARY + echo "| Property | Value |" >> $GITHUB_STEP_SUMMARY + echo "|----------|-------|" >> $GITHUB_STEP_SUMMARY + echo "| Workspace Name | $WORKSPACE_NAME |" >> $GITHUB_STEP_SUMMARY + echo "| Workspace ID | $WORKSPACE_ID |" >> $GITHUB_STEP_SUMMARY + echo "| Workspace Status | $WORKSPACE_STATUS |" >> $GITHUB_STEP_SUMMARY + + - name: Use outputs in another step + if: contains(steps.stackql-deploy.outputs.deployment_outputs, 'RUNNING') + run: | + echo "Workspace is running, proceeding with post-deployment tasks..." + # Add your post-deployment logic here + + - name: Upload deployment outputs as artifact + uses: actions/upload-artifact@v4 + with: + name: deployment-outputs + path: deployment-outputs.json # same value as output_file above + retention-days: 30 + + post-deploy: + needs: deploy + runs-on: ubuntu-latest + if: success() + steps: + - name: Download deployment outputs + uses: actions/download-artifact@v4 + with: + name: deployment-outputs + + - name: Process outputs in separate job + run: | + echo "Processing deployment outputs in a separate job..." + if [ -f "deployment-outputs.json" ]; then + cat deployment-outputs.json + # Process the outputs as needed + fi +``` + +Uploading the file as an artifact is an alternative to declaring job outputs (see [Sharing Outputs Between Jobs](#sharing-outputs-between-jobs)). The artifact remains downloadable after the run finishes and is not subject to the size limit on job outputs. + ## Features - **Automatic Summary**: When an output file is specified, the action automatically adds the JSON output to the GitHub Step Summary