This repository has been archived by the owner on Jul 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Taskfile.yml
173 lines (170 loc) · 10.4 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
version: '3'
vars:
INPLACE_SED:
sh: 'if [ "$(uname)" = "Darwin" ]; then echo "sed -i \"\""; else echo "sed -i"; fi'
tasks:
# Meta Tasks for Charts
prepare-all-releases:
- echo "Prepare all releases"
- task prepare-release-flux-kluctl-controller
- task prepare-release-template-controller
prepare-release-flux-kluctl-controller:
- task: bump-chart-flux-kluctl-controller
- task: generate-changelog-flux-kluctl-controller
- task: generate-readme-flux-kluctl-controller
prepare-release-template-controller:
- task: bump-chart-template-controller
- task: generate-changelog-template-controller
- task: generate-readme-template-controller
# Download CRDs for Charts
download-all-crds:
cmds:
- echo "Downloading all CRDs"
- task: download-crds-flux-kluctl-controller
- task: download-crds-template-controller
download-crds-flux-kluctl-controller:
dir: charts/flux-kluctl-controller/crds/
cmds:
- echo "Downloading CRDs for flux-kluctl-controller with version {{.SOURCE_VER}}"
- curl -s -LO https://raw.githubusercontent.com/kluctl/flux-kluctl-controller/{{.SOURCE_VER}}/config/crd/bases/flux.kluctl.io_kluctldeployments.yaml
vars:
SOURCE_VER:
sh: "cat ../Chart.yaml | yq '.appVersion'"
download-crds-template-controller:
dir: charts/template-controller/crds/
cmds:
- echo "Downloading CRDs for template-controller with version {{.SOURCE_VER}}"
- curl -s -LO https://raw.githubusercontent.com/kluctl/template-controller/{{.SOURCE_VER}}/config/crd/bases/templates.kluctl.io_gitprojectors.yaml
- curl -s -LO https://raw.githubusercontent.com/kluctl/template-controller/{{.SOURCE_VER}}/config/crd/bases/templates.kluctl.io_listgithubpullrequests.yaml
- curl -s -LO https://raw.githubusercontent.com/kluctl/template-controller/{{.SOURCE_VER}}/config/crd/bases/templates.kluctl.io_listgitlabmergerequests.yaml
- curl -s -LO https://raw.githubusercontent.com/kluctl/template-controller/{{.SOURCE_VER}}/config/crd/bases/templates.kluctl.io_objecthandlers.yaml
- curl -s -LO https://raw.githubusercontent.com/kluctl/template-controller/{{.SOURCE_VER}}/config/crd/bases/templates.kluctl.io_objecttemplates.yaml
- curl -s -LO https://raw.githubusercontent.com/kluctl/template-controller/{{.SOURCE_VER}}/config/crd/bases/templates.kluctl.io_texttemplates.yaml
- curl -s -LO https://raw.githubusercontent.com/kluctl/template-controller/{{.SOURCE_VER}}/config/crd/bases/templates.kluctl.io_githubcomments.yaml
- curl -s -LO https://raw.githubusercontent.com/kluctl/template-controller/{{.SOURCE_VER}}/config/crd/bases/templates.kluctl.io_gitlabcomments.yaml
vars:
SOURCE_VER:
sh: "cat ../Chart.yaml | yq '.appVersion'"
# Download RBAC
download-all-rbac:
cmds:
- echo "Downloading all RBAC"
- task: download-rbac-flux-kluctl-controller
- task: download-rbac-template-controller
download-rbac-flux-kluctl-controller:
dir: charts/flux-kluctl-controller
cmds:
- echo "Downloading RBAC for flux-kluctl-controller with version {{.SOURCE_VER}}"
- printf "$(curl -s https://raw.githubusercontent.com/kluctl/flux-kluctl-controller/{{.SOURCE_VER}}/config/rbac/role.yaml)\n---\n" > templates/clusterrole.yaml
- printf "$(curl -s https://raw.githubusercontent.com/kluctl/flux-kluctl-controller/{{.SOURCE_VER}}/config/rbac/kluctldeployment_editor_role.yaml)\n---\n" >> templates/clusterrole.yaml
- printf "$(curl -s https://raw.githubusercontent.com/kluctl/flux-kluctl-controller/{{.SOURCE_VER}}/config/rbac/kluctldeployment_viewer_role.yaml)\n---\n" >> templates/clusterrole.yaml
- printf "$(curl -s https://raw.githubusercontent.com/kluctl/flux-kluctl-controller/{{.SOURCE_VER}}/config/rbac/leader_election_role.yaml)\n---\n" > templates/role.yaml
- "{{.INPLACE_SED}} -e 's/name: */name: {{.HELM_TEMPLATE_FULL_NAME}}-/' templates/clusterrole.yaml"
- "{{.INPLACE_SED}} -e 's/name: */name: {{.HELM_TEMPLATE_FULL_NAME}}-/' templates/role.yaml"
vars:
SOURCE_VER:
sh: "cat Chart.yaml | yq '.appVersion'"
HELM_TEMPLATE_FULL_NAME: '{{`{{ include "flux-kluctl-controller.fullname" . }}`}}'
download-rbac-template-controller:
dir: charts/template-controller/
cmds:
- echo "Downloading RBAC for template-controller with version {{.SOURCE_VER}}"
- printf "$(curl -s https://raw.githubusercontent.com/kluctl/template-controller/{{.SOURCE_VER}}/config/rbac/role.yaml)\n---\n" > templates/clusterrole.yaml
- printf "$(curl -s https://raw.githubusercontent.com/kluctl/template-controller/{{.SOURCE_VER}}/config/rbac/gitprojector_editor_role.yaml)\n---\n" >> templates/clusterrole.yaml
- printf "$(curl -s https://raw.githubusercontent.com/kluctl/template-controller/{{.SOURCE_VER}}/config/rbac/gitprojector_viewer_role.yaml)\n---\n" >> templates/clusterrole.yaml
- printf "$(curl -s https://raw.githubusercontent.com/kluctl/template-controller/{{.SOURCE_VER}}/config/rbac/listgithubpullrequests_editor_role.yaml)\n---\n" >> templates/clusterrole.yaml
- printf "$(curl -s https://raw.githubusercontent.com/kluctl/template-controller/{{.SOURCE_VER}}/config/rbac/listgithubpullrequests_viewer_role.yaml)\n---\n" >> templates/clusterrole.yaml
- printf "$(curl -s https://raw.githubusercontent.com/kluctl/template-controller/{{.SOURCE_VER}}/config/rbac/listgitlabmergerequests_editor_role.yaml)\n---\n" >> templates/clusterrole.yaml
- printf "$(curl -s https://raw.githubusercontent.com/kluctl/template-controller/{{.SOURCE_VER}}/config/rbac/listgitlabmergerequests_viewer_role.yaml)\n---\n" >> templates/clusterrole.yaml
- printf "$(curl -s https://raw.githubusercontent.com/kluctl/template-controller/{{.SOURCE_VER}}/config/rbac/objecthandler_editor_role.yaml)\n---\n" >> templates/clusterrole.yaml
- printf "$(curl -s https://raw.githubusercontent.com/kluctl/template-controller/{{.SOURCE_VER}}/config/rbac/objecthandler_viewer_role.yaml)\n---\n" >> templates/clusterrole.yaml
- printf "$(curl -s https://raw.githubusercontent.com/kluctl/template-controller/{{.SOURCE_VER}}/config/rbac/objecttemplate_editor_role.yaml)\n---\n" >> templates/clusterrole.yaml
- printf "$(curl -s https://raw.githubusercontent.com/kluctl/template-controller/{{.SOURCE_VER}}/config/rbac/objecttemplate_viewer_role.yaml)\n---\n" >> templates/clusterrole.yaml
- printf "$(curl -s https://raw.githubusercontent.com/kluctl/template-controller/{{.SOURCE_VER}}/config/rbac/leader_election_role.yaml)\n---\n" > templates/role.yaml
- "{{.INPLACE_SED}} -e 's/name: */name: {{.HELM_TEMPLATE_FULL_NAME}}-/' templates/clusterrole.yaml"
- "{{.INPLACE_SED}} -e 's/name: */name: {{.HELM_TEMPLATE_FULL_NAME}}-/' templates/role.yaml"
vars:
SOURCE_VER:
sh: "cat Chart.yaml | yq '.appVersion'"
HELM_TEMPLATE_FULL_NAME: '{{`{{ include "template-controller.fullname" . }}`}}'
# Generate README.md files for Charts
generate-all-readmes:
cmds:
- echo "Generating all README.md files"
- task: generate-readme-flux-kluctl-controller
- task: generate-readme-template-controller
generate-readme-flux-kluctl-controller:
cmds:
- task: generate-readme-template
vars: {CHART_NAME: flux-kluctl-controller}
generate-readme-template-controller:
cmds:
- task: generate-readme-template
vars: { CHART_NAME: template-controller }
generate-readme-template:
cmds:
- git fetch --tags
- docker run --rm --volume "${PWD}:/helm-docs" jnorwood/helm-docs:latest helm-docs --chart-search-root=charts/{{.CHART_NAME}}
# Generate Changelogs for Charts
generate-all-changelogs:
cmds:
- echo "Generating all changelogs"
- task: generate-changelog-flux-kluctl-controller
- task: generate-template-controller
generate-changelog-flux-kluctl-controller:
cmds:
- task: generate-changelog-template
vars: {CHART_NAME: flux-kluctl-controller}
generate-changelog-template-controller:
cmds:
- task: generate-changelog-template
vars: { CHART_NAME: template-controller }
generate-changelog-template:
cmds:
- git fetch --tags
- docker run --rm -v "${PWD}:/tmp" -w /tmp convco/convco changelog --prefix "{{.CHART_NAME}}-" -P charts/{{.CHART_NAME}} > charts/{{.CHART_NAME}}/CHANGELOG.md
# Bump version of Charts
bump-all-charts:
cmds:
- echo "Bump all charts"
- task: bump-chart-flux-kluctl-controller
- task: bump-chart-template-controller
bump-chart-flux-kluctl-controller:
cmds:
- task: bump-chart-template
vars: {CHART_NAME: flux-kluctl-controller}
bump-chart-template-controller:
cmds:
- task: bump-chart-template
vars: { CHART_NAME: template-controller }
bump-chart-template:
cmds:
- git fetch --tags
- '{{.INPLACE_SED}} "s/^version: .*/version: $(docker run --rm -v "${PWD}:/tmp" -w /tmp convco/convco version --prefix "{{.CHART_NAME}}-" --bump -P charts/{{.CHART_NAME}})/" charts/{{.CHART_NAME}}/Chart.yaml'
# Create release commits for Charts
create-all-release-commits:
cmds:
- echo "Create all release commits"
- task: create-release-commit-flux-kluctl-controller
- task: create-release-commit-template-controller
create-release-commit-flux-kluctl-controller:
cmds:
- task: create-release-commit-template
vars: {CHART_NAME: flux-kluctl-controller}
create-release-commit-template-controller:
cmds:
- task: create-release-commit-template
vars: { CHART_NAME: template-controller }
create-release-commit-template:
cmds:
- "(git add charts/{{.CHART_NAME}}/README.md && git commit --signoff -m \"docs({{.CHART_NAME}}): Update Readme\" charts/{{.CHART_NAME}}/README.md) || true"
- "(git add charts/{{.CHART_NAME}}/CHANGELOG.md && git commit --signoff -m \"docs({{.CHART_NAME}}): Update Changelog\" charts/{{.CHART_NAME}}/CHANGELOG.md) || true"
- "(git add charts/{{.CHART_NAME}}/Chart.yaml && git commit --signoff -m \"chore({{.CHART_NAME}}): Bump chart to ${NEXT_VERSION}\" charts/{{.CHART_NAME}}/Chart.yaml) || true"
# Template all charts
template-all-charts:
cmds:
- ls charts | xargs -I {} helm template test charts/{}
# Lint all charts
lint-all-charts:
cmds:
- docker run -it --network host --workdir=/data --volume ~/.kube/config:/root/.kube/config:ro --volume $(pwd):/data quay.io/helmpack/chart-testing:v3.5.0 ct lint --config ct.yaml