Set the deployment to use a SHA rather than the SLUG

This will ensure that the deployment gets updated when we deploy
This commit is contained in:
James Polley 2018-06-24 23:00:40 +10:00
parent bdc976d77b
commit 0231f3ff46
2 changed files with 6 additions and 7 deletions

View file

@ -44,7 +44,7 @@ build_review_deployment:
- docker:dind - docker:dind
stage: build stage: build
script: script:
- docker run -v "${PWD}"/k8s:/src sparkprime/jsonnet /src/deployment_template.jsonnet --tla-str slug="${CI_COMMIT_REF_SLUG}" -m /src - docker run -v "${PWD}"/k8s:/src sparkprime/jsonnet /src/deployment_template.jsonnet --tla-str slug="${CI_COMMIT_REF_SLUG}" --tla-str sha="${CI_COMMIT_SHA}" -m /src
artifacts: artifacts:
paths: paths:
- k8s/deployment.json - k8s/deployment.json
@ -63,10 +63,8 @@ build_2019_dev_image:
- docker build --build-arg CI_COMMIT_SHA=$CI_COMMIT_SHA -f docker/Dockerfile.dev -t "${CONTAINER_IMAGE_2019}"_dev:$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}":$CI_COMMIT_SHA
- docker push "${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:latest
- docker tag "${CONTAINER_IMAGE_2019}"_dev:$CI_COMMIT_SHA "${CONTAINER_IMAGE_2019}"_dev:$CI_COMMIT_REF_SLUG - 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
- docker push "${CONTAINER_IMAGE_2019}"_dev:${CI_COMMIT_REF_SLUG}
except: except:
- master - master

View file

@ -1,4 +1,4 @@
function (slug) { function (slug, sha) {
local app = "symposion-app-" + slug, local app = "symposion-app-" + slug,
local namespace = "rego-review", local namespace = "rego-review",
@ -61,7 +61,8 @@ function (slug) {
"template": { "template": {
"metadata": { "metadata": {
"labels": { "labels": {
"app": "symposion-app" "app": "symposion-app",
"slug": slug
} }
}, },
"spec": { "spec": {
@ -101,7 +102,7 @@ function (slug) {
"value": "LAPTOP" "value": "LAPTOP"
}, },
], ],
"image": "asia.gcr.io/linuxconfsydney/symposion_app_2019_dev:" + slug, "image": "asia.gcr.io/linuxconfsydney/symposion_app_2019_dev:" + sha,
"imagePullPolicy": "Always", "imagePullPolicy": "Always",
"livenessProbe": { "livenessProbe": {
"failureThreshold": 3, "failureThreshold": 3,