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

Single branch implementation

  1. Set the following environment variable as a repository-level secret on Drone:
  • ASTRO_API_TOKEN: The value for your Workspace or Organization API token.
  1. In your Drone server, open your Astro project repository and go to Settings > General. Under Project Settings, turn on the Trusted setting.

  2. In the top level of your Git repository, create a file called .drone.yml that includes the following configuration:

.drone.yml
1---
2kind: pipeline
3type: docker
4name: deploy
5
6steps:
7 - name: install
8 image: debian
9 commands:
10 - apt-get update
11 - apt-get -y install curl
12 - curl -sSL install.astronomer.io | sudo bash -s
13 - name: wait
14 image: docker:dind
15 volumes:
16 - name: dockersock
17 path: /var/run
18 commands:
19 - sleep 5
20 - name: deploy
21 image: docker:dind
22 volumes:
23 - name: dockersock
24 path: /var/run
25 commands:
26 - astro deploy <your-deployment-id> -f
27 depends_on:
28 - wait
29 environment:
30 ASTRO_API_TOKEN:
31 from_secret: ASTRO_API_TOKEN
32
33services:
34- name: docker
35 image: docker:dind
36 privileged: true
37 volumes:
38 - name: dockersock
39 path: /var/run
40
41volumes:
42- name: dockersock
43 temp: {}
44
45trigger:
46 branch:
47 - main
48 event:
49 - push