Skip to content

Commit

Permalink
Login to docker registry host instead of full registry
Browse files Browse the repository at this point in the history
  • Loading branch information
calind committed Dec 9, 2021
1 parent 2ab9ba5 commit 34f4b94
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions images/build/root/usr/local/bin/setup-credentials-helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
: "${DOCKER_PASSWORD:="$PLUGIN_DOCKER_PASSWORD"}"
: "${DOCKER_REGISTRY:="${PLUGIN_DOCKER_REGISTRY:-docker.io}"}"

DOCKER_REGISTRY_HOST="$(echo "${DOCKER_REGISTRY}" | awk 'BEGIN{ FS="/" }{print $1}')"

export PATH="$CI_WORKSPACE/bin:$PATH"

require_param() {
Expand All @@ -34,8 +36,8 @@ run() {

if [ -n "$DOCKER_PASSWORD" ] ; then
require_param DOCKER_USERNAME
echo "+ docker login $DOCKER_REGISTRY -u $DOCKER_USERNAME"
docker login "$DOCKER_REGISTRY" -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"
echo "+ docker login $DOCKER_REGISTRY_HOST -u $DOCKER_USERNAME"
echo "$DOCKER_PASSWORD" | docker login "$DOCKER_REGISTRY_HOST" -u "$DOCKER_USERNAME" --password-stdin
fi

if [ -n "$GOOGLE_CREDENTIALS" ] ; then
Expand Down

0 comments on commit 34f4b94

Please sign in to comment.