Skip to content

Commit 4de360f

Browse files
committed
ci: Add linting for helm chart
1 parent 7044136 commit 4de360f

21 files changed

+434
-203
lines changed

.envrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ use asdf
33
PATH_add .local/bin
44

55
dotenv_if_exists .envrc.local
6+
7+
command -v yamale &>/dev/null || pip install yamale

.github/workflows/checks.yml

Lines changed: 83 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ jobs:
2727
uses: actions/checkout@v3
2828

2929
- name: Install asdf
30-
uses: asdf-vm/actions/setup@master
30+
uses: asdf-vm/actions/setup@v2
3131
with:
32-
asdf_branch: v0.11.0
32+
asdf_branch: v0.11.3
3333

3434
- name: Run unit tests
3535
run: make test
@@ -49,9 +49,9 @@ jobs:
4949
fetch-depth: 0
5050

5151
- name: Install asdf
52-
uses: asdf-vm/actions/setup@master
52+
uses: asdf-vm/actions/setup@v2
5353
with:
54-
asdf_branch: v0.11.0
54+
asdf_branch: v0.11.3
5555

5656
- name: Build and install on KinD
5757
run: make dev.run-on-kind
@@ -65,7 +65,6 @@ jobs:
6565
if: always()
6666
run: make kind.delete
6767

68-
6968
lint:
7069
runs-on: ubuntu-22.04
7170
steps:
@@ -82,6 +81,7 @@ jobs:
8281
fail_on_error: true
8382
reporter: github-pr-review
8483
golangci_lint_version: v${{ fromJson(steps.versions.outputs.tools).golangci-lint }}
84+
go_version: v${{ fromJson(steps.versions.outputs.tools).golang }}
8585

8686
pre-commit:
8787
runs-on: ubuntu-22.04
@@ -104,9 +104,9 @@ jobs:
104104
shfmt-version: ${{ fromJson(steps.versions.outputs.tools).shfmt }}
105105

106106
- name: Install asdf
107-
uses: asdf-vm/actions/setup@master
107+
uses: asdf-vm/actions/setup@v2
108108
with:
109-
asdf_branch: v0.11.0
109+
asdf_branch: v0.11.3
110110

111111
- name: Install helm-docs
112112
run: make install-tool.helm-docs
@@ -116,3 +116,79 @@ jobs:
116116
extra_args: --all-files --show-diff-on-failure
117117
env:
118118
SKIP: no-commit-to-branch,golangci-lint
119+
120+
lint-test-helm:
121+
runs-on: ubuntu-22.04
122+
steps:
123+
- name: Checkout
124+
uses: actions/checkout@v3
125+
with:
126+
fetch-depth: 0
127+
128+
- name: Gather tool versions
129+
uses: endorama/asdf-parse-tool-versions@v1
130+
id: versions
131+
132+
- name: Set up Helm
133+
uses: azure/setup-helm@v3
134+
with:
135+
version: v${{ fromJson(steps.versions.outputs.tools).helm }}
136+
137+
- uses: actions/setup-python@v4
138+
with:
139+
python-version: '3.10'
140+
check-latest: true
141+
142+
- name: Set up chart-testing
143+
uses: helm/chart-testing-action@v2
144+
with:
145+
version: v${{ fromJson(steps.versions.outputs.tools).helm-ct }}
146+
yamllint_version: ${{ fromJson(steps.versions.outputs.tools).yamllint }}
147+
148+
- name: Run chart-testing (list-changed)
149+
id: list-changed
150+
run: |
151+
changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }})
152+
if [[ -n "$changed" ]]; then
153+
echo "changed=true" >> "$GITHUB_OUTPUT"
154+
fi
155+
156+
- if: steps.list-changed.outputs.changed == 'true'
157+
name: Run chart-testing (lint)
158+
run: ct lint --config charts/ct-config.yaml
159+
160+
- if: steps.list-changed.outputs.changed == 'true'
161+
name: Create kind cluster
162+
uses: helm/kind-action@v1
163+
with:
164+
version: v${{ fromJson(steps.versions.outputs.tools).kind }}
165+
kubectl_version: v${{ fromJson(steps.versions.outputs.tools).kubectl }}
166+
node_image: ghcr.io/mesosphere/kind-node:v${{ fromJson(steps.versions.outputs.tools).kubectl }}
167+
env:
168+
KUBECONFIG: ct-kind-kubeconfig
169+
170+
- if: steps.list-changed.outputs.changed == 'true'
171+
name: Install asdf
172+
uses: asdf-vm/actions/setup@v2
173+
with:
174+
asdf_branch: v0.11.3
175+
176+
- if: steps.list-changed.outputs.changed == 'true'
177+
name: Build Docker images
178+
run: make release-snapshot
179+
180+
- if: steps.list-changed.outputs.changed == 'true'
181+
name: Sideload docker image
182+
run: kind load docker-image --name chart-testing "$(jq -r '.[] | select(.type == "Docker Image" and .goos == "linux" and .goarch == "amd64").name' dist/artifacts.json)"
183+
184+
- if: steps.list-changed.outputs.changed == 'true'
185+
name: Setup Cluster API and cert-manager
186+
run: make clusterctl.init
187+
env:
188+
KIND_KUBECONFIG: ct-kind-kubeconfig
189+
190+
- if: steps.list-changed.outputs.changed == 'true'
191+
name: Run chart-testing (install)
192+
run: ct install --config charts/ct-config.yaml --helm-extra-set-args "--set=image.tag=$(jq -r .version dist/metadata.json)"
193+
env:
194+
KUBECONFIG: ct-kind-kubeconfig

.github/workflows/codeql-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
- name: Install tools via asdf
3434
uses: asdf-vm/actions/install@master
3535
with:
36-
asdf_branch: v0.11.0
36+
asdf_branch: v0.11.3
3737

3838
- name: Build
3939
run: make build-snapshot

.github/workflows/goreleaser.yaml

Lines changed: 0 additions & 56 deletions
This file was deleted.

.github/workflows/release-please.yaml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,56 @@ jobs:
1919
package-name: capi-runtime-extensions
2020
pull-request-title-pattern: "build${scope}: release${component} ${version}"
2121
changelog-notes-type: github
22+
23+
- if: ${{ steps.release-please.outputs.release_created }}
24+
uses: actions/checkout@v3
25+
with:
26+
fetch-depth: 0
27+
28+
- if: ${{ steps.release-please.outputs.release_created }}
29+
name: Fetch all tags
30+
run: git fetch --force --tags
31+
32+
- if: ${{ steps.release-please.outputs.release_created }}
33+
name: Set up Docker Buildx
34+
uses: docker/setup-buildx-action@v2
35+
36+
- if: ${{ steps.release-please.outputs.release_created }}
37+
name: Gather tool versions
38+
uses: endorama/asdf-parse-tool-versions@v1
39+
id: versions
40+
41+
- if: ${{ steps.release-please.outputs.release_created }}
42+
name: Login to GitHub Container Registry
43+
uses: docker/login-action@v2
44+
with:
45+
registry: ghcr.io
46+
username: ${{ github.actor }}
47+
password: ${{ secrets.GITHUB_TOKEN }}
48+
49+
- if: ${{ steps.release-please.outputs.release_created }}
50+
name: Install go
51+
uses: actions/setup-go@v4
52+
with:
53+
go-version: ${{ fromJson(steps.versions.outputs.tools).golang }}
54+
check-latest: false
55+
cache: true
56+
57+
- if: ${{ steps.release-please.outputs.release_created }}
58+
name: Run goreleaser
59+
uses: goreleaser/goreleaser-action@v4
60+
with:
61+
distribution: goreleaser
62+
version: ${{ fromJson(steps.versions.outputs.tools).goreleaser }}
63+
args: release --clean
64+
env:
65+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66+
67+
- if: ${{ steps.release-please.outputs.release_created }}
68+
name: Publish Helm chart
69+
uses: stefanprodan/[email protected]
70+
with:
71+
token: ${{ secrets.GITHUB_TOKEN }}
72+
app_version: ${{ steps.release-please.outputs.tag_name }}
73+
chart_version: ${{ steps.release-please.outputs.tag_name }}
74+
target_dir: repo

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,5 @@ dist/
2727
*.tar.gz
2828
*.tar
2929
capd-kubeconfig
30+
31+
ct_previous_*/

.go-tools

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
github.com/oligot/[email protected]
22
github.com/segmentio/[email protected]
33
gotest.tools/[email protected]
4-
sigs.k8s.io/controller-runtime/tools/[email protected]20230427153817-0ef07535542b
4+
sigs.k8s.io/controller-runtime/tools/[email protected]20230502220215-94bb74b2184c
55
github.com/google/go-containerregistry/cmd/[email protected]
66
github.com/drone/envsubst/cmd/[email protected]

.pre-commit-config.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,15 @@ repos:
7878
- header.txt
7979
- --comment-style
8080
- //
81+
- --use-current-year
8182
- id: insert-license
8283
name: License headers - YAML and Makefiles
8384
stages: [commit]
8485
files: (^Makefile|\.(ya?ml|mk))$
8586
args:
8687
- --license-filepath
8788
- header.txt
89+
- --use-current-year
8890
exclude: ^(pkg/addons/templates/.+\.yaml|charts/.+/templates/role\.yaml||charts/.+/crds/.+\.yaml)$
8991
- id: insert-license
9092
name: License headers - Markdown
@@ -96,6 +98,7 @@ repos:
9698
- header.txt
9799
- --comment-style
98100
- <!--|| -->
101+
- --use-current-year
99102
- repo: https://github.com/norwoodj/helm-docs
100103
rev: v1.11.0
101104
hooks:

.tool-versions

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
1-
clusterctl 1.4.1
1+
clusterctl 1.4.2
22
flux2 0.41.2
3-
gcloud 428.0.0
4-
ginkgo 2.9.2
3+
gcloud 429.0.0
4+
ginkgo 2.9.3
55
gojq 0.12.12
6-
golang 1.20.3
6+
golang 1.20.4
77
golangci-lint 1.52.2
88
goreleaser 1.17.2
99
helm 3.11.3
10+
helm-ct 3.8.0
1011
helm-docs 1.11.0
1112
kind 0.18.0
12-
kube-controller-tools 0.11.4
13+
kube-controller-tools 0.12.0
1314
kubebuilder 3.10.0
1415
kubectl 1.27.1
1516
kustomize 5.0.1
16-
pre-commit 3.3.0
17+
pre-commit 3.3.1
1718
shfmt 3.6.0
1819
upx 4.0.2
20+
yamllint 1.31.0

charts/capi-runtime-extensions/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# Copyright 2023 D2iQ, Inc. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
apiVersion: v1
4+
apiVersion: v2
55

66
name: capi-runtime-extensions
77
type: application
88
description: A Helm chart for capi-runtime-extensions
99

1010
home: https://github.com/d2iq-labs/capi-runtime-extensions
1111
maintainers:
12-
- name: Jimmi Dyson
12+
- name: jimmidyson
1313
1414
url: https://eng.d2iq.com
1515
sources:

charts/capi-runtime-extensions/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ A Helm chart for capi-runtime-extensions
1515

1616
| Name | Email | Url |
1717
| ---- | ------ | --- |
18-
| Jimmi Dyson | <[email protected]> | <https://eng.d2iq.com> |
18+
| jimmidyson | <[email protected]> | <https://eng.d2iq.com> |
1919

2020
## Source Code
2121

charts/capi-runtime-extensions/templates/deployment.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ spec:
1818
{{- include "chart.selectorLabels" . | nindent 8 }}
1919
spec:
2020
nodeSelector:
21-
{{- toYaml .Values.commonNodeSelector | nindent 8 }}
21+
{{- toYaml .Values.nodeSelector | nindent 8 }}
2222
tolerations:
23-
{{- toYaml .Values.commonTolerations | nindent 8 }}
23+
{{- toYaml .Values.tolerations | nindent 8 }}
2424
serviceAccountName: {{ template "chart.name" . }}
2525
terminationGracePeriodSeconds: 10
2626
containers:

0 commit comments

Comments
 (0)