renamed drone kaniko build file, correct build branch/tag image variables, added global TAG_PREFIX/TAG_SUFFIX
This commit is contained in:
parent
5c351564c2
commit
2bba189a8f
@ -1,9 +1,11 @@
|
|||||||
.BuildImageWithKaniko: &BuildImageWithKaniko
|
.ContainerImageKaniko: &ContainerImageKaniko
|
||||||
name: BuildImageWithKaniko
|
name: ContainerImageKaniko
|
||||||
image: gcr.io/kaniko-project/executor:debug
|
image: gcr.io/kaniko-project/executor:debug
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
KANIKO_ARGS: ""
|
KANIKO_ARGS: ""
|
||||||
|
TAG_PREFIX: ""
|
||||||
|
TAG_SUFFIX: ""
|
||||||
TAG_COMMIT_ENABLE: "true"
|
TAG_COMMIT_ENABLE: "true"
|
||||||
TAG_COMMIT_PREFIX: "commit-"
|
TAG_COMMIT_PREFIX: "commit-"
|
||||||
TAG_REF_SLUG_ENABLE: "false"
|
TAG_REF_SLUG_ENABLE: "false"
|
||||||
@ -29,20 +31,19 @@
|
|||||||
# default tag based on commit
|
# default tag based on commit
|
||||||
- |
|
- |
|
||||||
if [[ "$TAG_COMMIT_ENABLE" == "true" ]]; then
|
if [[ "$TAG_COMMIT_ENABLE" == "true" ]]; then
|
||||||
IMAGE_DESTS="$IMAGE_DESTS --destination $CI_REGISTRY_IMAGE:$TAG_COMMIT_PREFIX$CI_COMMIT_SHA"
|
IMAGE_DESTS="$IMAGE_DESTS --destination $CI_REGISTRY_IMAGE:$TAG_PREFIX$TAG_COMMIT_PREFIX$CI_COMMIT_SHA$TAG_SUFFIX"
|
||||||
fi
|
|
||||||
|
|
||||||
# add tag for reference if available using slug
|
|
||||||
- |
|
|
||||||
if [[ "$TAG_REF_SLUG_ENABLE" == "true" ]] && [[ ! -z $CI_COMMIT_REF_NAME ]]; then
|
|
||||||
IMAGE_DESTS="$IMAGE_DESTS --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# add tag for reference if available using normalization
|
# add tag for reference if available using normalization
|
||||||
|
# - attempt to build tag first
|
||||||
|
# - attempt to build branch if not a PR (if not PR for extra security, variable description on drone unclear)
|
||||||
- |
|
- |
|
||||||
if [[ "$TAG_REF_NORMALIZED_ENABLE" == "true" ]] && [[ ! -z $CI_COMMIT_REF_NAME ]]; then
|
if [[ "$TAG_REF_NORMALIZED_ENABLE" == "true" ]] && [[ ! -z $DRONE_TAG ]]; then
|
||||||
REF_TAG_NORMALIZED=$(echo $CI_COMMIT_REF_NAME | sed s:/:-:g)
|
REF_TAG_NORMALIZED=$(echo $DRONE_TAG | sed s:/:-:g)
|
||||||
IMAGE_DESTS="$IMAGE_DESTS --destination $CI_REGISTRY_IMAGE:$REF_TAG_NORMALIZED"
|
IMAGE_DESTS="$IMAGE_DESTS --destination $CI_REGISTRY_IMAGE:$TAG_PREFIX$REF_TAG_NORMALIZED$TAG_SUFFIX"
|
||||||
|
elif [[ "$TAG_REF_NORMALIZED_ENABLE" == "true" ]] && [[ -z "$DRONE_PULL_REQUEST" ]] && [[ ! -z $DRONE_BRANCH ]]; then
|
||||||
|
REF_TAG_NORMALIZED=$(echo $DRONE_BRANCH | sed s:/:-:g)
|
||||||
|
IMAGE_DESTS="$IMAGE_DESTS --destination $CI_REGISTRY_IMAGE:$TAG_PREFIX$REF_TAG_NORMALIZED$TAG_SUFFIX"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- |
|
- |
|
||||||
Loading…
Reference in New Issue
Block a user