Anyone interested in Github Actions CI/CD?

I’ve been checking out Github’s new Actions CI/CD solution, and looking at https://www.astronomer.io/docs/ci-cd/ it seems like it wouldn’t be too difficult to come up with a GH Action for Astronomer Airflow automated deployment.

Anyone tried this yet or interested in collaborating on a prototype GH action? Or maybe the Astronomer devs interested in working with a motivated user to craft one? I’ve got the GH Actions half in my head, but not as familiar with the Astronomer end of the CI/CD process.

Just putting out feelers.

I’d be happy to help. never tried it myself, but just set up one for Git Lab. I bet they are pretty similar. From astro point of view, you basically just need to build your image, then push it to your docker registry. you authenticate with a service account token you create from the Orbit UI. In the doc yo posted, use the Gitlab as an example. It’s the most up to date.

also, once we get it nailed down, we’ll add it to that doc.

Yep, sounds pretty straight forward. And there are already a few published Github Action templates out there doing similar.

I’m currently using https://github.com/marketplace/actions/publish-docker , which pairs with another action to both 1) login to an ECR registry and 2) publish the image to it. This seems like a close enough pattern to follow.

I’ll let you know what I figure out.

1 Like

Love what you’re doing here, @andrewcstewart! Keep us posted.

Ok, turns out this is ridiculously easy to do using the following github action: https://github.com/marketplace/actions/publish-docker

Just create a new action in your repo at .github/workflows/main.yml with the following content:

name: CI

on: [push]

jobs:
  build:
    runs-on: ubuntu-latest    
    steps:
    - uses: actions/checkout@v1
    - name: Publish to Astronomer.io
      uses: elgohr/Publish-Docker-Github-Action@2.6
      with:
        name: infrared-photon-7780/airflow:ci-${{ github.sha }}
        username: _
        password: ${{ secrets.ASTRO_SERVICE_KEY }}
        registry: registry.astronomer.cloud

Replace infrared-photon-7780 with your deployment name. Also create an astronomer service account and store the key in your github repo’s secrets (as per https://help.github.com/en/articles/virtual-environments-for-github-actions#creating-and-using-secrets-encrypted-variables)

And that should be it!

1 Like