Commit f4f06232 authored by Matija Obreza's avatar Matija Obreza
Browse files

Using processed IMAGE_TAG for docker image and review deployment

parent fcfe31c4
......@@ -43,9 +43,9 @@ docker image:
- cp target/*.war docker
- cd docker
- if [ "${CI_COMMIT_REF_SLUG}" = "master" ] ; then
IMAGE_TAG=${GENESYS_VERSION};
export IMAGE_TAG="${GENESYS_VERSION}";
else
IMAGE_TAG=${GENESYS_VERSION}-${CI_COMMIT_REF_SLUG};
export IMAGE_TAG="${GENESYS_VERSION}-${CI_COMMIT_REF_SLUG}";
fi
- "echo The image tag: ${IMAGE_TAG}"
- ${DOCKER_CMD} build -t ${CI_REGISTRY_IMAGE}:${IMAGE_TAG} .
......@@ -64,7 +64,6 @@ deploy for review:
url: https://${CI_COMMIT_REF_SLUG}.review.genesys-pgr.org
on_stop: remove review instance
script:
- echo Deploying for review as https\://${CI_COMMIT_REF_SLUG}.review.genesys\-pgr.org
# Address the swarm
- export DOCKER_HOST=swarm.genesys-pgr.org
# Configuration
......@@ -78,13 +77,14 @@ deploy for review:
# Actions
- apk add --no-cache gettext
- if [ "${CI_COMMIT_REF_SLUG}" = "master" ] ; then
IMAGE_TAG=${GENESYS_VERSION};
export IMAGE_TAG="${GENESYS_VERSION}";
else
IMAGE_TAG=${GENESYS_VERSION}-${CI_COMMIT_REF_SLUG};
export IMAGE_TAG="${GENESYS_VERSION}-${CI_COMMIT_REF_SLUG}";
fi
- echo Deploying ${CI_REGISTRY_IMAGE}:${IMAGE_TAG} for review as https\://${CI_COMMIT_REF_SLUG}.review.genesys\-pgr.org
- envsubst < docker/review-compose-template.yml > review-composed.yml
- cat review-composed.yml
- ${DOCKER_CMD} stack deploy -c review-composed.yml genesys-${CI_COMMIT_REF_SLUG}
- ${DOCKER_CMD} stack deploy -c review-composed.yml genesys-${CI_COMMIT_REF_SLUG}-review
remove review instance:
stage: deploy
......@@ -96,7 +96,7 @@ remove review instance:
name: review/$CI_COMMIT_REF_SLUG
action: stop
script:
- echo Removing review 'https\://${CI_COMMIT_REF_SLUG}.review.genesys\-pgr.org'
- echo Removing review https\://${CI_COMMIT_REF_SLUG}.review.genesys\-pgr.org
# Address the swarm
- export DOCKER_HOST=swarm.genesys-pgr.org
# Configuration
......@@ -108,7 +108,7 @@ remove review instance:
- export DOCKER_CERT_PATH=${TLS_PATH}
- DOCKER_CMD=docker
# Actions
- ${DOCKER_CMD} stack rm genesys-${CI_COMMIT_REF_SLUG}
- ${DOCKER_CMD} stack rm genesys-${CI_COMMIT_REF_SLUG}-review
deploy on staging server:
stage: deploy
......@@ -116,7 +116,19 @@ deploy on staging server:
variables:
GIT_STRATEGY: none
script:
- echo "Deploying on staging server"
- echo Deploying to staging server
# Address the swarm
- export DOCKER_HOST=swarm.genesys-pgr.org
# Configuration
- TLS_PATH=~/.docker/${DOCKER_HOST}/certs && mkdir -p ${TLS_PATH}
- echo "${DOCKER_TLS_CA}" > ${TLS_PATH}/ca.pem
- echo "${DOCKER_TLS_KEY}" > ${TLS_PATH}/key.pem
- echo "${DOCKER_TLS_CERT}" > ${TLS_PATH}/cert.pem
- export DOCKER_TLS_VERIFY=1
- export DOCKER_CERT_PATH=${TLS_PATH}
- DOCKER_CMD=docker
# Actions
# - ${DOCKER_CMD} stack rm genesys-${CI_COMMIT_REF_SLUG}-review
only:
- staging
environment:
......
Markdown is supported
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