Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
To get around GoogleContainerTools/kaniko#1209 we need to auth using the
DockerHub v1 API. As that variable is the "registry" and we have to use
a FQDN with Protocol we have to convert to standard registry format for
tagging the image, otherwise there's an issue with the auth mechanism
where it attempts to normalize the URL and incorrectly parses it.

GoogleContainerTools/kaniko#1209
  • Loading branch information
drGrove committed Jun 1, 2021
1 parent d7dc90b commit a80e893
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion plugin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -euo pipefail

export PATH=$PATH:/kaniko/

REGISTRY=${PLUGIN_REGISTRY:-index.docker.io}
REGISTRY=${PLUGIN_REGISTRY:-https://index.docker.io/v1/}

if [ "${PLUGIN_USERNAME:-}" ] || [ "${PLUGIN_PASSWORD:-}" ]; then
DOCKER_AUTH=`echo -n "${PLUGIN_USERNAME}:${PLUGIN_PASSWORD}" | base64 | tr -d "\n"`
Expand All @@ -20,6 +20,12 @@ if [ "${PLUGIN_USERNAME:-}" ] || [ "${PLUGIN_PASSWORD:-}" ]; then
DOCKERJSON
fi

# If we're using dockerhub we have to convert from URL with protocol to
# standard format for use throughout the rest of the system
if [ "${REGISTRY}" == "https://index.docker.io/v1/" ]; then
REGISTRY="docker.io"
fi

if [ "${PLUGIN_JSON_KEY:-}" ];then
echo "${PLUGIN_JSON_KEY}" > /kaniko/gcr.json
export GOOGLE_APPLICATION_CREDENTIALS=/kaniko/gcr.json
Expand Down

0 comments on commit a80e893

Please sign in to comment.