This is an automated email from the ASF dual-hosted git repository. matrei pushed a commit to branch ci/policy-follow-ups in repository https://gitbox.apache.org/repos/asf/grails-core.git
commit 08d81a029655594f4af0d9bedb17c44afd3e4e9e Author: Mattias Reichel <[email protected]> AuthorDate: Thu Oct 22 11:05:21 2026 +0200 Publish nothing of a CI run cancelled before its builds finish, and correct the CI policy docs Follow-up to #16673. publishGradle needed only buildGradle, so on any push run a cancel more than a few minutes in still published the superseded commit's Gradle plugins, and on a run without tests also its core and docs but not its Forge, which was still building. 8.0.x run 39638916842 shows the first case: its plugins went out at 17:13 and a newer push cancelled the run at 17:26, before its tests finished. publishGradle now also waits for buildForge and validateDependencies, so a cancel before the builds finish publishes nothing of that commit, and a commit whose Forge build or dependency validation failed is no longer published. A cancel after the builds publishes the whole chain on a run without tests, and only the Gradle plugins while tests are still running; the comments in gradle.yml and the CI policy section of AGENTS.md now say that instead of claiming that a cancelled commit is never published. AGENTS.md also no longer lists the snapshot publish among the jobs that run on pull requests, and names force-cancel for a publish that a normal cancel cannot stop. CONTRIBUTING.md no longer says every push to a branch cancels the run in flight, which only CI and the Groovy joint build do. RELEASE.md notes that a merge cancels the manual test run of the release branch, since both share a concurrency group. --- .github/workflows/gradle.yml | 26 ++++++++++++++++++-------- AGENTS.md | 4 ++-- CONTRIBUTING.md | 2 +- RELEASE.md | 2 ++ 4 files changed, 23 insertions(+), 11 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index f2354737c7..57ba3bb383 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -31,9 +31,15 @@ on: # results would be for a superseded commit, and the run that replaces it publishes the newer one. The publish # jobs (publishGradle, publish, publishForge, verifyWrapper, docs) run on always() with explicit result checks # instead, so a publish that has started completes: an interrupted upload would leave the snapshot repository -# with modules from two commits. Nothing of the cancelled commit is published when the cancel arrives before -# publish starts, because a cancelled test job fails the explicit checks. The replacing run is pending until -# the cancelled run has finished every job, so two publishes of the same branch never overlap. +# with modules from two commits. publishGradle waits for every build job (buildGradle, buildForge and +# validateDependencies), so nothing of the cancelled commit is published when the cancel arrives before the +# builds have finished. A later cancel lets the publish jobs whose needs have already succeeded or been skipped +# run: on a run without tests that is the whole chain, and on a run whose tests are still running only +# publishGradle, because a cancelled test job fails the explicit checks of publish and of everything after it. +# A cancel after every test has passed lets the whole chain run as well. The replacing run is pending until the +# cancelled run has finished every job, so two publishes of the same branch never overlap, and it then publishes +# the newer commit over whatever the cancelled run published. A normal cancel does not stop a running always() +# job either; the CI policy section of AGENTS.md says how to force one. concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true @@ -536,14 +542,18 @@ jobs: -PonlyHibernate5Tests -PskipCodeStyle publishGradle: - # always() with an explicit result check, see the concurrency comment at the top. + # always() with explicit result checks, see the concurrency comment at the top. It waits for every build job, + # not only buildGradle, so that a run cancelled before its builds have finished publishes nothing, and a + # commit whose Forge build or dependency validation failed is not published. if: >- ${{ always() && github.repository_owner == 'apache' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && - needs.buildGradle.result == 'success' + needs.buildGradle.result == 'success' && + needs.buildForge.result == 'success' && + needs.validateDependencies.result == 'success' }} - needs: [ buildGradle ] + needs: [ buildGradle, buildForge, validateDependencies ] runs-on: ubuntu-24.04 steps: - name: "Output Agent IP" # in the event RAO blocks this agent, this can be used to debug it @@ -591,8 +601,8 @@ jobs: needs: [ publishGradle, build, functional, security, securityConfig, redis, hibernate5Functional, mongodbFunctional ] # always() with explicit result checks, see the concurrency comment at the top. The results are checked # explicitly because the implicit success() check also covers the skipped test jobs upstream, which would - # skip this job on a build-only run, and because a cancelled test job must not be published: nothing of a - # commit whose run was cancelled before this job started reaches the snapshot repository. + # skip this job on a build-only run, and because a cancelled test job must not be published: the core of a + # commit whose tests were cancelled never reaches the snapshot repository, although its Gradle plugins may. if: >- ${{ always() && github.repository_owner == 'apache' && diff --git a/AGENTS.md b/AGENTS.md index 7ae022db95..1032f07648 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -254,8 +254,8 @@ GitHub-hosted runner time is shared with every other Apache project, so the work - A draft pull request runs nothing unless it carries the `run ci` label, and a pull request labelled `no ci` runs nothing at all: every workflow that reacts to a pull request skips all of its jobs, except the Release Drafter (`release-notes.yml`), which keeps reacting to every pull request into a release branch, draft or not, because its autolabeler must label drafts; it runs no build. Marking a draft ready for review starts CI (the workflows list the `ready_for_review` trigger type, wh [...] - Every workflow that runs tests calls `.github/workflows/ci-policy.yml` as its first job, `policy`, and gates its test jobs (and the test steps of its build jobs) on `needs.policy.outputs.run-tests`. Never test `github.event.head_commit.message` in a workflow: a `pull_request` payload has no such field, so that test silently ran the tests on every pull request. The policy reads the head commit of the push, of the pull request, or of the dispatched branch, and matches the marker against [...] - The tests run by default only on the default branch and the release branches above it, and there a commit message starting with `[skip tests]` skips them. Everywhere else, that is on a release branch below the default (7.0.x, 7.1.x and 7.2.x while 8.0.x is the default) and on a pull request whose base is a side branch rather than a release branch, the tests run only on request: when the commit message starts with `[run tests]`, when the pull request carries the `run ci` label, or when [...] -- The jobs that run no tests (dependency validation, the build-without-tests steps, code style, build health, and the snapshot publish) still run on every push to a release branch and on every non-draft pull request; RAT and CodeQL run on every push to a release branch and on every non-draft pull request into one, since their `pull_request` triggers list only release-branch bases. Only the `no ci` label, or a draft without `run ci`, stops them. -- The publish jobs in `gradle.yml` (`publishGradle`, `publish`, `publishForge`, `verifyWrapper`, `docs`) run on `always()` and check the result of each job they need explicitly. The explicit checks are needed because the implicit `success()` check covers every job upstream, so a skipped test job would skip them although their own needs succeeded, which is what silently skipped the Forge and docs publish on every `[skip tests]` push. `always()` rather than `!cancelled()` because a newer p [...] +- The jobs that run no tests (dependency validation, the build-without-tests steps, code style and build health) still run on every push to a release branch and on every non-draft pull request; RAT and CodeQL run on every push to a release branch and on every non-draft pull request into one, since their `pull_request` triggers list only release-branch bases. Only the `no ci` label, or a draft without `run ci`, stops them. The snapshot publish runs on every push to a release branch and on [...] +- The publish jobs in `gradle.yml` (`publishGradle`, `publish`, `publishForge`, `verifyWrapper`, `docs`) run on `always()` and check the result of each job they need explicitly. The explicit checks are needed because the implicit `success()` check covers every job upstream, so a skipped test job would skip them although their own needs succeeded, which is what silently skipped the Forge and docs publish on every `[skip tests]` push. `always()` rather than `!cancelled()` because a newer p [...] - A workflow that gains a test job gets `needs: [ policy ]` and `if: ${{ needs.policy.outputs.run-tests == 'true' }}` on that job; a workflow that gains a non-test job copies the label-and-draft `if` from its sibling jobs. ### Gradle caching diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1584107595..a95f33667d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -281,7 +281,7 @@ project, so two controls limit what runs: A pull request labelled `no ci` runs no workflow at all, draft or not. (The Release Drafter still labels every pull request into a release branch; it runs no build.) Labels are read when a push arrives, so add `run ci` (or remove `no ci`) and then push, or mark the draft ready, to get a run. Pushing to a draft still cancels the run in - flight for it, as every push to a pull request or a branch does. + flight for it, as every push to a pull request does. * The tests run by default only on the default branch and the release branches above it. Elsewhere, that is on an older release branch such as `7.0.x` while `8.0.x` is the default, and on a pull request whose base is a side branch rather than a release branch, a push or pull request builds without running the tests unless asked: a diff --git a/RELEASE.md b/RELEASE.md index be4b8307aa..872ec2f764 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -35,6 +35,8 @@ gh workflow run gradle.yml --repo apache/grails-core --ref 7.0.x -f run-tests=tr The command line works on any branch whose `gradle.yml` has the input; the manual-run form in the GitHub UI offers it once the default branch has it. +The manual run shares its concurrency group with the pushes to that branch, so a merge to the branch while it is in progress cancels its build and test jobs, and the run started by that push does not run the tests. If the manual run ends up cancelled, start it again once nothing else is being merged to the branch. + ## 1. Staging During the staging step, we must create a source distribution & stage any binary artifacts that end users will consume.
