Skip to main content

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.
  2. In your Drone server, open your Astro project repository and go to Settings > General. Under Project Settings, turn on the Trusted setting.

  3. 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

Was this page helpful?

Sign up for Developer Updates

Get a summary of new Astro features once a month.

You can unsubscribe at any time.
By proceeding you agree to our Privacy Policy, our Website Terms and to receive emails from Astronomer.