Skip to content

Commit

Permalink
Add script for kubernetes deployment (#939)
Browse files Browse the repository at this point in the history
* add script for kubernetes deployment

Signed-off-by: Max Fisher <[email protected]>

* fix shellcheck warnings

Signed-off-by: Max Fisher <[email protected]>

* address review comments

Signed-off-by: Max Fisher <[email protected]>

---------

Signed-off-by: Max Fisher <[email protected]>
Signed-off-by: Max Fisher <[email protected]>
  • Loading branch information
maxfisher-g authored Oct 26, 2023
1 parent 1649e35 commit 0cd31f7
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions infra/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#! /bin/bash

if [[ -z ${GIT_TAG} ]]; then
echo "Missing git tag"
exit 1
fi

echo "git checkout ${GIT_TAG}"
git checkout "${GIT_TAG}"

if ! git diff-index --quiet HEAD; then
echo "there are uncommitted changes, please ensure the repo is clean"
exit 1
fi

gcloud container clusters get-credentials analysis-cluster --zone=us-central1-c --project=ossf-malware-analysis

pushd infra/worker || echo "pushd infra/worker failed" && exit 1

echo "Were any changes made to the k8s config?"
echo "Enter y to apply config changes and then restart workers, n to just restart, ctrl-C to exit"
read -r yn
case $yn in
[Yy]* )
echo "kubectl apply -f $(pwd)"
kubectl apply -f .
;;
[Nn]* )
echo "kubectl rollout restart statefulset workers-deployment"
kubectl rollout restart statefulset workers-deployment
;;
esac


popd || echo "failed to popd" && exit 1

0 comments on commit 0cd31f7

Please sign in to comment.