mirror of
https://github.com/aevea/action-kaniko.git
synced 2025-01-30 22:09:37 +01:00
chore: Rename function to ensure variables being set
This commit is contained in:
parent
73a7639472
commit
edea218783
1 changed files with 7 additions and 7 deletions
|
@ -11,18 +11,18 @@ export USERNAME=${INPUT_USERNAME:-$GITHUB_ACTOR}
|
||||||
export PASSWORD=${INPUT_PASSWORD:-$GITHUB_TOKEN}
|
export PASSWORD=${INPUT_PASSWORD:-$GITHUB_TOKEN}
|
||||||
export IMAGE=$IMAGE:$TAG
|
export IMAGE=$IMAGE:$TAG
|
||||||
|
|
||||||
function sanitize() {
|
function ensure() {
|
||||||
if [ -z "${1}" ]; then
|
if [ -z "${1}" ]; then
|
||||||
echo >&2 "Unable to find the ${2}. Did you set with.${2}?"
|
echo >&2 "Unable to find the ${2} variable. Did you set with.${2}?"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
sanitize "${REGISTRY}" "registry"
|
ensure "${REGISTRY}" "registry"
|
||||||
sanitize "${USERNAME}" "username"
|
ensure "${USERNAME}" "username"
|
||||||
sanitize "${PASSWORD}" "password"
|
ensure "${PASSWORD}" "password"
|
||||||
sanitize "${IMAGE}" "image"
|
ensure "${IMAGE}" "image"
|
||||||
sanitize "${TAG}" "tag"
|
ensure "${TAG}" "tag"
|
||||||
|
|
||||||
if [ "$REGISTRY" == "docker.pkg.github.com" ]; then
|
if [ "$REGISTRY" == "docker.pkg.github.com" ]; then
|
||||||
IMAGE_NAMESPACE="$(echo $GITHUB_REPOSITORY | tr '[:upper:]' '[:lower:]')"
|
IMAGE_NAMESPACE="$(echo $GITHUB_REPOSITORY | tr '[:upper:]' '[:lower:]')"
|
||||||
|
|
Loading…
Reference in a new issue