-
Notifications
You must be signed in to change notification settings - Fork 328
ci: make pixi lockfile updates predictable (#2298) #2780
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jpascucci-nv
wants to merge
6
commits into
NVIDIA:main
Choose a base branch
from
jpascucci-nv:issue2298
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
ac6b173
ci: make pixi lockfile updates predictable (#2298)
jpascucci-nv 717a5ca
Update manifest so pixi scan runs correctly
jpascucci-nv 332f687
Updates wrt comments in PR.
jpascucci-nv c8886cd
Fix extra whitespace
jpascucci-nv 78e986b
Remove path enumeration
jpascucci-nv b599423
Updated from codex comments
jpascucci-nv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,119 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| # Fails when a committed pixi.lock is out of date with its pixi.toml, or when | ||
| # its bytes are not what the pinned pixi version generates. | ||
| # Remediation for both: regenerate and commit the lockfile with that pixi | ||
| # version, e.g. | ||
| # pixi lock --manifest-path <path> | ||
| # See #2298. | ||
|
|
||
| name: "CI: pixi lockfile freshness check" | ||
|
|
||
| concurrency: | ||
| # Keyed on the event as well as the ref so a manual dispatch and a push to | ||
| # the same branch do not cancel each other. | ||
| group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} | ||
| cancel-in-progress: true | ||
|
|
||
| on: | ||
| pull_request: | ||
| # `pyproject.toml` is a lockfile input too: the manifests consume sibling | ||
| # packages (including cuda_python_test_helpers) as path dependencies, so | ||
| # their metadata can stale a lock without any pixi.toml edit. Matched by | ||
| # glob rather than by name so the filter cannot drift as packages move. | ||
| paths: &lockfile_inputs | ||
| - "**/pixi.toml" | ||
| - "**/pixi.lock" | ||
| - "**/pyproject.toml" | ||
| - "ci/tools/list_pixi_workspaces.py" | ||
| - ".github/workflows/ci-pixi-lockfile-freshness-check.yml" | ||
| push: | ||
| # `pull_request` already covers PRs, including those from forks: this check | ||
| # needs no secrets or GPU runner. Watching copy-pr-bot's `pull-request/N` | ||
| # mirror too would run the whole matrix a second time per PR. | ||
| branches: | ||
| - "main" | ||
| paths: *lockfile_inputs | ||
| workflow_dispatch: {} | ||
|
|
||
| defaults: | ||
| run: | ||
| shell: bash --noprofile --norc -xeuo pipefail {0} | ||
|
|
||
| env: | ||
| # Keep in sync with ci-pixi-source-test.yml. Must be >=0.71.0 so the | ||
| # committed lockfile format (v7) matches what this job checks against. | ||
| PIXI_VERSION: "v0.73.0" | ||
|
jpascucci-nv marked this conversation as resolved.
|
||
|
|
||
| permissions: {} | ||
|
|
||
| jobs: | ||
| # The workspace list is derived from the committed manifests so this matrix | ||
| # cannot silently skip a newly added workspace (#2298). | ||
| plan: | ||
| name: Discover pixi workspaces | ||
| if: ${{ github.repository_owner == 'nvidia' }} | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 5 | ||
| permissions: | ||
| contents: read | ||
| outputs: | ||
| matrix: ${{ steps.discover.outputs.matrix }} | ||
| steps: | ||
| - name: Checkout ${{ github.event.repository.name }} | ||
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | ||
| with: | ||
| fetch-depth: 1 | ||
| persist-credentials: false | ||
|
|
||
| - name: Discover workspaces | ||
| id: discover | ||
| run: | | ||
| workspaces="$(python3 ci/tools/list_pixi_workspaces.py)" | ||
| echo "matrix=$(jq -c '{include: .}' <<<"${workspaces}")" >> "${GITHUB_OUTPUT}" | ||
|
|
||
| lockfile-fresh: | ||
| name: "pixi lock --check (${{ matrix.manifest }})" | ||
| needs: plan | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 20 | ||
| permissions: | ||
| contents: read | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: ${{ fromJSON(needs.plan.outputs.matrix) }} | ||
| steps: | ||
| - name: Checkout ${{ github.event.repository.name }} | ||
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | ||
| with: | ||
| fetch-depth: 1 | ||
| persist-credentials: false | ||
|
|
||
| - name: Setup pixi | ||
| # Pinned to a commit SHA; install logic lives in the action and is | ||
| # auditable/pinned (vs. a curl|bash of an unverified installer). | ||
| uses: prefix-dev/setup-pixi@5185adfbffb4bd703da3010310260805d89ebb11 # v0.9.6 | ||
| with: | ||
| pixi-version: ${{ env.PIXI_VERSION }} | ||
| run-install: false | ||
|
|
||
| - name: Check lockfile is current with its manifest | ||
| run: | | ||
| if ! pixi lock --check --manifest-path "${{ matrix.manifest }}"; then | ||
| echo "::error::Lockfile is stale for '${{ matrix.manifest }}'. Regenerate with: pixi lock --manifest-path ${{ matrix.manifest }}" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # `pixi lock --check` exits 0 on a semantically current lock even when it | ||
| # rewrites the file into the pinned version's canonical form (lockfile | ||
| # format upgrades, platform alias renames). Without this guard that drift | ||
| # is invisible: the check prints "Updated lock file" and still passes, | ||
| # while every later pixi run keeps rewriting the committed file (#2298). | ||
| - name: Check lockfile is byte-for-byte canonical | ||
| run: | | ||
| if ! git diff --exit-code -- "${{ matrix.lockfile }}"; then | ||
| echo "::error::pixi ${PIXI_VERSION} rewrote ${{ matrix.lockfile }} during the check, so the committed bytes are not what it generates. Regenerate with pixi ${PIXI_VERSION}: pixi lock --manifest-path ${{ matrix.manifest }}" | ||
| exit 1 | ||
| fi | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,177 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| # Scheduled (and on-demand) pixi lockfile refresh. Each workspace gets its own | ||
| # PR so a benchmark or docs environment cannot drag unrelated package churn | ||
| # into review. See #2298. | ||
|
|
||
| name: "CI: pixi lockfile refresh" | ||
|
|
||
| on: | ||
| schedule: | ||
| # Monday 03:17 Eastern. GitHub handles the DST offset for the IANA zone, | ||
| # and a non-zero minute avoids the start-of-hour window where GitHub | ||
| # documents scheduled runs being delayed or dropped. | ||
| - cron: "17 3 * * 1" | ||
| timezone: "America/New_York" | ||
| workflow_dispatch: | ||
| inputs: | ||
| package: | ||
| description: > | ||
| Pixi workspace id to refresh, or "all". Valid ids come from | ||
| ci/tools/list_pixi_workspaces.py; an unknown id fails the run. | ||
| type: string | ||
| default: all | ||
|
|
||
| defaults: | ||
| run: | ||
| shell: bash --noprofile --norc -xeuo pipefail {0} | ||
|
|
||
| env: | ||
| # Keep in sync with ci-pixi-source-test.yml. | ||
| PIXI_VERSION: "v0.73.0" | ||
|
jpascucci-nv marked this conversation as resolved.
|
||
|
|
||
| permissions: {} | ||
|
|
||
| jobs: | ||
| # Job-level `if` cannot use `matrix` (evaluated before expansion), and the | ||
| # workspace list must not drift from the committed manifests, so resolve the | ||
| # requested workspaces here and pass them to refresh as a dynamic matrix. | ||
| plan: | ||
| name: Select workspaces | ||
| if: ${{ github.repository_owner == 'nvidia' }} | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 5 | ||
| permissions: | ||
| contents: read | ||
| outputs: | ||
| matrix: ${{ steps.select.outputs.matrix }} | ||
| steps: | ||
| - name: Checkout ${{ github.event.repository.name }} | ||
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | ||
| with: | ||
| fetch-depth: 1 | ||
| persist-credentials: false | ||
|
|
||
| - name: Select workspaces to refresh | ||
| id: select | ||
| env: | ||
| PACKAGE: ${{ inputs.package || 'all' }} | ||
| run: | | ||
| workspaces="$(python3 ci/tools/list_pixi_workspaces.py --select "${PACKAGE}")" | ||
| echo "matrix=$(jq -c '{include: .}' <<<"${workspaces}")" >> "${GITHUB_OUTPUT}" | ||
|
|
||
| refresh: | ||
| name: "pixi update (${{ matrix.id }})" | ||
| needs: plan | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 30 | ||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
| concurrency: | ||
| group: pixi-lock-refresh-${{ matrix.id }} | ||
| cancel-in-progress: false | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: ${{ fromJSON(needs.plan.outputs.matrix) }} | ||
| steps: | ||
| - name: Checkout ${{ github.event.repository.name }} | ||
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | ||
| with: | ||
| fetch-depth: 0 | ||
| ref: ${{ github.event.repository.default_branch }} | ||
|
|
||
| # GitHub suppresses workflow-triggering events for pushes and PRs made | ||
| # with GITHUB_TOKEN, so a refresh PR opened with the default token cannot | ||
| # reach a green required-check state on its own. An App token restores | ||
| # normal event delivery; without one the PR needs a manual nudge, which | ||
| # the PR body and a run warning spell out. | ||
| - name: Mint App token for the refresh PR | ||
| id: app-token | ||
| if: ${{ vars.PIXI_LOCK_REFRESH_APP_ID != '' }} | ||
| uses: actions/create-github-app-token@fee1f7d63c2ff003460e3d139729b119787bc349 # v2.2.2 | ||
| with: | ||
| app-id: ${{ vars.PIXI_LOCK_REFRESH_APP_ID }} | ||
| private-key: ${{ secrets.PIXI_LOCK_REFRESH_APP_PRIVATE_KEY }} | ||
|
|
||
| - name: Setup pixi | ||
| # Pinned to a commit SHA; install logic lives in the action and is | ||
| # auditable/pinned (vs. a curl|bash of an unverified installer). | ||
| uses: prefix-dev/setup-pixi@5185adfbffb4bd703da3010310260805d89ebb11 # v0.9.6 | ||
| with: | ||
| pixi-version: ${{ env.PIXI_VERSION }} | ||
| run-install: false | ||
|
|
||
| - name: Update lockfile without installing | ||
| run: pixi update --no-install --manifest-path "${{ matrix.manifest }}" | ||
|
|
||
| - name: Compose PR body | ||
| id: pr-body | ||
| env: | ||
| WORKSPACE_ID: ${{ matrix.id }} | ||
| MANIFEST: ${{ matrix.manifest }} | ||
| HAS_APP_TOKEN: ${{ steps.app-token.outputs.token != '' }} | ||
| run: | | ||
| body_path="${RUNNER_TEMP}/pixi-lock-refresh-body.md" | ||
| { | ||
| echo "Automated lockfile refresh for \`${WORKSPACE_ID}\`" \ | ||
| "(\`pixi update --no-install --manifest-path ${MANIFEST}\`)." | ||
| echo | ||
| echo "This PR is workspace-scoped so other packages are not forced to review" | ||
| echo "unrelated solver churn. See #2298." | ||
| echo | ||
| if [ "${HAS_APP_TOKEN}" != "true" ]; then | ||
| echo "> [!IMPORTANT]" | ||
| echo "> No refresh App token is configured, so this PR was opened with" | ||
| echo "> \`GITHUB_TOKEN\` and GitHub will not deliver its \`pull_request\` events." | ||
| echo "> Required checks stay pending until a maintainer nudges the branch, by" | ||
| echo "> closing and reopening the PR or pushing an empty commit to it." | ||
| echo | ||
| fi | ||
| echo "If the diff looks wrong, close this PR and leave the branch deleted; the" | ||
| echo "next scheduled run opens a fresh one if an update is still needed." | ||
| } > "${body_path}" | ||
| echo "path=${body_path}" >> "${GITHUB_OUTPUT}" | ||
|
|
||
| if [ "${HAS_APP_TOKEN}" != "true" ]; then | ||
| echo "::warning::Opened with GITHUB_TOKEN; the refresh PR's checks must be triggered manually." | ||
| fi | ||
|
|
||
| - name: Open or update a lockfile-only PR | ||
| id: cpr | ||
| uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1 | ||
| with: | ||
| token: ${{ steps.app-token.outputs.token || github.token }} | ||
| add-paths: ${{ matrix.lockfile }} | ||
| commit-message: | | ||
| chore: refresh pixi.lock for ${{ matrix.id }} | ||
|
|
||
| Scheduled pixi update --no-install for this workspace only. | ||
| signoff: true | ||
| sign-commits: true | ||
| branch: ci/pixi-lock-refresh/${{ matrix.id }} | ||
| delete-branch: true | ||
| title: "chore: refresh pixi.lock (${{ matrix.id }})" | ||
| labels: | | ||
| CI/CD | ||
| dependencies | ||
| body-path: ${{ steps.pr-body.outputs.path }} | ||
| author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | ||
| committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | ||
|
|
||
| - name: Summarize | ||
| run: | | ||
| { | ||
| echo "### pixi lock refresh (${{ matrix.id }})" | ||
| echo "" | ||
| echo "- Manifest: \`${{ matrix.manifest }}\`" | ||
| echo "- Lockfile: \`${{ matrix.lockfile }}\`" | ||
| echo "- Operation: \`${{ steps.cpr.outputs.pull-request-operation }}\`" | ||
| if [ -n "${{ steps.cpr.outputs.pull-request-url }}" ]; then | ||
| echo "- PR: ${{ steps.cpr.outputs.pull-request-url }}" | ||
| else | ||
| echo "- No lockfile diff; PR not opened." | ||
| fi | ||
| } >> "$GITHUB_STEP_SUMMARY" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.