Skip to content
Snippets Groups Projects
Verified Commit cdcf71b6 authored by Varac's avatar Varac
Browse files

Fix image tag

parent c098f935
No related branches found
No related tags found
No related merge requests found
Pipeline #75774 passed
include:
- remote: https://open.greenhost.net/stackspin/stackspin/raw/main/.gitlab/ci_templates/kaniko.yml
# - remote: https://open.greenhost.net/stackspin/stackspin/raw/main/.gitlab/ci_templates/kaniko.yml
- .kaniko.yaml
build:
stage: build
......
# Optional environment variables:
#
# - KANIKO_BUILD_IMAGENAME: Build/target image name.
# If empty, image URL will be the root of the gitlab project path, i.e.
# `open.greenhost.net:4567/GROUP/PROJECT:TAG
# Is set, images will be named like
# `open.greenhost.net:4567/GROUP/PROJECT/KANIKO_BUILD_IMAGENAME:TAG
#
# - KANIKO_CONTEXT: The subdir which holds the Dockerfile, leave unset if
# the Dockerfile is located at root level of the project.
#
# - KANIKO_ADDITIONAL_ARGS: This variable allows you to pass in ARG values that
# are used at build time. Similarly to Docker you can specify multiple arguments
# using the format `--build-arg NAME=VALUE` as many times as you need.
#
# - KANIKO_TAG: Allows to override the name of the resulting image tag
.kaniko_build:
stage: build
image:
# We need a shell to provide the registry credentials, so we need to use the
# kaniko debug image (https://github.com/GoogleContainerTools/kaniko#debug-image)
name: gcr.io/kaniko-project/executor:v1.6.0-debug
entrypoint: [""]
script:
- mkdir -p /kaniko/.docker/
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- if [ -n "${KANIKO_BUILD_IMAGENAME}" ]; then export IMAGENAME="/${KANIKO_BUILD_IMAGENAME}"; fi
# Convert tag according to docker standards (https://docs.docker.com/engine/reference/commandline/tag/#extended-description)
- if [ -n "${KANIKO_TAG}" ]; then export TAG="${KANIKO_TAG}"; else TAG="$(echo "${CI_COMMIT_REF_NAME}" | sed 's/[^a-zA-Z0-9.-_]/-/g' | cut -c -128 )"; fi
- /kaniko/executor --cache=true --context ${CI_PROJECT_DIR}/${KANIKO_CONTEXT:-.} --dockerfile ${CI_PROJECT_DIR}/${KANIKO_CONTEXT:-.}/Dockerfile --destination ${CI_REGISTRY_IMAGE}${IMAGENAME}:${TAG} ${KANIKO_ADDITIONAL_ARGS}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment