-
Notifications
You must be signed in to change notification settings - Fork 2
/
Taskfile.yml
116 lines (103 loc) · 3.38 KB
/
Taskfile.yml
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# https://taskfile.dev
version: "3"
tasks:
validate:
desc: Validate the pre-commit hooks
cmds:
- task: validate:precommit
- task: validate:lint
validate:precommit:
desc: Validates that pre-commit hooks were run
cmds:
- pre-commit install
- pre-commit run -a
validate:lint:
desc: Runs helm lint on all charts
dir: charts
cmds:
- find ./* -type d -mindepth 0 -maxdepth 0 -print0 | xargs -0 helm lint --strict
install-chart-deps:
desc: Installs Helm chart dependent repos
status:
- helm repo list | grep "bitnami"
cmds:
- helm repo add bitnami-full-index https://raw.githubusercontent.com/bitnami/charts/archive-full-index/bitnami
test:
desc: Run automated tests
cmds:
- task: chart-releaser:package
secure:
desc: Run automated security checks
cmds:
- echo "N/A"
deliver:
desc: Deliver artifact
cmds:
- task: chart-releaser:package
- task: chart-releaser:deleteAlreadyUploaded
- task: chart-releaser:upload
- task: chart-releaser:package
- task: chart-releaser:indexAndPush
deploy:
desc: Deploy project
cmds:
- echo "N/A"
chart-releaser:package:
desc: Package all charts, then delete ones that already have been uploaded
deps: [install-chart-deps]
cmds:
- rm -rf .cr-release-packages
- helm-cr package charts/*
chart-releaser:deleteAlreadyUploaded:
desc: Delete charts that have already been uploaded
cmds:
- |
git fetch --tags
for package in .cr-release-packages/*.tgz; do
filename=$(basename -- "$package")
filenameWithoutExt="${filename%.*}"
if git rev-parse "$filenameWithoutExt" >/dev/null 2>&1; then
echo "Deleting package '$filenameWithoutExt' since it has already been uploaded."
rm $package
fi
done
chart-releaser:upload:
desc: Upload charts to GitHub Releases
vars:
token: '{{ coalesce .CR_TOKEN "<no value>" }}'
preconditions:
- sh: test "{{.token}}" != "<no value>"
msg: "CR_TOKEN not set"
cmds:
- |
if [ -n "$(find ".cr-release-packages" -maxdepth 0 -type d -empty 2>/dev/null)" ]; then
echo "No action taken. There was nothing to upload"
else
helm-cr upload --commit "$(git rev-parse main)"
fi
chart-releaser:indexAndPush:
desc: Create and push index.yaml to gh-pages branch
vars:
gitUsername: '{{ coalesce .GIT_USERNAME "<no value>" }}'
gitEmail: '{{ coalesce .GIT_EMAIL "<no value>" }}'
owner: '{{ coalesce .CR_OWNER "<no value>" }}'
gitRepo: '{{ coalesce .CR_GIT_REPO "<no value>" }}'
chartsRepo: '{{ coalesce .CR_CHARTS_REPO "<no value>" }}'
preconditions:
- sh: test "{{.gitUsername}}" != "<no value>"
msg: "GIT_USERNAME not set"
- sh: test "{{.gitEmail}}" != "<no value>"
msg: "GIT_EMAIL not set"
- sh: test "{{.owner}}" != "<no value>"
msg: "CR_OWNER not set"
- sh: test "{{.gitRepo}}" != "<no value>"
msg: "CR_GIT_REPO not set"
- sh: test "{{.chartsRepo}}" != "<no value>"
msg: "CR_CHARTS_REPO not set"
cmds:
- |
git config user.name "{{.gitUsername}}" \
&& git config user.email "{{.gitEmail}}" \
&& rm -rf .cr-index \
&& mkdir .cr-index \
&& helm-cr index --push