build/bake: support Docker Hub OIDC registry identities#265
Conversation
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
| - | ||
| name: Login to Docker Hub with OIDC | ||
| if: ${{ needs.registry-identities.outputs.dockerhub-oidc-enabled == 'true' }} | ||
| uses: docker/login-action@abd2ef45e78c5afb21d64d4ca52ee8550d9572c7 # v4.5.1 | ||
| env: | ||
| DOCKERHUB_OIDC_CONNECTIONID: ${{ needs.registry-identities.outputs.dockerhub-oidc-connection-id }} | ||
| with: | ||
| registry-auth: | | ||
| - registry: ${{ needs.registry-identities.outputs.dockerhub-oidc-registry }} | ||
| username: ${{ needs.registry-identities.outputs.dockerhub-oidc-username }} |
There was a problem hiding this comment.
My AI frend flagged this:
The pinned docker/login-action requests a 300-second Docker Hub OIDC token unless DOCKERHUB_OIDC_EXPIREIN is set.
This login runs before the full build-and-push step. Docker stores that token as the registry password, so a build lasting more than five minutes can fail when BuildKit requests authorization during the push.
Set DOCKERHUB_OIDC_EXPIREIN: 3600 in the Docker Hub login steps, including the equivalent bake.yml block, or otherwise refresh credentials before registry operations.
The verify and finalize jobs should use the longer lifetime too if they can process many images.
There was a problem hiding this comment.
He's wrong, the expire-in doesn't apply to the auth to the registry but the mint token used before authenticating.
follow-up docker/login-action#1054
This adds Docker Hub OIDC support to registry identities so
build.yml,bake.yml, andverify.ymlcan authenticate to Docker Hub without passing a Docker Hub token through the reusable workflow boundary.The registry identity setup workflow now accepts
type: dockerhubwith a username, connection ID, and optional registry value that defaults to Docker Hub. The build, bake, and verify workflows mint the Docker Hub token inside each job throughdocker/login-actionand pass the resolved registry into the login step.This keeps Docker Hub OIDC aligned with the existing registry identity model while avoiding token plumbing between jobs. The registry remains configurable instead of being hardcoded, and callers can keep using
registry-authsfor static credentials alongside keyless registry identities.