Skip to content

Commit

Permalink
scripts: Add missing env vars to enable anon auth when push=false
Browse files Browse the repository at this point in the history
This commit adds two missing environment variables that allow for
anonymous authentication to remote registries when pushing build results
is disabled. Pulls and remote digest checks are read-only operations
that do not require credentials, however however, if credentials are not
set during a non-push build, some steps may return an error that looks
like this:

```
sha256:0e59c8168a48aa9ed0573be2d38d40a95e1b1635877d6e3dd56dfd33e3597e56
pulling image moby/buildkit:buildx-stable-1 done
ERROR: error getting credentials - err: exit status 1, out: `ANY_REGISTRY_USERNAME is not set`
```

The above example was triggered while building the `image-maker` image
in the call to `docker buildx build`. This bug prevents PRs from forks
from running the "Build all images" workflow to test their changes, making
it more difficult for members of the community who don't have write access
to this repository to open PRs.

Signed-off-by: Ryan Drew <[email protected]>
  • Loading branch information
learnitall committed Jun 27, 2024
1 parent b737762 commit 2577810
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions scripts/build-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ do_build="${FORCE:-false}"
do_push="${PUSH:-false}"
output="type=image,push=${do_push}"

if [ "${do_push}" == "false" ]; then
export DOCKER_HUB_PUBLIC_ACCESS_ONLY=true
export QUAY_PUBLIC_ACCESS_ONLY=true
fi

do_export="${EXPORT:-false}"

if [ "${with_root_context}" = "false" ] ; then
Expand Down

0 comments on commit 2577810

Please sign in to comment.