try a kustomize build

This commit is contained in:
Blair Vanderlugt 2021-08-28 15:42:08 -07:00
parent 01c6f06b4b
commit 8f83066082
4 changed files with 37 additions and 12 deletions

View File

@ -20,24 +20,25 @@ variables:
DOCKER_BUILDKIT: "1" DOCKER_BUILDKIT: "1"
COMPOSE_DOCKER_CLI_BUILD: "1" COMPOSE_DOCKER_CLI_BUILD: "1"
CI_DEBUG_TRACE: "true" CI_DEBUG_TRACE: "true"
TAG: $CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA
before_script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
# runs on protected branches and pushes to repo # runs on protected branches and pushes to repo
build-push: build-push:
stage: build stage: build
tags: tags:
- integration - integration
before_script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
script: script:
- TAG=$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA sh ./scripts/build-push.sh - TAG=$TAG sh ./scripts/build-push.sh
rules: rules:
- if: $CI_COMMIT_REF_PROTECTED == "true" - if: $CI_COMMIT_REF_PROTECTED == "true"
when: always when: always
deploy-k8s-dev: deploy-k8s-dev:
stage: deploy stage: deploy
image: dtzar/helm-kubectl image: k8s.gcr.io/kustomize/kustomize:v3.8.7
variables: variables:
CI_DEBUG_TRACE: "true" CI_DEBUG_TRACE: "true"
script: script:
@ -55,12 +56,12 @@ deploy-k8s-dev:
- kubectl delete hr redis && kubectl delete pvc -l 'app=redis' - kubectl delete hr redis && kubectl delete pvc -l 'app=redis'
- kubectl apply -f kubernetes/eth-node/ -f kubernetes/postgresql/ -f kubernetes/redis/ - kubectl apply -f kubernetes/eth-node/ -f kubernetes/postgresql/ -f kubernetes/redis/
- echo "deploy and run database migrations..." - echo "deploy and run database migrations..."
- kubectl apply -f kubernetes/cic-auth-proxy # set image based on deploy tag
- kubectl apply -f kubernetes/cic-cache - bash ./scripts/set-image.sh
- kubectl apply -f kubernetes/cic-eth - kubectl apply -f .
- kubectl apply -f kubernetes/cic-meta
- kubectl apply -f kubernetes/cic-notify
- kubectl apply -f kubernetes/cic-staff-client
- kubectl apply -f kubernetes/cic-ussd
- echo "run contract migrations..." - echo "run contract migrations..."
- kubectl apply -f kubernetes/contract-migration/contract-migration-job.yaml - kubectl apply -f kubernetes/contract-migration/contract-migration-job.yaml
rules:
- if: $CI_COMMIT_REF_PROTECTED == "true"
when: always

View File

@ -117,6 +117,7 @@ services:
volumes: volumes:
- contract-config:/tmp/cic/config - contract-config:/tmp/cic/config
cic-cache-tracker: cic-cache-tracker:
image: registry.gitlab.com/grassrootseconomics/cic-internal-integration/cic-cache:${TAG:-latest} image: registry.gitlab.com/grassrootseconomics/cic-internal-integration/cic-cache:${TAG:-latest}
profiles: profiles:

View File

@ -0,0 +1,2 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

21
scripts/set-image.sh Executable file
View File

@ -0,0 +1,21 @@
#! /bin/bash
set -e
cd kubernetes/
kustomize edit set image registry.gitlab.com/grassrootseconomics/cic-internal-integration/cic-cache:$TAG
kustomize edit set image registry.gitlab.com/grassrootseconomics/cic-internal-integration/bloxberg-node:$TAG
kustomize edit set image registry.gitlab.com/grassrootseconomics/cic-internal-integration/contract-migration:$TAG
kustomize edit set image registry.gitlab.com/grassrootseconomics/cic-internal-integration/cic-eth:$TAG
kustomize edit set image registry.gitlab.com/grassrootseconomics/cic-internal-integration/cic-notify:$TAG
kustomize edit set image registry.gitlab.com/grassrootseconomics/cic-internal-integration/cic-meta:$TAG
kustomize edit set image registry.gitlab.com/grassrootseconomics/cic-internal-integration/cic-ussd:$TAG
echo "kustomize set image to ${TAG? no variable TAG set}"