Last active
April 12, 2017 19:49
-
-
Save pfeodrippe/116c8b570ee2ffcdce8aa15bbae5a22b to your computer and use it in GitHub Desktop.
Git pre-push hook for deis slugbuild deletion (see more at issue https://github.com/deis/builder/issues/487)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
url="$2" | |
# Please, set your preferred kubectl context! | |
if [[ $url == *"deis-builder"* ]]; then | |
app_name=$(basename $url | cut -f 1 -d '.') | |
echo "Using app $app_name for slugbuild detection" | |
pod_name=$(kubectl -n deis get pods --output=jsonpath='{.items[*].metadata.name}' -a | xargs -n1 | grep 'slugbuild-'$app_name) | |
if [ -z $pod_name ]; then | |
echo "Slugbuild not found for app $app_name" | |
else | |
echo "Slugbuild found! Deleting pod $pod_name..." | |
echo $(kubectl -n deis delete pod $pod_name) | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment