forked from grafana/loki
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelease_prepare.sh
executable file
·85 lines (73 loc) · 3.32 KB
/
release_prepare.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/bin/bash
# sed-wrap runs the appropriate sed command based on the
# underlying value of $OSTYPE
sed-wrap() {
if [[ "${OSTYPE}" == "linux"* ]]; then
# Linux
sed -i "$1" "$2"
else
# macOS, BSD
sed -i '' "$1" "$2"
fi
}
echo
echo "Last 5 tags:"
git tag --sort=-taggerdate | head -n 5
echo
read -rp "Enter release version: " VERSION
if [[ ${VERSION} =~ ^v[0-9]+\.[0-9]+\.[0-9]+.*$ ]]; then
echo "New Version: ${VERSION}"
else
echo "Version must be in the format v0.1.0"
exit 1
fi
LOKI_CURRENT=$(sed -n -e 's/^version: //p' production/helm/loki/Chart.yaml)
LOKI_SUGGESTED=$(tools/increment_version.sh -m "${LOKI_CURRENT}")
PROMTAIL_CURRENT=$(sed -n -e 's/^version: //p' production/helm/promtail/Chart.yaml)
PROMTAIL_SUGGESTED=$(tools/increment_version.sh -m "${PROMTAIL_CURRENT}")
LOKI_STACK_CURRENT=$(sed -n -e 's/^version: //p' production/helm/loki-stack/Chart.yaml)
LOKI_STACK_SUGGESTED=$(tools/increment_version.sh -m "${LOKI_STACK_CURRENT}")
echo
echo "Current Loki helm chart version: ${LOKI_CURRENT}"
read -rp "Enter new Loki helm chart version [${LOKI_SUGGESTED}]: " LOKI_VERSION
LOKI_VERSION=${LOKI_VERSION:-${LOKI_SUGGESTED}}
echo
echo "Current Promtail helm chart version: ${PROMTAIL_CURRENT}"
read -rp "Enter new Promtail helm chart version [${PROMTAIL_SUGGESTED}]: " PROMTAIL_VERSION
PROMTAIL_VERSION=${PROMTAIL_VERSION:-${PROMTAIL_SUGGESTED}}
echo
echo "Current Loki-Stack helm chart version: ${LOKI_STACK_CURRENT}"
read -rp "Enter new Loki-Stack helm chart version [${LOKI_STACK_SUGGESTED}]: " LOKI_STACK_VERSION
LOKI_STACK_VERSION=${LOKI_STACK_VERSION:-${LOKI_STACK_SUGGESTED}}
echo
echo "Creating Release"
echo "Release Version: ${VERSION}"
echo "Loki Helm Chart: ${LOKI_VERSION}"
echo "Promtail Helm Chart: ${PROMTAIL_VERSION}"
echo "Loki-Stack Helm Chart: ${LOKI_STACK_VERSION}"
echo
read -rp "Is this correct? [y]: " CONTINUE
CONTINUE=${CONTINUE:-y}
echo
if [[ "${CONTINUE}" != "y" ]]; then
exit 1
fi
echo "Updating helm and ksonnet image versions"
sed-wrap "s/.*promtail:.*/ promtail: 'grafana\/promtail:${VERSION}',/" production/ksonnet/promtail/config.libsonnet
sed-wrap "s/.*loki_canary:.*/ loki_canary: 'grafana\/loki-canary:${VERSION}',/" production/ksonnet/loki-canary/config.libsonnet
sed-wrap "s/.*loki:.*/ loki: 'grafana\/loki:${VERSION}',/" production/ksonnet/loki/images.libsonnet
sed-wrap "s/.*tag:.*/ tag: ${VERSION}/" production/helm/loki/values.yaml
sed-wrap "s/.*tag:.*/ tag: ${VERSION}/" production/helm/promtail/values.yaml
echo "Updating helm charts"
sed-wrap "s/^version:.*/version: ${LOKI_VERSION}/" production/helm/loki/Chart.yaml
sed-wrap "s/^version:.*/version: ${PROMTAIL_VERSION}/" production/helm/promtail/Chart.yaml
sed-wrap "s/^version:.*/version: ${LOKI_STACK_VERSION}/" production/helm/loki-stack/Chart.yaml
sed-wrap "s/^appVersion:.*/appVersion: ${VERSION}/" production/helm/loki/Chart.yaml
sed-wrap "s/^appVersion:.*/appVersion: ${VERSION}/" production/helm/promtail/Chart.yaml
sed-wrap "s/^appVersion:.*/appVersion: ${VERSION}/" production/helm/loki-stack/Chart.yaml
echo
echo "######################################################################################################"
echo
echo "Version numbers updated, create a new branch, commit and push"
echo
echo "######################################################################################################"