Skip to content

GH-50899: [CI][C++] Use OIDC instead of ACCESS_KEY and SECRET_KEY for sccache's s3 creds - #51028

Merged
kou merged 4 commits into
apache:mainfrom
paultiq:oidc_credentials_sccache
Sep 6, 2026
Merged

GH-50899: [CI][C++] Use OIDC instead of ACCESS_KEY and SECRET_KEY for sccache's s3 creds#51028
kou merged 4 commits into
apache:mainfrom
paultiq:oidc_credentials_sccache

Conversation

@paultiq

@paultiq paultiq commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Rationale for this change

This PR moves crossbow builds to short-lived S3 credentials. It does this via GitHub's OIDC provider and an AWS ROLE_ARN with a trust relationship configured. This configuration is detailed here:

The benefits of short-lived / temporary credentials discussed further here: AWS Well-architected Framework Best Practices SEC02-BP02 Use temporary credentials

sccache supports a variety of S3 creds: S3 credentials

What changes are included in this PR?

Use AssumeRoleWithWebIdentity for sccache S3 credentials.

By assuming the AWS_ROLE_ARN, the sccache session relies on credentials that expire*, issued only to workflows in the trusted repository, and scoped to the sccache bucket.

Specific tasks:

  • create a role in IAM with the bucket and object level permissions,
  • trust the github oidc-provider,
  • define AWS_ROLE_ARN and set id-token permission
  • grant sts:AssumeRoleWithWebIdentity for the specific repositories or organization.
  • pass AWS_SESSION_TOKEN
  • add a aws-actions/configure-aws-credentials@v6 step to the workflow.

Separately, someone will need to add the role and trust to AWS:

* I can share an example if needed

Are these changes tested?

Yes, locally and on a fork.

Are there any user-facing changes?

No

@github-actions

Copy link
Copy Markdown

⚠️ GitHub issue #50899 has been automatically assigned in GitHub to PR creator.

@github-actions github-actions Bot added the awaiting review Awaiting review label Aug 28, 2026
@paultiq
paultiq marked this pull request as draft August 29, 2026 00:18
@paultiq

paultiq commented Aug 29, 2026

Copy link
Copy Markdown
Contributor Author

Per @kou 's comment #50899 (comment), leaving as draft.

I only made change to one workflow file. The other github.*.yml files will need the same change.

I tested this with archery crossbow submit test-ubuntu-24.04-cpp.

Comment thread dev/tasks/macros.jinja Outdated
Comment on lines +303 to +304
"AWS_ACCESS_KEY_ID": '${{ env.AWS_ACCESS_KEY_ID || secrets.AWS_ACCESS_KEY_ID }}',
"AWS_SECRET_ACCESS_KEY": '${{ env.AWS_SECRET_ACCESS_KEY || secrets.AWS_SECRET_ACCESS_KEY }}',

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.

Can we remove || secrets.AWS_* if we always use OIDC?

@paultiq paultiq Sep 1, 2026

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.

Yes, the || secrets.AWS_* side can go away, but you still need the env.AWS_* half (populated by aws-actions/configure-aws-credentials).

Do you want them removed in this PR?

Comment thread dev/tasks/macros.jinja Outdated

env:
ARCHERY_DEBUG: 1
SCCACHE_OIDC_ROLE: {{ '${{ secrets.AWS_ROLE_ARN }}' }}

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.

Can we use secrets.AWS_ROLE_ARN directly instead of putting it to an environment variable?

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.

The reasoning was to enable this check: if: env.SCCACHE_OIDC_ROLE != '', since you can't use a secret directly in a GHA if statement.

Alternatively, and probably preferably: could use something like SCCACHE_ENABLED (or another SCCACHE_* field) as the sentry instead of SCCACHE_OIDC_ROLE.

Perhaps SCCACHE_REGION (existing) or SCCACHE_ENABLED (new)?

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.

Or even easier, I'll just set a boolean based on whether SCCACHE_REGION is defined rather than copy it.

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.

Ah, OK. I like the current boolean based approach. Let's use it.

@github-actions github-actions Bot added awaiting changes Awaiting changes and removed awaiting review Awaiting review labels Sep 1, 2026
@kou

kou commented Sep 1, 2026

Copy link
Copy Markdown
Member

@github-actions crossbow submit test-conda-cpp

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown

Revision: d5f3f20

Submitted crossbow builds: ursacomputing/crossbow @ actions-70dbb848c1

Task Status
test-conda-cpp GitHub Actions

@github-actions github-actions Bot added awaiting change review Awaiting change review awaiting changes Awaiting changes and removed awaiting changes Awaiting changes awaiting change review Awaiting change review labels Sep 1, 2026
@kou

kou commented Sep 1, 2026

Copy link
Copy Markdown
Member

I've configured the AWS side.
Let's verify whether sccache is still used or not: https://github.com/ursacomputing/crossbow/actions/runs/33458953335/job/99715485091

@kou

kou commented Sep 1, 2026

Copy link
Copy Markdown
Member

@github-actions crossbow submit test-conda-cpp

@kou

kou commented Sep 1, 2026

Copy link
Copy Markdown
Member

I've submitted a new job with the latest changes.

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown

Revision: a630664

Submitted crossbow builds: ursacomputing/crossbow @ actions-94c11124c0

Task Status
test-conda-cpp GitHub Actions

@paultiq

paultiq commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

sccache looks right: Cache hits rate 99.80 % and Cache location s3, name: ***, prefix: /sccache/

The CI failure seems unrelated, the nightly's have been failing for a few days, including https://github.com/ursacomputing/crossbow/actions/runs/32845953016/job/97795547624

If this looks good, I have the remaining github.*.yml's ready to commit.

@kou

kou commented Sep 1, 2026

Copy link
Copy Markdown
Member

@github-actions crossbow submit test-ubuntu-22.04-cpp

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown

Revision: a630664

Submitted crossbow builds: ursacomputing/crossbow @ actions-5d1aa97c14

Task Status
test-ubuntu-22.04-cpp GitHub Actions

@paultiq

paultiq commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

This looks good to me: if you're good with it, I'll commit the other workflow yml's.

@kou

kou commented Sep 4, 2026

Copy link
Copy Markdown
Member

Please do it.

@github-actions github-actions Bot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels Sep 4, 2026
@paultiq

paultiq commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

Done.

I added continue-on-error: true to the macro: so that a credential failure doesn't stop the entire workflow. This makes it consistent with prior behavior: that sccache is an optimization but not mandatory.

@paultiq
paultiq marked this pull request as ready for review September 4, 2026 05:09
@kou

kou commented Sep 4, 2026

Copy link
Copy Markdown
Member

@github-actions crossbow submit matlab -g r -g wheel test-ubuntu-*

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown

Revision: 1497632

Submitted crossbow builds: ursacomputing/crossbow @ actions-beb4b71452

Task Status
matlab GitHub Actions
python-sdist GitHub Actions
r-binary-packages GitHub Actions
r-recheck-most GitHub Actions
test-r-alpine-linux-cran GitHub Actions
test-r-arrow-backwards-compatibility GitHub Actions
test-r-depsource-system GitHub Actions
test-r-dev-duckdb GitHub Actions
test-r-devdocs GitHub Actions
test-r-extra-packages GitHub Actions
test-r-fedora-clang GitHub Actions
test-r-gcc-11 GitHub Actions
test-r-gcc-12 GitHub Actions
test-r-install-local GitHub Actions
test-r-install-local-minsizerel GitHub Actions
test-r-linux-as-cran GitHub Actions
test-r-linux-rchk GitHub Actions
test-r-linux-sanitizers GitHub Actions
test-r-linux-valgrind GitHub Actions
test-r-m1-san GitHub Actions
test-r-macos-as-cran GitHub Actions
test-r-offline-maximal GitHub Actions
test-r-ubuntu-22.04 GitHub Actions
test-r-versions GitHub Actions
test-r-wasm GitHub Actions
test-ubuntu-22.04-cpp GitHub Actions
test-ubuntu-22.04-cpp-bundled GitHub Actions
test-ubuntu-22.04-cpp-emscripten GitHub Actions
test-ubuntu-22.04-cpp-no-threading GitHub Actions
test-ubuntu-24.04-cpp GitHub Actions
test-ubuntu-24.04-cpp-bundled-offline GitHub Actions
test-ubuntu-24.04-cpp-gcc-13-bundled GitHub Actions
test-ubuntu-24.04-cpp-gcc-14 GitHub Actions
test-ubuntu-24.04-cpp-minimal-with-formats GitHub Actions
test-ubuntu-24.04-cpp-thread-sanitizer GitHub Actions
test-ubuntu-24.04-python-3 GitHub Actions
test-ubuntu-c-glib GitHub Actions
test-ubuntu-ruby GitHub Actions
wheel-macos-monterey-cp311-cp311-amd64 GitHub Actions
wheel-macos-monterey-cp311-cp311-arm64 GitHub Actions
wheel-macos-monterey-cp312-cp312-amd64 GitHub Actions
wheel-macos-monterey-cp312-cp312-arm64 GitHub Actions
wheel-macos-monterey-cp313-cp313-amd64 GitHub Actions
wheel-macos-monterey-cp313-cp313-arm64 GitHub Actions
wheel-macos-monterey-cp314-cp314-amd64 GitHub Actions
wheel-macos-monterey-cp314-cp314-arm64 GitHub Actions
wheel-macos-monterey-cp314-cp314t-amd64 GitHub Actions
wheel-macos-monterey-cp314-cp314t-arm64 GitHub Actions
wheel-macos-monterey-cp315-cp315-amd64 GitHub Actions
wheel-macos-monterey-cp315-cp315-arm64 GitHub Actions
wheel-macos-monterey-cp315-cp315t-amd64 GitHub Actions
wheel-macos-monterey-cp315-cp315t-arm64 GitHub Actions
wheel-manylinux-2-28-cp311-cp311-amd64 GitHub Actions
wheel-manylinux-2-28-cp311-cp311-arm64 GitHub Actions
wheel-manylinux-2-28-cp312-cp312-amd64 GitHub Actions
wheel-manylinux-2-28-cp312-cp312-arm64 GitHub Actions
wheel-manylinux-2-28-cp313-cp313-amd64 GitHub Actions
wheel-manylinux-2-28-cp313-cp313-arm64 GitHub Actions
wheel-manylinux-2-28-cp314-cp314-amd64 GitHub Actions
wheel-manylinux-2-28-cp314-cp314-arm64 GitHub Actions
wheel-manylinux-2-28-cp314-cp314t-amd64 GitHub Actions
wheel-manylinux-2-28-cp314-cp314t-arm64 GitHub Actions
wheel-manylinux-2-28-cp315-cp315-amd64 GitHub Actions
wheel-manylinux-2-28-cp315-cp315-arm64 GitHub Actions
wheel-manylinux-2-28-cp315-cp315t-amd64 GitHub Actions
wheel-manylinux-2-28-cp315-cp315t-arm64 GitHub Actions
wheel-musllinux-1-2-cp311-cp311-amd64 GitHub Actions
wheel-musllinux-1-2-cp311-cp311-arm64 GitHub Actions
wheel-musllinux-1-2-cp312-cp312-amd64 GitHub Actions
wheel-musllinux-1-2-cp312-cp312-arm64 GitHub Actions
wheel-musllinux-1-2-cp313-cp313-amd64 GitHub Actions
wheel-musllinux-1-2-cp313-cp313-arm64 GitHub Actions
wheel-musllinux-1-2-cp314-cp314-amd64 GitHub Actions
wheel-musllinux-1-2-cp314-cp314-arm64 GitHub Actions
wheel-musllinux-1-2-cp314-cp314t-amd64 GitHub Actions
wheel-musllinux-1-2-cp314-cp314t-arm64 GitHub Actions
wheel-musllinux-1-2-cp315-cp315-amd64 GitHub Actions
wheel-musllinux-1-2-cp315-cp315-arm64 GitHub Actions
wheel-musllinux-1-2-cp315-cp315t-amd64 GitHub Actions
wheel-musllinux-1-2-cp315-cp315t-arm64 GitHub Actions
wheel-windows-cp311-cp311-amd64 GitHub Actions
wheel-windows-cp312-cp312-amd64 GitHub Actions
wheel-windows-cp313-cp313-amd64 GitHub Actions
wheel-windows-cp314-cp314-amd64 GitHub Actions
wheel-windows-cp314-cp314t-amd64 GitHub Actions
wheel-windows-cp315-cp315-amd64 GitHub Actions
wheel-windows-cp315-cp315t-amd64 GitHub Actions

@kou kou left a comment

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.

+1

@kou
kou merged commit 120b0b7 into apache:main Sep 6, 2026
58 of 59 checks passed
@kou kou removed the awaiting change review Awaiting change review label Sep 6, 2026
@github-actions github-actions Bot added the awaiting merge Awaiting merge label Sep 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting merge Awaiting merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants