include:
- local: '/base/gcp-k8s-auth.yml'
.gcp_deploy:
extends: .gcp_k8s_auth
stage: deploy
script:
- cd k8s/$APP/overlays/$OVERLAY/
- kustomize edit set image $CI_REGISTRY_IMAGE=$NEW_IMAGE
- kustomize build . | kubectl apply -f -
allow_failure: false
include:
- local: '/base/gcp-k8s-auth.yml'
# ------------------------------ DEPLOY ---------------------------------------
# This CI template consists of two parts:
# - Auth
# - Deploy
# [[ AUTH ]] - authenticates against a GCP cluster
# - ZONE - GCP cluster zone (e.g. us-east1-b)
# - PROJECT - GCP project ID
# - CLUSTER - name of the cluster to authenticate to
# - SERVICE_ACCOUNT_CREDENTIALS - JSON credentials for the service account
# [[ DEPLOY ]] - deploys from path `k8s/$APP/overlays/$OVERLAY`
# - APP - app to deploy
# - OLD_IMAGE - specify this only if you want the image changed; default value is $CI_REGISTRY_IMAGE (will change the image each time the job is run)
# - NEW_IMAGE - image:tag you want the OLD_IMAGE replaced with. Defaults to $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA in the template
# - OVERLAY - overlay you want the deploy
.gcp_k8s_deploy:
extends: .gcp_k8s_auth
stage: deploy
variables:
OLD_IMAGE: $CI_REGISTRY_IMAGE
NEW_IMAGE: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
script:
- cd k8s/$APP/overlays/$OVERLAY/
- kustomize edit set image $OLD_IMAGE=$NEW_IMAGE
- kustomize build . | kubectl apply -f -
allow_failure: false
......@@ -2,6 +2,20 @@
include:
- local: '/base/gcp-k8s-auth.yml'
# This CI template consists of two parts:
# - Auth
# - Diff test
# [[ AUTH ]] - authenticates against a GCP cluster
# - ZONE - GCP cluster zone (e.g. us-east1-b)
# - PROJECT - GCP project ID
# - CLUSTER - name of the cluster to authenticate to
# - SERVICE_ACCOUNT_CREDENTIALS - JSON credentials for the service account
# [[ K8S TEST ]] - tests k8s coniguration in path `k8s/$APP/overlays/$OVERLAY`
# - APP - app which should have its k8s config tested
# - OVERLAY - overlay you want the deploy
.gcp_k8s_diff:
extends: .gcp_k8s_auth
script:
......