Repository navigation
Description
Description
Problem
When using build.yml with GCP Artifact Registry authenticated via Workload Identity Federation (WIF), there's no way to pass dynamically obtained access tokens to registry-auths.
WIF is the recommended keyless authentication method for GCP. It requires running google-github-actions/auth to obtain a short-lived access token at runtime — there are no static credentials to store as GitHub secrets.
Current approach (fails)
Since build.yml is a reusable workflow (runs in its own job context), WIF auth must happen in a preceding job that outputs the tokens:
jobs:
auth:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
outputs:
token: ${{ steps.auth.outputs.access_token }}
steps:
- id: auth
uses: google-github-actions/auth@v3
with:
workload_identity_provider: 'projects/123/locations/global/workloadIdentityPools/github/providers/my-provider'
service_account: 'my-sa@my-project.iam.gserviceaccount.com'
token_format: access_token
build:
needs: auth
uses: docker/github-builder/.github/workflows/build.yml@v1
with:
output: image
push: true
platforms: linux/amd64,linux/arm64
meta-images: us-docker.pkg.dev/my-project/my-repo/my-app
secrets:
registry-auths: |
- registry: us-docker.pkg.dev
username: oauth2accesstoken
password: ${{ needs.auth.outputs.token }}Result
The build fails in Login to registry step with:
Warning: Can't add secret mask for empty string in ##[add-mask] command.
Login to us-docker.pkg.dev
Password required
Root cause
google-github-actions/auth masks the access token (via ::add-mask::). GitHub Actions sanitizes masked values in job outputs when they are passed to reusable workflow secrets inputs, resulting in empty strings.
Impact
This makes build.yml incompatible with any authentication flow that requires runtime token generation, including:
- GCP Workload Identity Federation (recommended by Google, no static keys)
- AWS OIDC provider (
aws-actions/configure-aws-credentials) for ECR - Azure OIDC for ACR
- Any setup where registry credentials are obtained dynamically via GitHub's OIDC provider
All of these are the industry-recommended keyless authentication methods for their respective cloud registries.
Underlying limitation
The core issue is that reusable workflows run in an isolated job context and can only receive credentials via secrets inputs. Unlike regular actions (e.g. docker/build-push-action) that run as steps within the caller's job — where pre-auth steps like google-github-actions/auth can run beforehand — reusable workflows have no mechanism for callers to inject dynamic, runtime-obtained credentials.
Since all major cloud providers now recommend OIDC-based keyless auth (GCP WIF, AWS OIDC, Azure OIDC), and GitHub itself promotes this pattern via id-token: write permission, the current registry-auths design effectively excludes the recommended auth flow for all major cloud registries.
Environment
- Repository visibility: private
- Workflow:
docker/github-builder/.github/workflows/build.yml@v1 - Auth action:
google-github-actions/auth@v3 - Registry: Google Artifact Registry (
*-docker.pkg.dev)
Question
What options do we have to use github-builder with dynamic creds for registry auth ?
Activity
voron commentedon Mar 13, 2026
Seems to be directly related to #40
ashb commentedon Mar 18, 2026
👍 I'm interested in this for Azure container with Federated Identity.
My workaround for now was to push to ghcr from the action,, and then run a second job that uses regctl to copy from GHCR to AzureCR -- using regctl preserves the mutil arch and attestations etc.
crazy-max commentedon Apr 2, 2026
Yes this looks like the same underlying limitation as #40, but it's worth calling out separately because it blocks the recommended auth path for cloud registries, not just an arbitrary secret-passing use case.
The problem is not really GCP-specific. Any flow that mints a short-lived token at runtime and masks it, like GCP WIF, AWS OIDC for ECR, or Azure federated identity for ACR, runs into the same
workflow_callboundary. Once the value has to cross into the reusable workflow viasecrets, GitHub strips the masked output and the login step gets an empty password 😞#6 closed the original registry auth work by adding
registry-auths, which covers static credentials and multi-registry login. But the same thread also documents why dynamic OIDC/WIF tokens still fail across the reusable workflow boundary: #6 (comment)So unless the reusable workflows expose some way to perform registry login inside the caller job context, or otherwise avoids requiring dynamic credentials to cross the reusable-workflow boundary, keyless/OIDC auth for external registries is effectively unsupported.
I think the workable fix is not "pass the token in", it's "mint the token inside the reusable workflow".
For GCP Artifact Registry,
github-buildercould support optional WIF inputs such asworkload_identity_providerandservice_account, then rungoogle-github-actions/auth@v3inside the workflow before the registry login step and pass the resultingaccess_tokendirectly todocker/login-action.That avoids the current failure mode entirely because the short-lived token never has to cross the
workflow_callboundary as a secret or job output. I would not make this implicit based only onpkg.devdetection. The registry hostname does not tell the workflow which WIF provider or service account to use, and mixed-registry builds are possible. This needs explicit opt-in inputs imo.gmile commentedon May 6, 2026
I'd love to use this workflow, as it could help us consolidate a great deal of build steps. Ability to use OIDC & GCP Artifact Registry is currently the only missing piece for us.
danilohorta commentedon May 11, 2026
+1, confirming this on a third independent auth path: Chainguard's cgr.dev via chainctl OIDC.
So the surface area of this constraint is now confirmed for: GCP WIF (OP), AWS OIDC, Azure federated identity, and Chainguard OIDC-assumable identities. That's every major cloud registry's recommended keyless flow.
build/bake,build: add Chainguard OIDC keyless cgr.dev auth (opt-in)
build/bake,build: add Chainguard OIDC keyless cgr.dev auth (opt-in)
build/bake,build: add Chainguard OIDC keyless cgr.dev auth (opt-in)
build/bake,build: add Chainguard OIDC keyless cgr.dev auth (opt-in)
build/bake,build: add Chainguard OIDC keyless cgr.dev auth (opt-in)
remove use-private-image workflow
crazy-max commentedon Jul 7, 2026
Opened #244
voron commentedon Jul 8, 2026
Awesome work 👍 I'm curious if multiple registries support is somewhere in the backlog?
My case is to build arm64+amd64 images and push artifacts into multiple regions using WIF with separate creds per region:
and gcp-login action