diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index dbb2c985..862c89da 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,5 +1,5 @@ variables: - 2019_CONTAINER_IMAGE=asia.gcr.io/linuxconfsydney/symposion_app_2019 + CONTAINER_IMAGE_2019: "asia.gcr.io/linuxconfsydney/symposion_app_2019" DOCKER_DRIVER: overlay2 build_image: @@ -39,15 +39,15 @@ k8s-prod-deploy: url: https://rego.linux.conf.au build_review_deployment: - image: sparkprime/jsonnet + image: docker:git services: - docker:dind stage: build script: - - docker run -v ${PWD}/k8s:/src sparkprime/jsonnet /src/deployment_template.jsonnet --tla-str slug="${CI_COMMIT_REF_SLUG}" > ${CI_COMMIT_REF_SLUG}.json + - docker run -v "${PWD}"/k8s:/src sparkprime/jsonnet /src/deployment_template.jsonnet --tla-str slug="${CI_COMMIT_REF_SLUG}" > "${CI_COMMIT_REF_SLUG}".json artifacts: paths: - - ${CI_COMMIT_REF_SLUG}.json + - "${CI_COMMIT_REF_SLUG}.json" build_2019_dev_image: image: docker:git @@ -56,15 +56,15 @@ build_2019_dev_image: - docker:dind script: - docker login -u _json_key -p "$GOOGLE_KEY" https://asia.gcr.io - - docker pull "${2019_CONTAINER_IMAGE}"_dev:latest || true - - docker build --cache-from "${2019_CONTAINER_IMAGE}"_dev:latest -f docker/Dockerfile -t "${2019_CONTAINER_IMAGE}":$CI_COMMIT_SHA . - - docker build --build-arg CI_COMMIT_SHA=$CI_COMMIT_SHA -f docker/Dockerfile.dev -t "${2019_CONTAINER_IMAGE}"_dev:$CI_COMMIT_SHA . - - docker push "${2019_CONTAINER_IMAGE}":$CI_COMMIT_SHA - - docker push "${2019_CONTAINER_IMAGE}"_dev:$CI_COMMIT_SHA - - docker tag "${2019_CONTAINER_IMAGE}"_dev:$CI_COMMIT_SHA "${2019_CONTAINER_IMAGE}"_dev:latest - - docker tag "${2019_CONTAINER_IMAGE}"_dev:$CI_COMMIT_SHA "${2019_CONTAINER_IMAGE}"_dev:$CI_COMMIT_REF_SLUG - - docker push "${2019_CONTAINER_IMAGE}"_dev:latest - - docker push "${2019_CONTAINER_IMAGE}"_dev:${CI_COMMIT_REF_SLUG} + - docker pull "${CONTAINER_IMAGE_2019}"_dev:latest || true + - docker build --cache-from "${CONTAINER_IMAGE_2019}"_dev:latest -f docker/Dockerfile -t "${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}":$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:latest + - docker tag "${CONTAINER_IMAGE_2019}"_dev:$CI_COMMIT_SHA "${CONTAINER_IMAGE_2019}"_dev:$CI_COMMIT_REF_SLUG + - docker push "${CONTAINER_IMAGE_2019}"_dev:latest + - docker push "${CONTAINER_IMAGE_2019}"_dev:${CI_COMMIT_REF_SLUG} except: - master @@ -76,7 +76,7 @@ k8s-2019_dev-deploy: - 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="${2019_CONTAINER_IMAGE}"_dev:$CI_COMMIT_SHA + - kubectl --token "${GL_KUBE_TOKEN}" set image deployment/symposion-app symposion-app="${CONTAINER_IMAGE_2019}"_dev:$CI_COMMIT_SHA only: - dev/2019 environment: @@ -124,7 +124,7 @@ k8s-2019_staging-deploy: - kubectl config set-cluster cluster --server="${KUBE_SERVER}" --embed-certs=true --certificate-authority=cert.crt - kubectl config set-context cluster --cluster=cluster --namespace=lca2019-staging --user=gitlab-ci - kubectl config use-context cluster - - kubectl --token "${GL_KUBE_TOKEN}" set image deployment/symposion-app symposion-app="${2019_CONTAINER_IMAGE}"_dev:$CI_COMMIT_SHA + - kubectl --token "${GL_KUBE_TOKEN}" set image deployment/symposion-app symposion-app="${CONTAINER_IMAGE_2019}"_dev:$CI_COMMIT_SHA when: manual only: - dev/2019 diff --git a/k8s/deployment_template.jsonnet b/k8s/deployment_template.jsonnet index 61f35ba5..a7a6e63a 100644 --- a/k8s/deployment_template.jsonnet +++ b/k8s/deployment_template.jsonnet @@ -85,15 +85,6 @@ function (slug) { "secretName": tls_secret } ] - }, - "status": { - "loadBalancer": { - "ingress": [ - { - "ip": "127.0.0.1" - } - ] - } } }, { @@ -119,9 +110,6 @@ function (slug) { }, "sessionAffinity": "None", "type": "ClusterIP" - }, - "status": { - "loadBalancer": {} } }, {