-
Notifications
You must be signed in to change notification settings - Fork 134
/
helm-chart-generation.sh
executable file
·58 lines (46 loc) · 1.39 KB
/
helm-chart-generation.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
#! /usr/bin/env bash
set -uo pipefail
roxctl helm >/dev/null 2>&1 || {
echo "'roxctl helm' command unavailable, skipping test"
exit 0
}
# This test script requires MAIN_TAG.
[ -n "$MAIN_TAG" ]
FAILURES=0
eecho() {
echo "$@" >&2
}
die() {
eecho "$@"
exit 1
}
test_central_services_chart_generation() {
local chart_name="central-services"
local output_dir="$(mktemp -d)"
local chart_output_dir="$output_dir/chart"
if OUTPUT="$(roxctl helm output "$chart_name" --output-dir="$chart_output_dir" 2>&1)"; then
echo "[OK] 'roxctl helm output $chart_name' succeeded"
else
eecho "[FAIL] 'roxctl helm output $chart_name' failed:"
eecho "$OUTPUT"
FAILURES=$((FAILURES + 1))
fi
if [ -e "$chart_output_dir/Chart.yaml" ] && grep -q "^appVersion: $MAIN_TAG" "$chart_output_dir/Chart.yaml"; then
echo "[OK] Chart.yaml:appVersion is '$MAIN_TAG'"
else
FAILURES=$((FAILURES + 1))
if [ -e "$chart_output_dir/Chart.yaml" ]; then
app_version="$(grep "^appVersion:" "$chart_output_dir/Chart.yaml")"
eecho "[FAIL] Chart.yaml:appVersion is not '$MAIN_TAG'. Chart.yaml contains: '$app_version'"
else
eecho "[FAIL] Chart.yaml not generated"
fi
fi
}
test_central_services_chart_generation
if [ $FAILURES -eq 0 ]; then
echo "Passed"
else
echo "$FAILURES tests failed"
exit 1
fi