Skip to content

Cleanup concurrency problems. - #2914

Open
jpascucci-nv wants to merge 3 commits into
NVIDIA:mainfrom
jpascucci-nv:issue2197
Open

jpascucci-nv wants to merge 3 commits into
NVIDIA:mainfrom
jpascucci-nv:issue2197

Conversation

@jpascucci-nv

@jpascucci-nv jpascucci-nv commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Closes #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-pages on every deployment. That required non-fast-forward pushes, conflicted with the active Protect gh-pages ruleset, and introduced additional operational risk around preserving the complete published site.

This revision does not rewrite gh-pages history. 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-pages history and therefore does
not resolve the clone-size problem tracked by #2197. History compaction will
require a separate, ruleset-compatible design.

Changes

  • Serialize every automated gh-pages writer through the shared
    cuda-python-gh-pages-publish concurrency group.

    • Queue all waiting publishers with queue: max.
    • Explicitly set cancel-in-progress: false.
  • Keep expensive documentation and coverage generation outside the serialized
    section.

    • Pass generated output to short deployment jobs through workflow artifacts.
  • Set force: false on all remaining github-pages-deploy-action invocations:

    • PR previews.
    • Latest and versioned documentation.
    • Coverage reports.
  • Let the deploy action fetch, rebase, and retry if gh-pages advances before
    its normal push completes.

  • Make the scheduled nightly workflow the sole owner of stale PR-preview
    deletion.

    • Remove immediate preview deletion from main and release builds.
    • Remove the cleanup workflow's manual workflow_dispatch entry point.
    • Restrict cleanup pushes to scheduled GitHub Actions runs holding the shared
      publishing lock.
  • Update the cleanup script to create a normal descendant commit and push
    without force.

    • Retry up to three times by fetching and rebasing if the branch advances.
    • Work from a detached remote snapshot without modifying a user's local
      gh-pages branch.
  • Add targeted actionlint suppressions for GitHub's concurrency.queue
    extension.

  • New or existing tests cover these changes.

  • The documentation is up to date with these changes.

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.
@copy-pr-bot

copy-pr-bot Bot commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

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.

@github-actions github-actions Bot added the CI/CD CI/CD infrastructure label Sep 18, 2026
@jpascucci-nv jpascucci-nv changed the title Closes #2197 Set gh-pages to single-commit and cleanup concurrency problems. Sep 18, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw one other thing: I think we have two workflows that have a race condition in cleaning up docs. I suggested @Andy-Jost that we should let the nightly job (cleanup-pr-reviews) be the sole owner, and don't do cleanup in this workflow.

@Andy-Jost do I recall correctly?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've removed the place where cleanup-pr-reviews was called during builds of main and release, so it will only cleanup nightly.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, isolating cleanup in a nightly job makes sense to me.

@jpascucci-nv jpascucci-nv changed the title Set gh-pages to single-commit and cleanup concurrency problems. Cleanup concurrency problems. Sep 21, 2026
@jpascucci-nv
jpascucci-nv marked this pull request as ready for review September 21, 2026 15:51
@jpascucci-nv jpascucci-nv added this to the cuda.core 1.3.0 milestone Sep 21, 2026
@jpascucci-nv jpascucci-nv self-assigned this Sep 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI/CD CI/CD infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Investigate gh-pages impact on full clone size and time

3 participants