Fix some more linting issues (#5)

This commit is contained in:
6543 2024-01-12 22:22:45 +01:00 committed by GitHub
parent 7afb9b9b04
commit c9a21e5884
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 18 deletions

View File

@ -29,7 +29,7 @@ steps:
image: alpine:3.19 image: alpine:3.19
commands: commands:
- apk add -U shellcheck - apk add -U shellcheck
- shellcheck -e SC3040 -e SC3010 -e SC3037 -e SC2086 -e SC2166 -e SC2002 -e SC2236 -e SC3020 -e SC2162 *.sh - shellcheck -e SC3040 -e SC3010 -e SC3037 -e SC3020 -e SC2162 *.sh
# TODO: add test of fresh build kaniko # TODO: add test of fresh build kaniko

View File

@ -65,11 +65,11 @@ if [[ "${PLUGIN_AUTO_TAG:-}" == "true" ]]; then
TAG=$(echo "${DRONE_TAG:-}" |sed 's/^v//g') TAG=$(echo "${DRONE_TAG:-}" |sed 's/^v//g')
part=$(echo "${TAG}" |tr '.' '\n' |wc -l) part=$(echo "${TAG}" |tr '.' '\n' |wc -l)
# expect number # expect number
echo ${TAG} |grep -E "[a-z-]" &>/dev/null && isNum=1 || isNum=0 echo "${TAG}" |grep -E "[a-z-]" &>/dev/null && isNum=1 || isNum=0
if [ ! -n "${TAG:-}" ];then if [ -z "${TAG:-}" ]; then
echo "latest" > .tags echo "latest" > .tags
elif [ ${isNum} -eq 1 -o ${part} -gt 3 ];then elif [ "${isNum}" -eq 1 ] || [ "${part}" -gt 3 ]; then
echo "${TAG},latest" > .tags echo "${TAG},latest" > .tags
else else
major=$(echo "${TAG}" |awk -F'.' '{print $1}') major=$(echo "${TAG}" |awk -F'.' '{print $1}')
@ -85,13 +85,13 @@ if [[ "${PLUGIN_AUTO_TAG:-}" == "true" ]]; then
fi fi
if [ -n "${PLUGIN_MIRRORS:-}" ]; then if [ -n "${PLUGIN_MIRRORS:-}" ]; then
MIRROR="$(echo $PLUGIN_MIRRORS | tr ',' '\n' | while read mirror; do echo "--registry-mirror=${mirror}"; done)" MIRROR="$(echo "${PLUGIN_MIRRORS}" | tr ',' '\n' | while read mirror; do echo "--registry-mirror=${mirror}"; done)"
fi fi
if [ -n "${PLUGIN_TAGS:-}" ]; then if [ -n "${PLUGIN_TAGS:-}" ]; then
DESTINATIONS=$(echo "${PLUGIN_TAGS}" | tr ',' '\n' | while read tag; do echo "--destination=${REGISTRY}/${PLUGIN_REPO}:${tag} "; done) DESTINATIONS=$(echo "${PLUGIN_TAGS}" | tr ',' '\n' | while read tag; do echo "--destination=${REGISTRY}/${PLUGIN_REPO}:${tag} "; done)
elif [ -f .tags ]; then elif [ -f .tags ]; then
DESTINATIONS=$(cat .tags| tr ',' '\n' | while read tag; do echo "--destination=${REGISTRY}/${PLUGIN_REPO}:${tag} "; done) DESTINATIONS=$(tr ',' '\n' < .tags | while read tag; do echo "--destination=${REGISTRY}/${PLUGIN_REPO}:${tag} "; done)
elif [ -n "${PLUGIN_REPO:-}" ]; then elif [ -n "${PLUGIN_REPO:-}" ]; then
DESTINATIONS="--destination=${REGISTRY}/${PLUGIN_REPO}:latest" DESTINATIONS="--destination=${REGISTRY}/${PLUGIN_REPO}:latest"
else else
@ -100,15 +100,15 @@ else
CACHE="" CACHE=""
fi fi
/kaniko/executor -v ${LOG} \ /kaniko/executor -v "${LOG}" \
--context=${CONTEXT} \ --context="${CONTEXT}" \
--dockerfile=${DOCKERFILE} \ --dockerfile="${DOCKERFILE}" \
${EXTRA_OPTS} \ "${EXTRA_OPTS}" \
${DESTINATIONS} \ "${DESTINATIONS}" \
${CACHE:-} \ "${CACHE:-}" \
${CACHE_TTL:-} \ "${CACHE_TTL:-}" \
${CACHE_REPO:-} \ "${CACHE_REPO:-}" \
${TARGET:-} \ "${TARGET:-}" \
${BUILD_ARGS:-} \ "${BUILD_ARGS:-}" \
${BUILD_ARGS_FROM_ENV:-} \ "${BUILD_ARGS_FROM_ENV:-}" \
${MIRROR:-} "${MIRROR:-}"