From 2bac030dfdcd371857ceb0cc3dbec5a20d15e9f5 Mon Sep 17 00:00:00 2001 From: Kevin Dorner Date: Fri, 9 Sep 2022 09:22:16 +0200 Subject: [PATCH] Preliminary cleanup of plugin.sh --- plugin.sh | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/plugin.sh b/plugin.sh index 31e8cd3..bba5755 100755 --- a/plugin.sh +++ b/plugin.sh @@ -4,12 +4,12 @@ set -euo pipefail export PATH=$PATH:/kaniko/ -REGISTRY=${PLUGIN_REGISTRY:-index.docker.io} +REGISTRY=${PLUGIN_REGISTRY:-docker.io} if [ "${PLUGIN_USERNAME:-}" ] || [ "${PLUGIN_PASSWORD:-}" ]; then DOCKER_AUTH=`echo -n "${PLUGIN_USERNAME}:${PLUGIN_PASSWORD}" | base64 | tr -d "\n"` - cat > /kaniko/.docker/config.json < /kaniko/.docker/config.json </dev/null && isNum=1 || isNum=0 + echo ${TAG} | grep -E "[a-z-]" &>/dev/null && isNum=1 || isNum=0 - if [ ! -n "${TAG:-}" ];then + if [ ! -n "${TAG:-}" ]; then echo "latest" > .tags - elif [ ${isNum} -eq 1 -o ${part} -gt 3 ];then + elif [ ${isNum} -eq 1 -o ${tag_part_count} -gt 3 ]; then echo "${TAG},latest" > .tags else - major=$(echo "${TAG}" |awk -F'.' '{print $1}') - minor=$(echo "${TAG}" |awk -F'.' '{print $2}') - release=$(echo "${TAG}" |awk -F'.' '{print $3}') + major=$(echo "${TAG}" | awk -F'.' '{print $1}') + minor=$(echo "${TAG}" | awk -F'.' '{print $2}') + release=$(echo "${TAG}" | awk -F'.' '{print $3}') major=${major:-0} minor=${minor:-0}