-
Notifications
You must be signed in to change notification settings - Fork 0
/
ci.sh
executable file
·91 lines (76 loc) · 2.62 KB
/
ci.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
85
86
87
88
89
90
91
#!/bin/bash
set -e
export RELEASE_NAME="${RELEASE_NAME:-airbyte}"
export NAMESPACE="${NAMESPACE:-airbyte}"
export INSTALL_TIMEOUT="${INSTALL_TIMEOUT:-600s}"
usage() {
echo "Airbyte Helm Chart CI Script"
echo ""
echo "Usage:"
echo " ./ci.sh [command]"
echo ""
echo "Available Commands"
echo ""
echo "lint Lints the helm chart"
echo "test Runs 'helm test' for the helm chart"
echo "install Installs the helm chart"
echo "diagnostics Prints diagnostics & logs of pods that aren't running"
echo "template Templates out the default kubernetes manifests generated by helm"
echo "update-docs Regenerates the README.md documentation after making changes to the values.yaml"
echo "check-docs-updated Fails if changes values.yaml and README.md documentation are out of sync"
echo "help Displays help about this command"
}
if ! helm repo list | grep "bitnami" > /dev/null 2>&1; then
helm repo add bitnami https://charts.bitnami.com/bitnami
fi
if [ ! -d ./charts ]; then
helm dep build
fi
case "$1" in
lint)
helm lint .
;;
test)
helm test "${RELEASE_NAME}" --logs --debug --namespace "${NAMESPACE}"
;;
install)
helm upgrade --install \
--create-namespace \
--namespace "${NAMESPACE}" \
--debug \
--wait \
--timeout "${INSTALL_TIMEOUT}" \
"${RELEASE_NAME}" .
;;
diagnostics)
kubectl -n "${NAMESPACE}" get pods -o wide
kubectl -n "${NAMESPACE}" get pods --no-headers | grep -v "Running" | awk '{print $1}' | xargs -L 1 -r kubectl -n "${NAMESPACE}" logs
;;
template)
helm template --release-name "${RELEASE_NAME}" .
;;
# Uses the readme-generator command to update the README.md
# with changes in the values.yaml file. See: https://github.com/bitnami-labs/readme-generator-for-helm
update-docs)
readme-generator -v ./values.yaml -r README.md
;;
# Checks if the docs were updated as a result of changes in the values.yaml file and if they were
# fails CI with a message about needing to run the update-docs command.
check-docs-updated)
readme-generator -v ./values.yaml -r README.md
if git status --porcelain | grep "charts/airbyte/README.md"; then
echo "It appears the README.md has not been updated with changes from the values.yaml. See diff below:"
git --no-pager diff
echo "Please run './ci.sh update-docs' locally and commit your changes."
exit 1
else
echo "No uncommitted changes to the README.md detected"
fi
;;
help)
usage
;;
*)
usage
;;
esac