airflow icon indicating copy to clipboard operation
airflow copied to clipboard

Start project CI when a maintainer adds use project ci

Open potiuk opened this issue 2 weeks ago • 2 comments

Adding use project ci to a gated fork CI pull request moves it to project CI, but project CI does not start. It runs only on the author's next push, or after a maintainer closes and reopens the pull request, and then waits for approval when the repository's approval setting covers the author. The lifecycle diagram and the "Override labels" section of dev/breeze/doc/ci/08_fork_ci_for_external_contributors.md now document this (#76839). It is still one step more than a maintainer expects after adding the label.

Why the monitor cannot do it today

  • The fork CI monitor uses GITHUB_TOKEN, and events caused by GITHUB_TOKEN do not start new workflow runs, so a close and reopen by the monitor would not start project CI.
  • Re-running the gated run is not possible: the reconciler deletes gated project CI runs.

Options

  1. Listen for the label in ci-amd.yml. Add labeled to its pull_request event types. A maintainer adding the label is not GITHUB_TOKEN, so the event starts a run, and the gate job already reads the current labels. Every other label added to a pull request would also start a run, so the workflow has to stop at once unless the added label is use project ci. It also needs a look at how such a run interacts with concurrency groups and with deleting gated runs.
  2. Give the monitor a token whose events start workflows (a GitHub App installation token) and have it close and reopen the pull request when it releases it. This needs a new credential for apache/airflow and ASF Infra's agreement.

Option 1 looks smaller and keeps the monitor on GITHUB_TOKEN.

Done when

  • A maintainer adding use project ci to a gated pull request starts project CI for its head commit, with no push or close/reopen.
  • Adding any other label starts no CI work.
  • The lifecycle diagram (diagram_fork_ci_lifecycle.py), the "Override labels" section and the use project ci bullet in the design document describe the new behaviour.

Raised in the review of #76839.


Drafted-by: Claude Code (Opus 5.5); reviewed by potiuk before posting

potiuk avatar Nov 15 '26 04:11 potiuk

Hi @potiuk and Airflow maintainers,

I'd like to take ownership of this issue and work on the implementation.

I've reviewed the proposed approaches, and I agree that extending ci-amd.yml to handle the pull_request.labeled event appears to be the most focused solution, without introducing additional credentials or changing the existing fork CI monitor.

My proposed approach is to:

  1. Add support for the labeled pull request event.
  2. Ensure that only the use project ci label triggers the project CI execution path, while other label events exit without starting CI work.
  3. Validate the interaction with existing fork CI gating, concurrency groups, and reconciliation behavior.
  4. Add focused regression tests covering the expected label-triggered behavior.
  5. Update the lifecycle diagram and relevant fork CI documentation.

Could you please confirm whether anyone is already working on this issue? If it is available, I'd be happy to take it forward and submit a PR.

I would also appreciate being assigned to the issue, if appropriate, to help avoid duplicate efforts.

Thanks!

adiranjan25 avatar Nov 15 '26 04:11 adiranjan25

Hi @potiuk,

I've submitted PR #77101 to address this issue.

The implementation adds support for triggering AMD project CI when a maintainer applies the use project ci label, without requiring an additional push or closing and reopening the PR.

It also isolates unrelated label events to avoid triggering CI jobs or cancelling existing CI runs.

Validation completed:

  • 74 fork CI gate tests passed.
  • No new actionlint findings compared with upstream.
  • Fork CI documentation and lifecycle diagram updated.

PR: https://github.com/apache/airflow/pull/77101

I'd appreciate your review and feedback, particularly on the label-triggered workflow behavior and concurrency handling.

Thank you!

adiranjan25 avatar Nov 15 '26 04:11 adiranjan25