From 97757028d2abaa0b23239646feb8a45d5ef7afb5 2019-06-17 12:55:39 From: Ben Stevens Date: 2019-06-17 12:55:39 Subject: [PATCH] Addition of 'release/' branch logic --- diff --git a/.gitlab-ci-disabled.yml b/.gitlab-ci.yml similarity index 83% rename from .gitlab-ci-disabled.yml rename to .gitlab-ci.yml index 4926af63b7b9f1c2b1bba0026ff943b417212653..2544c9f883ee4f1374815f7dcc34065f20b14304 100644 --- a/.gitlab-ci-disabled.yml +++ b/.gitlab-ci.yml @@ -1,5 +1,8 @@ variables: CONTAINER_IMAGE_2019: "asia.gcr.io/linuxconfsydney/symposion_app_2019" + CONTAINER_IMAGE_FROM_DEV: "asia.gcr.io/linuxconfsydney/symposion_app_${CI_COMMIT_REF_NAME#dev/}" + CONTAINER_IMAGE_FROM_RELEASE: "asia.gcr.io/linuxconfsydney/symposion_app_${CI_COMMIT_REF_NAME#release/}" + NAMESPACE_FROM_RELEASE: "lca${CI_COMMIT_REF_NAME#release/}-prod" DOCKER_DRIVER: overlay2 build_image: @@ -20,6 +23,19 @@ build_image: only: - master +build_release_image: + image: docker:git + stage: build + services: + - docker:dind + script: + - docker build -f docker/Dockerfile -t ${CONTAINER_IMAGE_FROM_RELEASE}:latest -t ${CONTAINER_IMAGE_FROM_RELEASE}:$CI_COMMIT_SHA . + - docker login -u _json_key -p "$GOOGLE_KEY" https://asia.gcr.io + - docker push ${CONTAINER_IMAGE_FROM_RELEASE}:$CI_COMMIT_SHA + - docker push ${CONTAINER_IMAGE_FROM_RELEASE}:latest + only: + - /^release\/.*$/ + k8s-prod-deploy: image: google/cloud-sdk stage: deploy @@ -72,6 +88,22 @@ build_2019_image: - "master" +deploy-release: + image: google/cloud-sdk + stage: deploy + script: + - echo "${CA_CERT}" > cert.crt + - kubectl config set-cluster cluster --server="${KUBE_SERVER}" --embed-certs=true --certificate-authority=cert.crt + - kubectl config set-context cluster --cluster=cluster --namespace=${NAMESPACE_FROM_RELEASE} --user=gitlab-ci + - kubectl config use-context cluster + - kubectl --token "${GL_KUBE_TOKEN}" set image deployment/symposion-app symposion-app="${CONTAINER_IMAGE_FROM_RELEASE}":$CI_COMMIT_SHA + only: + - /^release\/.*$/ + environment: + name: 2020/prod + url: https://2020.linux.conf.au + + 2019-prod-deploy: image: google/cloud-sdk stage: deploy