The Astronomer deploy action includes several sub-actions that can be used together to create a complete Deployment preview pipeline, a configuration that allows you to test your code changes in an ephemeral development Deployment before promoting your changes to a production Astro Deployment.
The Deployment preview templates use GitHub secrets to manage the credentials needed for GitHub to authenticate to Astro. You can specify the credentials for your secrets backend so that preview Deployments have access to secret Airflow variables or connections during tests. See Deployment preview template with secrets backend implementation.
Deployment preview templates use Astronomer’s deploy-action to automates the deploy process, meaning it can selectively deploy parts of your project based on which files you changed. See Standard deploy templates for more information about the deploy-action.
Specific templates might have additional requirements.
If you use a self-hosted runner to execute jobs from GitHub Actions, the Astro CLI’s config.yaml file, which stores default deploy details, might be shared across your organization and hence multiple CI/CD pipelines. To reduce the risk of accidentally deploying to the wrong Deployment, ensure the following:
ASTRO_API_TOKEN to your repository and include a check in your GitHub workflow to verify that it exists.deployment-id or deployment-name in your action. For example, astro deploy <deployment-id> or astro deploy -n <deployment-name>.astro logout at the end of your workflow to ensure that your authentication token is cleared from the config.yaml file.The standard Deployment preview template uses GitHub secrets and an Astro Workspace or Organization API token to create a preview Deployment whenever you create a new feature branch off of your main branch.
<main-deployment-id> with this Deployment ID in all the scripts created in the following steps. Even though some scripts take action on the preview Deployment, the <main-deployment-id> should be same for each script.ASTRO_API_TOKEN<your-token>.github/workflows named deploy-to-preview.yml that includes the following configuration:delete-preview-deployment.yml that includes the following configuration:deploy-to-main-deployment.yml that includes the following configuration:All three workflow files must have the same Deployment ID specified. The actions use this Deployment ID to create and delete preview Deployments based on your main Deployment.
If you use a secrets backend to manage Airflow objects such as variables and connections, you can configure your action to grant preview Deployments access to your secrets backend. This means that dags in the preview Deployment can access your secret Airflow objects for testing purposes.
This template makes use of the AIRFLOW__SECRETS__BACKEND_KWARGS environment variable to store information and credentials for your secrets backend.
<main-deployment-id> with this Deployment ID in all the scripts created in the following steps. Even though some scripts take action on the preview Deployment, the <main-deployment-id> should be same for each script.AIRFLOW__SECRETS__BACKEND_KWARGS. See Configure a secrets backend for more information about configuring your secrets backend as an environment variable.ASTRO_API_TOKEN<your-token>AIRFLOW__SECRETS__BACKEND_KWARGS<your-kwargs>.github/workflows named create-deployment-preview.yml that includes the following configuration.deploy-to-preview.yml that includes the following configuration:delete-preview-deployment.yml that includes the following configuration:deploy-to-main-deployment.yml that includes the following configuration:All four workflow files must have the same Deployment ID specified. The actions use this Deployment ID to create and delete preview Deployments based on your main Deployment.