Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Commit

Permalink
Refactor: Move kustomize set image to it's own script (#1475)
Browse files Browse the repository at this point in the history
* Refactor: Move kustomize set image to it's own script

This aids development by breaking the scripts into separate steps that can be run individually
  • Loading branch information
gdbelvin authored Feb 26, 2020
1 parent 843f369 commit ba1c7e0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
8 changes: 1 addition & 7 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,5 @@ echo "Pushing docker images..."
docker-compose push

echo "Updating jobs..."
cd deploy/kubernetes/base
kustomize edit set image gcr.io/key-transparency/keytransparency-monitor:${TRAVIS_COMMIT}
kustomize edit set image gcr.io/key-transparency/keytransparency-sequencer:${TRAVIS_COMMIT}
kustomize edit set image gcr.io/key-transparency/keytransparency-server:${TRAVIS_COMMIT}
kustomize edit set image gcr.io/key-transparency/prometheus:${TRAVIS_COMMIT}
kustomize edit set image gcr.io/key-transparency/init:${TRAVIS_COMMIT}
cd -
./scripts/kustomize_image_tag.sh $TRAVIS_COMMIT
kubectl apply -k deploy/kubernetes/overlays/gke
8 changes: 1 addition & 7 deletions scripts/kubernetes_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,7 @@ kind load docker-image gcr.io/key-transparency/keytransparency-server:${TRAVIS_C
kind load docker-image gcr.io/key-transparency/prometheus:${TRAVIS_COMMIT}
kind load docker-image gcr.io/key-transparency/init:${TRAVIS_COMMIT}

cd deploy/kubernetes/base
kustomize edit set image gcr.io/key-transparency/keytransparency-monitor:${TRAVIS_COMMIT}
kustomize edit set image gcr.io/key-transparency/keytransparency-sequencer:${TRAVIS_COMMIT}
kustomize edit set image gcr.io/key-transparency/keytransparency-server:${TRAVIS_COMMIT}
kustomize edit set image gcr.io/key-transparency/prometheus:${TRAVIS_COMMIT}
kustomize edit set image gcr.io/key-transparency/init:${TRAVIS_COMMIT}
cd -
./scripts/kustomize_image_tag.sh $TRAVIS_COMMIT

# kubectl exits with 1 if kt-secret does not exist
if ! kubectl get secret kt-tls; then
Expand Down
15 changes: 15 additions & 0 deletions scripts/kustomize_image_tag.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash
set -ex

# This script sets the image tag used by kustomize.
# It takes an optional argument specifying the image tag.
# If the argument is omitted, the script will use the current git commit as the tag.
TRAVIS_COMMIT=${1:-$(git rev-parse HEAD)}
cd deploy/kubernetes/base
kustomize edit set image gcr.io/key-transparency/keytransparency-monitor:${TRAVIS_COMMIT}
kustomize edit set image gcr.io/key-transparency/keytransparency-sequencer:${TRAVIS_COMMIT}
kustomize edit set image gcr.io/key-transparency/keytransparency-server:${TRAVIS_COMMIT}
kustomize edit set image gcr.io/key-transparency/prometheus:${TRAVIS_COMMIT}
kustomize edit set image gcr.io/key-transparency/init:${TRAVIS_COMMIT}
cd -

0 comments on commit ba1c7e0

Please sign in to comment.