Cleanup concurrency problems in doc generation - #2914
Conversation
The `gh-pages` branch has accumulated thousands of generated-site commits, substantially increasing the size of full repository clones. This PR keeps `gh-pages` at a single commit while preserving the existing documentation, PR previews, and coverage pages. It: - Enables `single-commit` publishing for documentation, PR previews, preview removal, and coverage. - Serializes every automated `gh-pages` writer using the shared `cuda-python-gh-pages-publish` concurrency group. - Separates expensive docs and coverage generation from the serialized deployment jobs, so builds can still run in parallel. - Passes generated output to the deployment jobs through workflow artifacts. - Updates stale-preview cleanup to: - Work from a detached snapshot without modifying a local `gh-pages` branch. - Create a parentless commit containing the updated complete tree. - Push using an explicit `--force-with-lease`. - Permit remote pushes only from the serialized cleanup workflow. - Adds the required targeted `actionlint` suppressions for GitHub's `concurrency.queue` extension. Preview and coverage pages remain intact because every deployment begins with the existing `gh-pages` tree and updates only its assigned target directory. This change intentionally performs a non-fast-forward update on every deployment. The active `Protect gh-pages` ruleset currently blocks these updates. Before exercising this workflow—including PR preview deployment—the authenticated publishing actor must have an `always` bypass for the ruleset, or the force-push restriction must be changed. `git-config-name: cuda-python-bot` is only commit metadata; as written, the authenticated actor is the GitHub Actions integration. The `Restrict deletions` rule is not otherwise a problem: the workflows delete files within commits, not the `gh-pages` branch ref. Granting the GitHub Actions integration a bypass is relatively broad. If that is undesirable, deployment should instead use a dedicated GitHub App with narrowly scoped repository permissions. - Drain any docs, coverage, and cleanup jobs started with the previous workflow before the first compacting deployment. Concurrency groups do not apply retroactively. - After the first deployment, verify that: - `gh-pages` contains one commit. - Latest and versioned documentation still exist. - Existing PR previews still exist. - Coverage pages still exist. - If a deployment-only job fails, use **Re-run all jobs** so its prerequisite job recreates the deployment artifact. - [x] New or existing tests cover these changes. - [x] The documentation is up to date with these changes.
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
…ve single-commit.
|
Responding to Leo's comments. - detect preview builds using pull-request refs - honor deploy-docs for all documentation deployments - keep nightly cleanup as the sole gh-pages cleanup writer - add read-only manual preview inspection - retire sticky comments for closed PR previews
Andy-Jost
left a comment
There was a problem hiding this comment.
Requesting changes for one blocker and one small fix, plus two nice-to-haves.
-
Blocker: the comment update in
ci/cleanup-pr-previewscan stall the nightly cleanup. See the inline comment for details and a suggested fix. -
The description says "Closes #2197". GitHub will close that issue on merge, but the PR does not fix the clone-size problem it tracks (see the Non-goal section). Please change it to "Refs #2197".
Nice to have:
-
Keep
workflow_dispatchon the cleanup workflow, with the dry-run input, and let the script's--pushguard accept bothscheduleandworkflow_dispatch. Dispatching a workflow already requires write access, so removing it adds little protection, and it takes away the only way to run a cleanup on demand. -
CI has only exercised the PR-preview path of the new deploy job. The main, release, and coverage deploys have not run yet. A release dry run dispatched from the
pull-request/2914branch with agh-pages-dry-rundocs branch would cover the release path before merge. The coverage nightly has been failing since Sept 24 for unrelated reasons, so that path cannot be checked right now.
The rest looks good to me. The shared concurrency group, force: false on every writer, the nightly job as sole owner of cleanup, and the artifact hand-off to short deploy jobs all match what the team agreed on.
|
@Andy-Jost Ran release dry run here: https://github.com/NVIDIA/cuda-python/actions/runs/36633977438/job/109630709216 deleted the gh-pages-dry-run |
| gh api --method PATCH repos/"${REPOSITORY}"/issues/comments/"${comment_id}" \ | ||
| --header "Accept: application/vnd.github+json" \ | ||
| -f body="$comment_body" >/dev/null |
There was a problem hiding this comment.
My bot called this out and gave a 👍 because this edits in-place and does not send another notification.
Removed preview folders for the following PRs: - PR #2914
Refs #2197 - addressed by Leo Fang as not to fix now.
Description
Incorporates the force-free deployment approach from #2883.
The original version of this PR compacted
gh-pageson every deployment. That required non-fast-forward pushes, conflicted with the activeProtect gh-pagesruleset, and introduced additional operational risk around preserving the complete published site.This revision does not rewrite
gh-pageshistory. Instead, it addresses the concurrency problems identified while investigating #2197 and keeps the existing branch-protection rules intact.Non-goal
This PR no longer compacts the existing
gh-pageshistory and therefore doesnot resolve the clone-size problem tracked by #2197. History compaction will
require a separate, ruleset-compatible design.
Changes
Serialize every automated
gh-pageswriter through the sharedcuda-python-gh-pages-publishconcurrency group.queue: max.cancel-in-progress: false.Keep expensive documentation and coverage generation outside the serialized
section.
Set
force: falseon all remaininggithub-pages-deploy-actioninvocations:Let the deploy action fetch, rebase, and retry if
gh-pagesadvances beforeits normal push completes.
Make the scheduled nightly workflow the sole owner of stale PR-preview
deletion.
workflow_dispatchentry point.publishing lock.
Update the cleanup script to create a normal descendant commit and push
without force.
gh-pagesbranch.Add targeted
actionlintsuppressions for GitHub'sconcurrency.queueextension.
New or existing tests cover these changes.
The documentation is up to date with these changes.