Skip to content
Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

StackQL Deploy Actions TestStackQL

stackql-deploy

Github Action to execute stackql-deploy to deploy or test a stack. stackql-deploy is a declarative, state-file-less IaC framework, based upon stackql queries.

Usage

Provider Authentication

Authentication to StackQL providers is done via environment variables source from GitHub Actions Secrets. To learn more about authentication, see the setup instructions for your provider or providers at the StackQL Provider Registry Docs.

Inputs

  • command - stackql-deploy command to run (build or test)
  • stack_dir - repo directory containing stackql_manifest.yml and resources dir
  • stack_env - environment to deploy or test (e.g., dev, prod)
  • env_vars - (optional) environment variables or secrets imported into a stack. Accepts a comma-separated string (KEY=value,KEY2=value2) or a newline-separated YAML block scalar (see the multi-line example below)
  • env_file - (optional) environment variables sourced from a file
  • show_queries - (optional) show queries run in the output logs
  • log_level - (optional) set the logging level (INFO or DEBUG, defaults to INFO)
  • dry_run - (optional) perform a dry run of the operation
  • custom_registry - (optional) custom registry URL to be used for stackql
  • on_failure - (optional) action on failure (not implemented yet)
  • output_file - (optional) output file to capture deployment outputs (JSON format)

Outputs

  • deployment_outputs - JSON string containing all deployment outputs from stackql-deploy
  • deployment_outputs_file - Path to the deployment outputs file

Examples

Deploy a stack

this example shows how to build a stack (examples/k8s-the-hard-way) for a dev environment:

...
jobs:
stackql-actions-test:
name: StackQL Actions Testruns-on: ubuntu-latestenv:
GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CREDENTIALS }} # add additional cloud provider creds here as neededsteps:
- name: Checkoutuses: actions/checkout@v6
- name: Deploy a Stackuses: stackql/stackql-deploy-action@v2with:
command: 'build'stack_dir: 'examples/k8s-the-hard-way'stack_env: 'dev'env_vars: 'GOOGLE_PROJECT=stackql-k8s-the-hard-way-demo'

Deploy a stack with many env vars (multi-line form)

for stacks that consume many environment variables, env_vars also accepts a newline-separated block scalar (|). this is easier to read and review than a single comma-separated line:

...
- name: Deploy Workspaceuses: stackql/stackql-deploy-action@v2with:
command: 'build'stack_dir: 'infrastructure'stack_env: 'dev'env_vars: | AWS_REGION=ap-southeast-2 DATABRICKS_ACCOUNT_ID=${{ env.DATABRICKS_ACCOUNT_ID }} DATABRICKS_AWS_ACCOUNT_ID=${{ env.DATABRICKS_AWS_ACCOUNT_ID }} AWS_ACCOUNT_ID=${{ env.AWS_ACCOUNT_ID }} GIT_REPOSITORY_URL=${{ env.GIT_REPOSITORY_URL }} GIT_PAT=${{ env.GIT_PAT }}

the comma-separated form continues to work unchanged.

Deploy a stack with outputs

this example shows how to deploy a stack and capture outputs for use in subsequent steps:

...
jobs:
deploy:
name: StackQL Deploy with Outputsruns-on: ubuntu-latestenv:
GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CREDENTIALS }}steps:
- name: Checkoutuses: actions/checkout@v6
- name: Deploy a Stackid: stackql-deployuses: stackql/stackql-deploy-action@v2with:
command: 'build'stack_dir: 'examples/k8s-the-hard-way'stack_env: 'prod'output_file: 'deployment-outputs.json'env_vars: 'GOOGLE_PROJECT=stackql-k8s-the-hard-way-demo'
- name: Use deployment outputsrun: | echo "Deployment outputs: ${{ steps.stackql-deploy.outputs.deployment_outputs }}" # Parse specific values from JSON output WORKSPACE_NAME=$(echo '${{ steps.stackql-deploy.outputs.deployment_outputs }}' | jq -r '.databricks_workspace_name // "N/A"') echo "Workspace Name: $WORKSPACE_NAME" # Add to GitHub Step Summary echo "## Deployment Results" >> $GITHUB_STEP_SUMMARY echo "Workspace: $WORKSPACE_NAME" >> $GITHUB_STEP_SUMMARY - name: Conditional step based on outputsif: contains(steps.stackql-deploy.outputs.deployment_outputs, 'RUNNING')run: echo "Workspace is running, proceeding with next steps..."

Test a stack

this example shows how to test stack for a given environment:

...
- name: Test a Stackuses: stackql/stackql-deploy-action@v2with:
command: 'test'stack_dir: 'examples/k8s-the-hard-way'stack_env: 'sit'env_vars: 'GOOGLE_PROJECT=stackql-k8s-the-hard-way-demo'

About

Runs stackql-deploy in your GitHub Actions workflow.

Resources

Stars

5 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages