Skip to content

Commit b18ec49

Browse files
authored
Add yaml and helm-doc linting and formating support (#342)
* Add yaml and helm-doc linting and formating support * Add validation for Kubernetes objects using kubeconfirm (excludes objects from CRDs) * fix issue with yamlfix and block scalars * update canary image to use busybox
1 parent 1d40562 commit b18ec49

27 files changed

+509
-510
lines changed

.github/dependabot.yml

Lines changed: 33 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,36 @@
1+
---
12
# Please see the documentation for all configuration options: https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
2-
33
version: 2
44
updates:
5-
# github-actions
6-
- directory: "/"
7-
package-ecosystem: "github-actions"
8-
schedule:
9-
interval: "weekly"
10-
time: "09:00"
11-
# Use Europe/Bucharest Standard Time (UTC +02:00)
12-
timezone: "Europe/Bucharest"
13-
commit-message:
14-
prefix: "dependabot"
15-
include: scope
16-
labels:
17-
- "kind/cleanup"
18-
- "dependabot"
19-
# Go
20-
- directory: "/"
21-
package-ecosystem: "gomod"
22-
schedule:
23-
interval: "weekly"
24-
time: "09:00"
25-
# Use Europe/Bucharest Standard Time (UTC +02:00)
26-
timezone: "Europe/Bucharest"
27-
commit-message:
28-
prefix: "dependabot"
29-
include: scope
30-
# TODO decide if we should enable ignore
31-
# ignore:
32-
# # Ignore controller-runtime as its upgraded manually.
33-
# - dependency-name: "sigs.k8s.io/controller-runtime"
34-
# # Ignore k8s and its transitives modules as they are upgraded manually together with controller-runtime.
35-
# - dependency-name: "k8s.io/*"
36-
labels:
37-
- "kind/cleanup"
38-
- "dependabot"
5+
# github-actions
6+
- directory: /
7+
package-ecosystem: github-actions
8+
schedule:
9+
interval: weekly
10+
time: 09:00
11+
# Use Europe/Bucharest Standard Time (UTC +02:00)
12+
timezone: Europe/Bucharest
13+
commit-message:
14+
prefix: dependabot
15+
include: scope
16+
labels:
17+
- kind/cleanup
18+
- dependabot
19+
# Go
20+
- directory: /
21+
package-ecosystem: gomod
22+
schedule:
23+
interval: weekly
24+
time: 09:00
25+
# Use Europe/Bucharest Standard Time (UTC +02:00)
26+
timezone: Europe/Bucharest
27+
commit-message:
28+
prefix: dependabot
29+
include: scope
30+
# TODO decide if we should enable ignore
31+
# ignore:
32+
# # Ignore controller-runtime as its upgraded manually.
33+
# - dependency-name: "sigs.k8s.io/controller-runtime"
34+
# # Ignore k8s and its transitives modules as they are upgraded manually together with controller-runtime.
35+
# - dependency-name: "k8s.io/*"
36+
labels: [kind/cleanup, dependabot]

.github/workflows/ci-chart.yaml

Lines changed: 36 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,42 @@
1+
---
12
name: Lint and Test Helm Chart
2-
33
on: pull_request
4-
54
jobs:
65
lint-test:
76
runs-on: ubuntu-latest
87
steps:
9-
- name: Checkout
10-
uses: actions/checkout@v4
11-
with:
12-
fetch-depth: 0
13-
14-
- name: Set up Helm
15-
uses: azure/setup-helm@v4
16-
with:
17-
version: v3.12.1
18-
19-
# Python is required because `ct lint` runs Yamale (https://github.com/23andMe/Yamale) and
20-
# yamllint (https://github.com/adrienverge/yamllint) which require Python
21-
- name: Set up Python
22-
uses: actions/setup-python@v5
23-
with:
24-
python-version: '3.13'
25-
check-latest: true
26-
27-
- name: Set up chart-testing
28-
uses: helm/chart-testing-action@v2.7.0
29-
30-
- name: Run chart-testing (list-changed)
31-
id: list-changed
32-
run: |
33-
changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }})
34-
if [[ -n "$changed" ]]; then
35-
echo "changed=true" >> "$GITHUB_OUTPUT"
36-
fi
37-
- name: Run chart-testing (lint)
38-
if: steps.list-changed.outputs.changed == 'true'
39-
run: ct lint --target-branch ${{ github.event.repository.default_branch }}
40-
41-
- name: Create kind cluster
42-
if: steps.list-changed.outputs.changed == 'true'
43-
uses: helm/kind-action@v1.12.0
44-
with:
45-
version: v0.29.0
46-
47-
- name: Run chart-testing (install)
48-
if: steps.list-changed.outputs.changed == 'true'
49-
run: ct install --target-branch ${{ github.event.repository.default_branch }}
8+
- name: Checkout
9+
uses: actions/checkout@v4
10+
with:
11+
fetch-depth: 0
12+
- name: Set up Helm
13+
uses: azure/setup-helm@v4
14+
with:
15+
version: v3.12.1
16+
# Python is required because `ct lint` runs Yamale (https://github.com/23andMe/Yamale) and
17+
# yamllint (https://github.com/adrienverge/yamllint) which require Python
18+
- name: Set up Python
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: '3.13'
22+
check-latest: true
23+
- name: Set up chart-testing
24+
uses: helm/chart-testing-action@v2.7.0
25+
- name: Run chart-testing (list-changed)
26+
id: list-changed
27+
run: |
28+
changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }})
29+
if [[ -n "$changed" ]]; then
30+
echo "changed=true" >> "$GITHUB_OUTPUT"
31+
fi
32+
- name: Run chart-testing (lint)
33+
if: steps.list-changed.outputs.changed == 'true'
34+
run: ct lint --target-branch ${{ github.event.repository.default_branch }}
35+
- name: Create kind cluster
36+
if: steps.list-changed.outputs.changed == 'true'
37+
uses: helm/kind-action@v1.12.0
38+
with:
39+
version: v0.29.0
40+
- name: Run chart-testing (install)
41+
if: steps.list-changed.outputs.changed == 'true'
42+
run: ct install --target-branch ${{ github.event.repository.default_branch }}

.github/workflows/ci.yaml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
name: CI Tests
2-
1+
---
2+
name: CI tests
33
on: pull_request
4-
54
jobs:
65
ci:
76
runs-on: ubuntu-latest
@@ -22,7 +21,7 @@ jobs:
2221
with:
2322
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
2423
# version: v1.46
25-
args: -v --timeout 5m --no-config ./...
24+
args: -v --timeout 5m --no-config ./...
2625
- name: Install k8s Kind Cluster
2726
uses: helm/kind-action@v1.12.0
2827
with:
@@ -32,7 +31,6 @@ jobs:
3231
run: make local-test
3332
- name: Run e2e tests
3433
run: make e2e-tests
35-
3634
ci-karpenter:
3735
runs-on: ubuntu-latest
3836
name: ci-karpenter
@@ -52,7 +50,7 @@ jobs:
5250
with:
5351
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
5452
# version: v1.46
55-
args: -v --timeout 5m --no-config ./...
53+
args: -v --timeout 5m --no-config ./...
5654
- name: Install k8s Kind Cluster
5755
uses: helm/kind-action@v1.12.0
5856
with:
@@ -62,7 +60,6 @@ jobs:
6260
run: make local-test-karpenter
6361
- name: Run e2e tests
6462
run: make e2e-tests
65-
6663
ci-node-labels:
6764
runs-on: ubuntu-latest
6865
name: ci-node-labels
@@ -82,7 +79,7 @@ jobs:
8279
with:
8380
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
8481
# version: v1.46
85-
args: -v --timeout 5m --no-config ./...
82+
args: -v --timeout 5m --no-config ./...
8683
- name: Install k8s Kind Cluster
8784
uses: helm/kind-action@v1.12.0
8885
with:

.github/workflows/release-chart.yaml

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,23 @@
1+
---
12
name: Release Charts
2-
33
on:
44
push:
5-
branches:
6-
- main
7-
5+
branches: [main]
86
jobs:
97
release:
108
runs-on: ubuntu-latest
119
steps:
12-
- name: Checkout
13-
uses: actions/checkout@v4
14-
with:
15-
fetch-depth: 0
16-
17-
- name: Configure Git
18-
run: |
19-
git config user.name "$GITHUB_ACTOR"
20-
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
21-
22-
- name: Run chart-releaser
23-
uses: helm/chart-releaser-action@v1.7.0
24-
env:
25-
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
26-
CR_SKIP_EXISTING: true
27-
CR_RELEASE_NAME_TEMPLATE: "Helm-Chart-v{{ .Version }}"
10+
- name: Checkout
11+
uses: actions/checkout@v4
12+
with:
13+
fetch-depth: 0
14+
- name: Configure Git
15+
run: |
16+
git config user.name "$GITHUB_ACTOR"
17+
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
18+
- name: Run chart-releaser
19+
uses: helm/chart-releaser-action@v1.7.0
20+
env:
21+
CR_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22+
CR_SKIP_EXISTING: true
23+
CR_RELEASE_NAME_TEMPLATE: Helm-Chart-v{{ .Version }}

.github/workflows/release.yaml

Lines changed: 30 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,39 @@
1+
---
12
name: release
2-
33
on:
44
push:
5-
tags:
6-
- 'v*'
7-
5+
tags: [v*]
86
permissions:
9-
contents: write # needed to write releases
10-
id-token: write # needed for keyless signing
11-
packages: write # needed for ghcr access
12-
7+
contents: write # needed to write releases
8+
id-token: write # needed for keyless signing
9+
packages: write # needed for ghcr access
1310
jobs:
1411
release:
1512
runs-on: ubuntu-latest
1613
steps:
17-
- uses: actions/checkout@v4
18-
with:
19-
fetch-depth: 0 # this is important, otherwise it won't checkout the full tree (i.e. no previous tags)
20-
- # Add support for more platforms with QEMU (optional)
14+
- uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0 # this is important, otherwise it won't checkout the full tree (i.e. no previous tags)
17+
# Add support for more platforms with QEMU (optional)
2118
# https://github.com/docker/setup-qemu-action
22-
name: Set up QEMU
23-
uses: docker/setup-qemu-action@v3
24-
- name: Set up Docker Buildx
25-
uses: docker/setup-buildx-action@v3
26-
- uses: actions/setup-go@v5
27-
with:
28-
go-version: '1.24'
29-
cache: true
30-
- uses: sigstore/cosign-installer@v3.9.1 # installs cosign
31-
# - uses: anchore/sbom-action/download-syft@v0.14.1 # installs syft
32-
- uses: docker/login-action@v3 # login to ghcr
33-
with:
34-
registry: ghcr.io
35-
username: ${{ github.repository_owner }}
36-
password: ${{ secrets.GITHUB_TOKEN }}
37-
- uses: goreleaser/goreleaser-action@v6 # run goreleaser
38-
with:
39-
version: latest
40-
args: release --clean
41-
env:
42-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19+
- name: Set up QEMU
20+
uses: docker/setup-qemu-action@v3
21+
- name: Set up Docker Buildx
22+
uses: docker/setup-buildx-action@v3
23+
- uses: actions/setup-go@v5
24+
with:
25+
go-version: '1.24'
26+
cache: true
27+
- uses: sigstore/cosign-installer@v3.9.1 # installs cosign
28+
# - uses: anchore/sbom-action/download-syft@v0.14.1 # installs syft
29+
- uses: docker/login-action@v3 # login to ghcr
30+
with:
31+
registry: ghcr.io
32+
username: ${{ github.repository_owner }}
33+
password: ${{ secrets.GITHUB_TOKEN }}
34+
- uses: goreleaser/goreleaser-action@v6 # run goreleaser
35+
with:
36+
version: latest
37+
args: release --clean
38+
env:
39+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)