Add Airflow 3 ruff checks to upgrade-test command#1821
Conversation
neel-astro
left a comment
There was a problem hiding this comment.
Left some minor questions, but looking good otherwise
airflow/docker.go
Outdated
| } | ||
|
|
||
| imageHandler := DockerImageInit(ImageName(imageName, "latest")) | ||
| ruffImageHandler := DockerImageInit("ghcr.io/astral-sh/ruff:latest") |
There was a problem hiding this comment.
nit: should this be configurable, to have a backdoor when astral-sh makes any changes, it would sort of make us changes all of our active CLI releases? not a big deal; it's just a thought.
There was a problem hiding this comment.
Yes good idea, added the ruff.image config for this.
| } | ||
|
|
||
| if ruffTest { | ||
| ruffTestPassed, err := d.ruffTest(testHomeDirectory) |
There was a problem hiding this comment.
Nit: Should we add a section header, like
============= Running ruff tests on the dags folder =============
or something along those lines?
As of now, it is slightly confusing with the previous line stating that "No errors detected in your DAGs" and then if there are errors in the ruff test we start with the stacktrace.
There was a problem hiding this comment.
Another good call. I added some header lines to make it clearer what is going on.
Description
This change adds support to the
astro dev upgrade-testcommand so that when upgrading to Airflow 3 (including within Airflow 3 releases) the command will run ruff checks to validate the DAGs in thedagsdirectory of the project.The ruff checks are run as a container using the
ghcr.io/astral-sh/ruff:latestimage. The Airflow 3 rules are available as part of ruff itself. As new rules are added to ruff they will be automatically available to the CLI via the latest tag reference.🧪 Functional Testing
📸 Screenshots
ruff check failures:

ruff check pass:

Not run for Airflow 2:

📋 Checklist
make testbefore taking out of draftmake lintbefore taking out of draft