This repository has been archived by the owner on Feb 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The current deployable check does not allow to redeploy the same deployment once again. Meaning if your deployment gets corrupted somehow you cannot delete it and deploy it again. As an example, Airflow (jobflow) currently as a bug due to missing support for certain kubernetes resources which can have it looses track of some of the resources it created in k8s. The only work around seem to delete and create again the deployment (_cf._ apache/airflow#21087).
- Loading branch information
Showing
2 changed files
with
50 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/usr/bin/env sh | ||
|
||
set -eu | ||
|
||
fatal() { | ||
printf "$*\n" >/dev/stderr | ||
exit 1 | ||
} | ||
|
||
usage() { | ||
cat <<EOF | ||
usage: $0 OPTIONS <name> | ||
OPTIONS | ||
-h display help | ||
-p tag pattern (default: $pattern) | ||
EOF | ||
} | ||
|
||
pattern="*" | ||
|
||
OPTIND=1 | ||
while getopts 'hp:' arg; do | ||
case "$arg" in | ||
h) usage; exit 0 ;; | ||
p) pattern="$OPTARG" ;; | ||
?) fatal "unknown option" ;; | ||
esac | ||
done | ||
shift $((OPTIND - 1)) | ||
|
||
if [ ! -d ".git" ]; then | ||
fatal "no git repository found" | ||
fi | ||
|
||
last_tag=$(git tag --sort version:refname --list "$pattern" | tail -1) | ||
if [ -z "$last_tag" ]; then | ||
exit 0 | ||
fi | ||
|
||
deployed_sha1=$(git rev-parse "$last_tag") | ||
current_sha1=$(git rev-parse HEAD) | ||
|
||
if [ "${deployed_sha1}" != "${current_sha1}" ] | ||
then | ||
fatal "the current build is older than the deployed one" | ||
fi |
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