forked from mailgun/gubernator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck-version.sh
executable file
·40 lines (34 loc) · 1011 Bytes
/
check-version.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/sh
# Check version consistency across repo.
# Use git tag as reference version string.
# Strip leading 'v'.
VERSION=$(git describe --tags $(git rev-list --tags --max-count=1) | sed -e 's/^v//')
if [ -z "$VERSION" ]; then
echo "Unable to determine version from git tags." >&2
exit 1
fi
echo "Version tag: $VERSION"
RETCODE=0
# Check version file.
if [ ! "v$VERSION" = "$(cat version)" ]; then
echo "version file mismatch: v$VERSION <=> $(cat version)" >&2
RETCODE=1
else
echo 'version file OK'
fi
# Check Helm chart.
HELM_VERSION=$(yq .version charts/gubernator/Chart.yaml)
if [ "$VERSION" != "$HELM_VERSION" ]; then
echo "Helm chart version mismatch: $VERSION <=> $HELM_VERSION" >&2
RETCODE=1
else
echo 'Helm chart version OK'
fi
HELM_APPVERSION=$(yq .appVersion charts/gubernator/Chart.yaml)
if [ "$VERSION" != "$HELM_APPVERSION" ]; then
echo "Helm chart appVersion mismatch: $VERSION <=> $HELM_APPVERSION" >&2
RETCODE=1
else
echo 'Helm chart appVersion OK'
fi
exit $RETCODE