ashb opened a new pull request #15944:
URL: https://github.com/apache/airflow/pull/15944
Use `pull_request_target` event for building images, and `concurrency` to
automatically cancel old jobs for PRs.
This means that:
- GitHub will automatically cancel old jobs for us, so we don't have to
handle that ourselves (removes most of the use of the
cancel-workflow-action)
New pushes show this for a little while

And then the old job shows this as the reason

- GitHub displays these checks directly on the PR, but it is still run
in the context of our repo, meaning it has access write to our
repo/access to secrets etc.

- Since it shows up directly on the PR checks, we don't need to create the
check in the "CI" workflow to show the status of the Image Build.
- We also don't need to post the comment saying _why_ it failed, as the
Build Image status will show up directly there
- Since `pull_request_target` has information about the PR in the
`github.event` context, we don't need the complex mechanism to find
the "other" PR, we can do a fairly simple API request and filter by
the commit SHA to find and cancel to CI workflow job. (This removes
the final use of the cancel-workflow-action)
One change I had to make here what tag we use for Docker images we build
and push up. Previously we used the "source run ID" (i.e. the id of the
CI run) but with pull_request_target we don't have that anymore. We
could use the same API mechanism we do to cancel to find the target job,
but the only requirement here is for an ID that both jobs know -- the
SHA of the PR branch fills that need
Extra side benefits of this:
- The sidebar of commits in main branch aren't "polluted" with Build
Images for PRs like they were previously.
Still do do:
- [ ] Update breeze to pull the new image tag format when given a numeric id
(use API to look up sha that a build is for)
- [ ] Delete old build-image-workflow-run workflow file
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]