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 templates for DroneCI use the image-only deploy process 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.
- Either a Deployment API key ID and secret, a Workspace API token, or an 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 variables as repository-level secrets on Drone:
ASTRONOMER_KEY_ID
=<your-key-id>
ASTRONOMER_KEY_SECRET
=<your-key-secret>
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 -f
depends on:
- wait
environment:
ASTRONOMER_KEY_ID:
from_secret: ASTRONOMER_KEY_ID
ASTRONOMER_KEY_SECRET:
from_secret: ASTRONOMER_KEY_SECRET
services:
- name: docker
image: docker:dind
privileged: true
volumes:
- name: dockersock
path: /var/run
volumes:
- name: dockersock
temp: {}
trigger:
branch:
- main
event:
- push