Skip to content
Permalink
Browse files

Test against fresh builds (#1420)

* load docker-image into kind

* Set build tags

* docker parallel build

* uncomment docker build

* Use kustomize in deploy scripts

* Install kustomize
  • Loading branch information
gdbelvin committed Jan 2, 2020
1 parent 2fbe72e commit e5421fbba015c6c043ff66357f54d8df9ce8b457
Showing with 23 additions and 10 deletions.
  1. +2 −0 .travis.yml
  2. +7 −9 scripts/deploy.sh
  3. +1 −0 scripts/docker-compose_test.sh
  4. +13 −1 scripts/kubernetes_test.sh
@@ -40,6 +40,7 @@ jobs:
- name: "kubernetes test"
install:
- curl -LO "https://storage.googleapis.com/kubernetes-release/release/v1.16.3/bin/linux/amd64/kubectl" && chmod +x kubectl && sudo mv kubectl /usr/local/bin/
- curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash && sudo mv kustomize /usr/local/bin/
- go get sigs.k8s.io/kind@v0.6.1
- kind create cluster --config deploy/kubernetes/kind-config.yaml
- kubectl cluster-info --context kind-kind
@@ -49,6 +50,7 @@ jobs:
if: branch = master AND type != pull_request
install:
- curl -LO "https://storage.googleapis.com/kubernetes-release/release/v1.16.3/bin/linux/amd64/kubectl" && chmod +x kubectl && sudo mv kubectl /usr/local/bin/
- curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash && sudo mv kustomize /usr/local/bin/
- openssl aes-256-cbc -K $encrypted_555d9b2948d2_key -iv $encrypted_555d9b2948d2_iv
-in client_secrets.json.enc -d | gcloud auth activate-service-account --key-file /dev/stdin
script: ./scripts/deploy.sh
@@ -45,8 +45,7 @@ if ! kubectl get secret kt-secrets; then
fi

echo "Building docker images..."
docker-compose build

docker-compose build --parallel

echo "Pushing docker images..."
docker-compose push
@@ -59,11 +58,10 @@ gcloud --quiet container images add-tag gcr.io/${PROJECT_NAME_CI}/keytransparenc


echo "Updating jobs..."
cd deploy/kubernetes/base
kustomize edit set image gcr.io/${PROJECT_NAME_CI}/prometheus:${TRAVIS_COMMIT}
kustomize edit set image gcr.io/${PROJECT_NAME_CI}/keytransparency-monitor:${TRAVIS_COMMIT}
kustomize edit set image gcr.io/${PROJECT_NAME_CI}/keytransparency-sequencer:${TRAVIS_COMMIT}
kustomize edit set image gcr.io/${PROJECT_NAME_CI}/keytransparency-server:${TRAVIS_COMMIT}
cd -
kubectl apply -k deploy/kubernetes/overlays/gke
kubectl set image deploy/prometheus prometheus=gcr.io/${PROJECT_NAME_CI}/prometheus:${TRAVIS_COMMIT}
kubectl set image deploy/log-server log-server=gcr.io/${PROJECT_NAME_CI}/log-server:${TRAVIS_COMMIT}
kubectl set image deploy/log-signer log-signer=gcr.io/${PROJECT_NAME_CI}/log-signer:${TRAVIS_COMMIT}
kubectl set image deploy/map-server map-server=gcr.io/${PROJECT_NAME_CI}/map-server:${TRAVIS_COMMIT}
kubectl set image deploy/server server=gcr.io/${PROJECT_NAME_CI}/keytransparency-server:${TRAVIS_COMMIT}
kubectl set image deploy/sequencer sequencer=gcr.io/${PROJECT_NAME_CI}/keytransparency-sequencer:${TRAVIS_COMMIT}
kubectl set image deploy/monitor monitor=gcr.io/${PROJECT_NAME_CI}/keytransparency-monitor:${TRAVIS_COMMIT}
@@ -6,6 +6,7 @@ if [ ! -f genfiles/server.key ]; then
./scripts/prepare_server.sh -f
fi

docker-compose build --parallel
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d
trap "docker-compose down" INT EXIT

@@ -7,6 +7,19 @@ set -o pipefail
# kind create cluster --config deploy/kubernetes/kind-config.yaml
# kubectl cluster-info --context kind-kind

# Build docker images and make them available inside of the k8 cluster
export TRAVIS_COMMIT=${TRAVIS_COMMIT:-$(git rev-parse HEAD)}
docker-compose build --parallel
kind load docker-image gcr.io/key-transparency/keytransparency-monitor:${TRAVIS_COMMIT}
kind load docker-image gcr.io/key-transparency/keytransparency-sequencer:${TRAVIS_COMMIT}
kind load docker-image gcr.io/key-transparency/keytransparency-server:${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}
cd -

# kubectl exits with 1 if kt-secret does not exist
if ! kubectl get secret kt-secrets; then
echo "Generating keys..."
@@ -18,7 +31,6 @@ fi
# Hack to wait for the default service account's creation. https://github.com/kubernetes/kubernetes/issues/66689
n=0; until ((n >= 60)); do kubectl -n default get serviceaccount default -o name && break; n=$((n + 1)); sleep 1; done; ((n < 60))


kubectl apply -k deploy/kubernetes/overlays/local
trap "kubectl delete -k deploy/kubernetes/overlays/local" INT EXIT
TIMEOUT=2m

0 comments on commit e5421fb

Please sign in to comment.
You can’t perform that action at this time.