Skip to content

CI: fix id-token permission for "Test wheels building"#820

Merged
dkropachev merged 1 commit intoscylladb:masterfrom
nikagra:ci/fix-build-test-id-token-permission
Apr 15, 2026
Merged

CI: fix id-token permission for "Test wheels building"#820
dkropachev merged 1 commit intoscylladb:masterfrom
nikagra:ci/fix-build-test-id-token-permission

Conversation

@nikagra
Copy link
Copy Markdown

@nikagra nikagra commented Apr 15, 2026

Summary

Fixes #819.

build-test.yml is triggered by pull_request, which implicitly grants id-token: none. The reusable lib-build-and-push.yml contains an upload_pypi job declaring id-token: write. GitHub enforces permissions at parse time — before evaluating any if: conditions — so the entire workflow is rejected even though upload: false means upload_pypi never actually runs.

Fix

Add permissions: id-token: write to the test-wheels-build job in build-test.yml. This satisfies GitHub's static validation while keeping the runtime behaviour unchanged — upload_pypi is still skipped via if: inputs.upload.

Verification

Tested on PR #770 by temporarily applying this change; the Test wheels building jobs transitioned from immediate parse-time failure to successful completion across all platforms (linux, linux-aarch64, macos-arm, macos-x86, windows).

  • Successful run: link
  • Run without fix: link

build-test.yml triggers on pull_request, which gives it id-token:none
by default. lib-build-and-push.yml's upload_pypi job declares
id-token:write, which exceeds the caller's cap and causes GitHub to
reject the workflow at parse time — even though upload:false prevents
upload_pypi from ever running.

Fix: explicitly grant id-token:write to the test-wheels-build job so
the permission cap satisfies the reusable workflow's requirement.

Fixes scylladb#819
@nikagra nikagra requested a review from dkropachev April 15, 2026 11:15
@Lorak-mmk
Copy link
Copy Markdown

This also gives unnecessary permissions to the whole workflow, no? This job could run perfectly well without write permissions, but now it has them.
I wonder if there are other possible solutions, for example splitting the upload job into a separate file.

@dkropachev dkropachev merged commit ee0bc66 into scylladb:master Apr 15, 2026
24 checks passed
@nikagra nikagra deleted the ci/fix-build-test-id-token-permission branch April 17, 2026 08:34
@nikagra
Copy link
Copy Markdown
Author

nikagra commented Apr 17, 2026

@Lorak-mmk This change only adds

permissions: id-token: write

to that job, not the whole workflow. It does not grant general repository write permissions (e.g., contents: write). Permissions are applied at the job level and cannot be limited to individual steps as I've checked. We can follow up by splitting the upload step into a separate job or workflow (or split the reusable workflow) so only the upload job needs id-token: write. For now this is a minimal change to get the tests running

@nikagra
Copy link
Copy Markdown
Author

nikagra commented Apr 17, 2026

@Lorak-mmk Created issue #824

nikagra added a commit to nikagra/python-driver that referenced this pull request Apr 17, 2026
…-build.yml

Closes scylladb#824. Follow-up to scylladb#820.

The upload_pypi job in lib-build-and-push.yml was never reachable: none of the
four caller workflows pass upload: true. build-push.yml and publish-manually.yml
already publish from their own separate jobs (necessary due to how PyPI Trusted
Publishing embeds the caller workflow path in the OIDC token).

Because the reusable workflow declared 'permissions: id-token: write' for
upload_pypi, GitHub's static permission validation forced build-test.yml (a
pull_request workflow, which defaults to id-token: none) to also declare
id-token: write — granting unnecessary privileges to a job that only builds
wheels.

Changes:
- Rename lib-build-and-push.yml -> lib-build.yml (it only builds now)
- Remove upload input and upload_pypi job from the reusable workflow
- Remove 'permissions: id-token: write' and 'with: upload: false' from
  build-test.yml (no longer needed)
- Update all callers (build-push.yml, publish-manually.yml, build-pre-release.yml)
  to reference the new workflow path and drop upload: false from with: blocks
- Replace TODO comments in build-push.yml and publish-manually.yml with an
  explanatory comment: the separate publish job is now intentional design,
  not a temporary workaround
dkropachev pushed a commit that referenced this pull request Apr 18, 2026
…-build.yml

Closes #824. Follow-up to #820.

The upload_pypi job in lib-build-and-push.yml was never reachable: none of the
four caller workflows pass upload: true. build-push.yml and publish-manually.yml
already publish from their own separate jobs (necessary due to how PyPI Trusted
Publishing embeds the caller workflow path in the OIDC token).

Because the reusable workflow declared 'permissions: id-token: write' for
upload_pypi, GitHub's static permission validation forced build-test.yml (a
pull_request workflow, which defaults to id-token: none) to also declare
id-token: write — granting unnecessary privileges to a job that only builds
wheels.

Changes:
- Rename lib-build-and-push.yml -> lib-build.yml (it only builds now)
- Remove upload input and upload_pypi job from the reusable workflow
- Remove 'permissions: id-token: write' and 'with: upload: false' from
  build-test.yml (no longer needed)
- Update all callers (build-push.yml, publish-manually.yml, build-pre-release.yml)
  to reference the new workflow path and drop upload: false from with: blocks
- Replace TODO comments in build-push.yml and publish-manually.yml with an
  explanatory comment: the separate publish job is now intentional design,
  not a temporary workaround
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CI: "Test wheels building" fails on every PR with id-token permission error

3 participants