From e0e8e3ee1748c55b723d9c3e3f34d6cd5329327d Mon Sep 17 00:00:00 2001 From: ketzacoatl Date: Fri, 14 Apr 2017 11:00:51 -0400 Subject: [PATCH] update CI spec to use Gitlab review apps Summary of changes: * rename DOCKER_IMAGE to DEPLOYMENT_IMAGE * docker image builds now run for any branch/tag * include jobs for deploying and stopping the review app on kube * review apps are deployed to the `fpco-untrusted` cluster * review apps are available based the following URL scheme: https://stackage-server-$CI_BUILD_REF_SLUG.review.fpco-untrusted.fpcomplete.com/ * master deploys to prod, and the previous staging env has been dropped * import the kube specs we've used in CI/prod, update to use envvars for APPROOT, DEPLOYMENT_APP, DEPLOYMENT_NAME, and DEPLOYMENT_IMAGE --- .gitlab-ci.yml | 57 +++++++++++++++++++++---------- etc/kube/deployment_template.yaml | 53 ++++++++++++++++++++++++++++ etc/kube/service_template.yaml | 19 +++++++++++ 3 files changed, 111 insertions(+), 18 deletions(-) create mode 100644 etc/kube/deployment_template.yaml create mode 100644 etc/kube/service_template.yaml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c05fafb..6720e83 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -13,7 +13,9 @@ stages: variables: STACK_ROOT: "${CI_PROJECT_DIR}/.stack-root" - DOCKER_IMAGE: "${CI_REGISTRY_IMAGE}:${CI_BUILD_REF_SLUG}_${CI_PIPELINE_ID}" + DEPLOYMENT_IMAGE: "${CI_REGISTRY_IMAGE}:${CI_BUILD_REF_SLUG}_${CI_PIPELINE_ID}" + DEPLOYMENT_NAME: "stackage-server-${CI_BUILD_REF_SLUG}" + DEPLOYMENT_APP: "${CI_ENVIRONMENT_SLUG}" # This creates anchors for bits of script that are reused between builds .anchors: @@ -23,48 +25,67 @@ variables: kubectl config set-cluster cluster --server="$KUBE_URL" --certificate-authority="$HOME/ca.pem" && kubectl config set-credentials cluster --token="$KUBE_TOKEN" && kubectl config set-context cluster --cluster=cluster --user=cluster --namespace="$KUBE_NAMESPACE" && kubectl config use-context cluster + - &KUBEAPPLY + kubectl apply -f <(envsubst