Uh oh!
There was an error while loading. Please reload this page.
add registry-login input for optional registry auth before build - #117
add registry-login input for optional registry auth before build#117crazy-max wants to merge 1 commit into
Conversation
97e2afd to
e36e467Compare
tonistiigi
left a comment
There was a problem hiding this comment.
I'm not sure why this isn't the default.
If this is to prevent early login for public pull then that could be handled with the scope property.
If this is needed, then why isn't it in registry auth config, per-registry?
Good point. I tested this and registry-login: ${{ github.event_name != 'pull_request' || !github.event.pull_request.head.repo.fork }}This is similar to what we do in our repos like https://github.com/moby/buildkit-bench/blob/0ba0908a5f906bc469d6ebdca9731942432c81c9/.github/workflows/ci.yml#L81 but here we gate the login-action. Alternatively we would have a new secrets:
registry-auths: | - registry: docker.io username: ${{ vars.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} skip: ${{ github.event_name = 'pull_request' }}Or secrets:
registry-auths: | - registry: docker.io username: ${{ vars.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} enable: ${{ github.event_name != 'pull_request' }}WDYT? |
tonistiigi
commented
Feb 20, 2026
Or just skip automatically if "password" (or any other credential method) is empty? |
crazy-max
commented
Feb 23, 2026
If we have OIDC in play in the future, |
crazy-max
commented
Feb 23, 2026
Opened docker/login-action#925 |
crazy-max
commented
Apr 13, 2026
Ok after thinking more about it, I think this should stay explicit in github-builder. The need to skip login on fork PRs is workflow/event policy, not really registry auth schema. |
tonistiigi
commented
Apr 22, 2026
I'm not sure I understand this. If the whole block is empty then no login. How would the login even be possible anyway in this case.
If the whole definition is defining if login should happen before build or after then how is this different from scope? Pull scope means pre-build (even on local output)? |
crazy-max
commented
Apr 24, 2026
Ok to clarify the "non-empty YAML but empty creds" case: callers usually pass a literal YAML block in secrets:
registry-auths: | - registry: docker.io username: ${{ vars.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }}On a fork PR,
For Using |
c2bfaf8 to
53c2c61CompareSigned-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This PR adds a
registry-logininput to both reusable workflows to control whether registry login happens before the build step. The input supportsauto,true, andfalse:autopreserves the current behavior and enables login only whenoutput=imageandpush=truetruealways attempts a pre-build loginfalsedisables pre-build loginThis makes pre-build registry authentication available for cases such as local output or non-push builds, while keeping the default behavior unchanged.