-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdocs.sh
47 lines (44 loc) · 1.47 KB
/
docs.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
#!/bin/bash
. /scripts/helpers/base.sh
DOC_CHARTS=()
## Create Documentation Checksum
head "Creating Checksums"
for chart in ${INPUT_CHARTS}; do
config_load "${chart}"
if [ "${HELM_DOCS_DISABLE,,}" == "true" ]; then
log "${chart}" "${Green}Helm-Docs disabled${Off} ✔";
else
if [ -f "${chart%/}/README.md" ]; then
DOC_CHARTS+=(${chart})
shasum ${chart%/}/README.md > ${chart%/}/README.md.sum
log "${chart}" "${Green}Checksum created ($(cat ${chart%/}/README.md.sum))${Off} ✔";
else
log "${chart}" "${Yellow}No README.md file detected${Off} ❌";
fi
fi
echo ""
config_unset
done
if [ -n "${DOC_CHARTS}" ]; then
## Execute helm-docs
head "Executing Helm-Docs"
helm-docs > /dev/null
## Check Checksums
head "Validating Checksums"
for chart in ${DOC_CHARTS[@]}; do
config_load "${chart}"
if [[ $(shasum "${chart%/}/README.md") == $(cat "${chart%/}/README.md.sum") ]]; then
log "${chart}" "${Green}Documentation up to date${Off} ✔"
else
log "${chart}" "${Red}Checksums did not match - Documentation outdated!${Off} ❌\n ${Red}Before:${Off} $(cat ${chart%/}/README.md.sum)\n ${Red}After:${Off} $(shasum ${chart%/}/README.md)\n ↳ ${Red}Execute helm-docs and push again${Off}"
if [ "${HELM_DOCS_ALLOW_FAIL,,}" == "true" ]; then
log "${chart}" "${Yellow}Allowed to fail${Off} 💣";
else
HAS_ERROR=1;
fi
fi
echo ""
config_unset
done
fi
summary