Re-enable CI

This commit is contained in:
Ben Stevens 2019-06-21 19:39:58 +10:00
parent d4f7f82994
commit 959aefd856

View file

@ -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