constellation/test/initiategcloud.sh
Leonard Cohnen 2d8fcd9bf4 monorepo
Co-authored-by: Malte Poll <mp@edgeless.systems>
Co-authored-by: katexochen <katexochen@users.noreply.github.com>
Co-authored-by: Daniel Weiße <dw@edgeless.systems>
Co-authored-by: Thomas Tendyck <tt@edgeless.systems>
Co-authored-by: Benedict Schlueter <bs@edgeless.systems>
Co-authored-by: leongross <leon.gross@rub.de>
Co-authored-by: Moritz Eckert <m1gh7ym0@gmail.com>
2022-03-22 16:09:39 +01:00

47 lines
1.1 KiB
Bash

#! /bin/bash
export GOOGLE_APPLICATION_CREDENTIALS="/root/.config/gcloud/application_default_credentials.json"
echo "$GCLOUD_CREDENTIALS" >> /root/.config/gcloud/application_default_credentials.json
echo "$GITHUB_TOKEN" >> /root/.netrc
terminate() {
err=$?
pkill kubectl
./constellation terminate
exit $err
}
trap terminate ERR
BRANCH="${BRANCH:-main}"
git clone --branch $BRANCH https://github.com/edgelesssys/constellation-coordinator.git
mkdir -p constellation-coordinator/build
cd constellation-coordinator/build
cmake ..
make -j"$(nproc)" cli
./constellation create gcp 2 n2d-standard-2 -y
echo "Initializing constellation"
./constellation init --privatekey /privatekey
export KUBECONFIG="./admin.conf"
kubectl wait --for=condition=ready --timeout=60s --all nodes
kubectl apply -k github.com/BuoyantIO/emojivoto/kustomize/deployment
echo "Wait for service to be applied"
kubectl wait --for=condition=available --timeout=60s -n emojivoto --all deployments
kubectl -n emojivoto port-forward svc/web-svc 8080:80 &
sleep 5
curl http://localhost:8080
exit_code=$?
terminate