From 959aefd856f5d12a66f3a3e2467f283f8a72dc92 Mon Sep 17 00:00:00 2001 From: Ben Stevens Date: Fri, 21 Jun 2019 19:39:58 +1000 Subject: [PATCH] Re-enable CI --- .gitlab-ci-disabled.yml => .gitlab-ci.yml | 66 +++++++++++++++++++---- 1 file changed, 57 insertions(+), 9 deletions(-) rename .gitlab-ci-disabled.yml => .gitlab-ci.yml (71%) diff --git a/.gitlab-ci-disabled.yml b/.gitlab-ci.yml similarity index 71% rename from .gitlab-ci-disabled.yml rename to .gitlab-ci.yml index 4926af63..4af69218 100644 --- a/.gitlab-ci-disabled.yml +++ b/.gitlab-ci.yml @@ -1,5 +1,6 @@ variables: CONTAINER_IMAGE_2019: "asia.gcr.io/linuxconfsydney/symposion_app_2019" + CONTAINER_IMAGE_2020: "asia.gcr.io/linuxconfsydney/symposion_app_2020" DOCKER_DRIVER: overlay2 build_image: @@ -53,24 +54,40 @@ build_review_deployment: - k8s/ingress.json - k8s/certificate.json -build_2019_image: +build_2020_image: image: docker:git stage: build services: - docker:dind script: - docker login -u _json_key -p "$GOOGLE_KEY" https://asia.gcr.io - - docker pull "${CONTAINER_IMAGE_2019}":latest || true - - docker build --cache-from "${CONTAINER_IMAGE_2019}":latest -f docker/Dockerfile -t "${CONTAINER_IMAGE_2019}":$CI_COMMIT_SHA . - - docker push "${CONTAINER_IMAGE_2019}":$CI_COMMIT_SHA - - docker build --build-arg CI_COMMIT_SHA=$CI_COMMIT_SHA -f docker/Dockerfile.dev -t "${CONTAINER_IMAGE_2019}"_dev:$CI_COMMIT_SHA . - - docker push "${CONTAINER_IMAGE_2019}"_dev:$CI_COMMIT_SHA - - docker tag "${CONTAINER_IMAGE_2019}"_dev:$CI_COMMIT_SHA "${CONTAINER_IMAGE_2019}"_dev:$CI_COMMIT_REF_SLUG - - docker push "${CONTAINER_IMAGE_2019}"_dev:$CI_COMMIT_REF_SLUG + - docker pull "${CONTAINER_IMAGE_2020}":latest || true + - docker build --cache-from "${CONTAINER_IMAGE_2020}":latest -f docker/Dockerfile -t "${CONTAINER_IMAGE_2020}":$CI_COMMIT_SHA . + - docker push "${CONTAINER_IMAGE_2020}":$CI_COMMIT_SHA + - docker build --build-arg CI_COMMIT_SHA=$CI_COMMIT_SHA -f docker/Dockerfile.dev -t "${CONTAINER_IMAGE_2020}"_dev:$CI_COMMIT_SHA . + - docker push "${CONTAINER_IMAGE_2020}"_dev:$CI_COMMIT_SHA + - docker tag "${CONTAINER_IMAGE_2020}"_dev:$CI_COMMIT_SHA "${CONTAINER_IMAGE_2020}"_dev:$CI_COMMIT_REF_SLUG + - docker push "${CONTAINER_IMAGE_2020}"_dev:$CI_COMMIT_REF_SLUG except: - - "2019" + - "2020" - "master" +2020-prod-deploy: + 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=lca2020-prod --user=gitlab-ci + - kubectl config use-context cluster + - kubectl --token "${GL_KUBE_TOKEN}" set image deployment/symposion-app symposion-app="${CONTAINER_IMAGE_2020}":$CI_COMMIT_SHA + only: + - "2020" + when: manual + environment: + name: 2020/prod + url: https://lca2020.linux.conf.au + 2019-prod-deploy: image: google/cloud-sdk @@ -88,6 +105,21 @@ build_2019_image: name: 2019/prod url: https://2019.linux.conf.au +2020_dev-deploy: + 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=rego-dev --user=gitlab-sa + - kubectl config use-context cluster + - kubectl --token "${GL_KUBE_TOKEN}" set image deployment/symposion-app symposion-app="${CONTAINER_IMAGE_2020}"_dev:$CI_COMMIT_SHA + only: + - dev/2020 + environment: + name: 2020/dev + url: https://2020-dev.lca2019.org + 2019_dev-deploy: image: google/cloud-sdk stage: deploy @@ -141,6 +173,22 @@ build_2019_image: url: https://${CI_COMMIT_REF_SLUG}.dev.lca2019.org action: stop +2020_staging-deploy: + 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=lca2020-staging --user=gitlab-ci + - kubectl config use-context cluster + - kubectl --token "${GL_KUBE_TOKEN}" set image deployment/symposion-app symposion-app="${CONTAINER_IMAGE_2020}"_dev:$CI_COMMIT_SHA + when: manual + only: + - dev/2020 + environment: + name: 2020/staging + url: https://staging2020.lca2019.org + 2019_staging-deploy: image: google/cloud-sdk stage: deploy