Commit 6731ad30 authored by Matija Obreza's avatar Matija Obreza
Browse files

CI: Updated tagging of edge, latest docker images

- latest is triggered manually
parent 72602764
......@@ -88,8 +88,18 @@ pages:
- echo "${DOCKER_TLS_KEY}" > ${TLS_PATH}/key.pem
- echo "${DOCKER_TLS_CERT}" > ${TLS_PATH}/cert.pem
- export DOCKER_CERT_PATH=${TLS_PATH}
- if [ "${CI_COMMIT_REF_SLUG}" = "${CI_DEFAULT_BRANCH}" ] ; then
export IMAGE_TAG="${VERSION}-edge";
else
if echo "${CI_COMMIT_TAG}" | grep -Eq 'v\d+.*'; then
export IMAGE_TAG=${CI_COMMIT_TAG:1};
else
export IMAGE_TAG="${VERSION}-${CI_COMMIT_REF_SLUG}";
fi
fi
- DOCKER_CMD="docker --tlsverify=false"
dockerize server:
<<: *docker_setup
stage: dockerize
......@@ -107,15 +117,6 @@ dockerize server:
- echo Building docker image ${CI_REGISTRY_IMAGE} on ${DOCKER_HOST}
- cp target/*.war docker
- cd docker
- if [ "${CI_COMMIT_REF_SLUG}" = "${CI_DEFAULT_BRANCH}" ] ; then
export IMAGE_TAG="${VERSION}-edge";
else
if echo "${CI_COMMIT_TAG}" | grep -Eq 'v\d+.*'; then
export IMAGE_TAG=${CI_COMMIT_TAG:1};
else
export IMAGE_TAG="${VERSION}-${CI_COMMIT_REF_SLUG}";
fi
fi
- "echo Building image: ${CI_REGISTRY_IMAGE}:${IMAGE_TAG}"
- DOCKER_BUILDKIT=1 ${DOCKER_CMD} build --target=jetty --progress=plain -t ${CI_REGISTRY_IMAGE}:${IMAGE_TAG} .
- ${DOCKER_CMD} login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
......@@ -129,12 +130,14 @@ tag latest image:
- dockerize server
rules:
- if: '$CI_COMMIT_TAG =~ /^v\d+.*/'
when: manual
allow_failure: true
<<: *docker_setup
script:
- "echo Tagging: ${CI_REGISTRY_IMAGE}:${VERSION} as ${CI_REGISTRY_IMAGE}:latest"
- "echo Tagging: ${CI_REGISTRY_IMAGE}:${IMAGE_TAG} as ${CI_REGISTRY_IMAGE}:latest"
- ${DOCKER_CMD} login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- ${DOCKER_CMD} pull ${CI_REGISTRY_IMAGE}:${VERSION}
- ${DOCKER_CMD} tag ${CI_REGISTRY_IMAGE}:${VERSION} ${CI_REGISTRY_IMAGE}:latest
- ${DOCKER_CMD} pull ${CI_REGISTRY_IMAGE}:${IMAGE_TAG}
- ${DOCKER_CMD} tag ${CI_REGISTRY_IMAGE}:${IMAGE_TAG} ${CI_REGISTRY_IMAGE}:latest
- ${DOCKER_CMD} push ${CI_REGISTRY_IMAGE}:latest
- ${DOCKER_CMD} logout $CI_REGISTRY
......@@ -149,10 +152,11 @@ tag edge image:
allow_failure: true
<<: *docker_setup
script:
- "echo Tagging: ${CI_REGISTRY_IMAGE}:${VERSION}-edge as ${CI_REGISTRY_IMAGE}:edge"
# IMAGE_TAG is VERSION-edge for main branch
- "echo Tagging: ${CI_REGISTRY_IMAGE}:${IMAGE_TAG} as ${CI_REGISTRY_IMAGE}:edge"
- ${DOCKER_CMD} login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- ${DOCKER_CMD} pull ${CI_REGISTRY_IMAGE}:${VERSION}-edge
- ${DOCKER_CMD} tag ${CI_REGISTRY_IMAGE}:${VERSION}-edge ${CI_REGISTRY_IMAGE}:edge
- ${DOCKER_CMD} pull ${CI_REGISTRY_IMAGE}:${IMAGE_TAG}
- ${DOCKER_CMD} tag ${CI_REGISTRY_IMAGE}:${IMAGE_TAG} ${CI_REGISTRY_IMAGE}:edge
- ${DOCKER_CMD} push ${CI_REGISTRY_IMAGE}:edge
- ${DOCKER_CMD} logout $CI_REGISTRY
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment