Astro CI/CD templates for Drone
Use the following CI/CD templates to automate deploying Apache Airflow DAGs from a Git repository to Astro with Drone CI.
The template for DroneCI is based on the image deploy template with a single branch implementation, which requires only one Astro Deployment.
If you use the DAG-only deploy feature on Astro or you're interested in a multiple-branch implementation, see Template overview to configure your own. To learn more about CI/CD on Astro, see Choose a CI/CD strategy.
Prerequisites
- An Astro project hosted in a Git repository that Drone can access.
- An Astro Deployment.
- A Deployment API token, Workspace API token, or Organization API token.
- A functional Drone server.
- A user with admin privileges to your Drone server.
- A Docker runner.
Single branch implementation
-
Set the following environment variable as a repository-level secret on Drone:
ASTRO_API_TOKEN
: The value for your Workspace or Organization API token.
-
In your Drone server, open your Astro project repository and go to Settings > General. Under Project Settings, turn on the Trusted setting.
-
In the top level of your Git repository, create a file called
.drone.yml
that includes the following configuration:---
kind: pipeline
type: docker
name: deploy
steps:
- name: install
image: debian
commands:
- apt-get update
- apt-get -y install curl
- curl -sSL install.astronomer.io | sudo bash -s
- name: wait
image: docker:dind
volumes:
- name: dockersock
path: /var/run
commands:
- sleep 5
- name: deploy
image: docker:dind
volumes:
- name: dockersock
path: /var/run
commands:
- astro deploy <your-deployment-id> -f
depends on:
- wait
environment:
ASTRO_API_TOKEN:
from_secret: ASTRO_API_TOKEN
services:
- name: docker
image: docker:dind
privileged: true
volumes:
- name: dockersock
path: /var/run
volumes:
- name: dockersock
temp: {}
trigger:
branch:
- main
event:
- push