Skip to content

Commit 5ffd2e6

Browse files
Merge pull request #134 from sighupio/chore/manifest-testing
ci: introduce manifest testing with kube-linter
2 parents 6bf7f41 + e404888 commit 5ffd2e6

4 files changed

Lines changed: 76 additions & 65 deletions

File tree

.bumpversion.cfg

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

.drone.yml

Lines changed: 39 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,28 @@
55
name: Check License Header Presence
66
kind: pipeline
77
type: docker
8-
98
clone:
109
depth: 1
11-
10+
volumes:
11+
- name: mise-cache
12+
host:
13+
path: /root/mise_data_dir
1214
steps:
13-
- name: Check License Header Presence
14-
image: docker.io/library/golang:1.20
15+
- name: check
16+
image: quay.io/sighup/mise:v2026.6.14
1517
pull: always
18+
environment:
19+
MISE_DATA_DIR: /mise-data
20+
GITHUB_TOKEN:
21+
from_secret: github_token
22+
volumes:
23+
- name: mise-cache
24+
path: /mise-data
1625
commands:
17-
- go install github.com/google/addlicense@v1.1.1
18-
- addlicense -c "SIGHUP s.r.l" -v -l bsd -y "2017-present" --check .
26+
- mise run check-license
1927

2028
---
21-
name: Linting
29+
name: validate
2230
kind: pipeline
2331
type: docker
2432

@@ -35,27 +43,9 @@ platform:
3543
environment:
3644
# Mise configuration envvars.
3745
MISE_DATA_DIR: /mise-data
38-
MISE_OVERRIDE_CONFIG_FILENAMES: "mise.ci.toml"
3946

4047
steps:
41-
# - name: lint
42-
# image: quay.io/sighup/policeman
43-
# pull: always
44-
# environment:
45-
# FILTER_REGEX_EXCLUDE: (\.github)
46-
# # Identifies false positives like missing 'selector'.
47-
# # Doing this is valid for Kustomize patches
48-
# VALIDATE_KUBERNETES_KUBEVAL: "false"
49-
# # Some duplicated code is intended.
50-
# VALIDATE_JSCPD: "false"
51-
# # hadolint already validated dockerfiles
52-
# VALIDATE_DOCKERFILE: "false"
53-
# # Disable natural language checks
54-
# VALIDATE_NATURAL_LANGUAGE: "false"
55-
# depends_on:
56-
# - clone
57-
58-
- name: Render Manifests
48+
- name: render
5949
image: quay.io/sighup/mise:v2025.4.4
6050
pull: always
6151
depends_on:
@@ -67,18 +57,31 @@ steps:
6757
- name: mise-cache
6858
path: /mise-data
6959
commands:
70-
- |
71-
mise use kustomize@5.6.0
72-
eval "$(mise activate bash --shims)"
60+
- eval "$(mise activate bash --shims)"
7361
- kustomize build katalog/gatekeeper > gatekeeper.yml
7462
- kustomize build katalog/kyverno > kyverno.yml
7563

64+
- name: lint
65+
image: quay.io/sighup/mise:v2026.6.14
66+
pull: always
67+
environment:
68+
MISE_DATA_DIR: /mise-data
69+
GITHUB_TOKEN:
70+
from_secret: github_token
71+
volumes:
72+
- name: mise-cache
73+
path: /mise-data
74+
depends_on:
75+
- render
76+
commands:
77+
- mise run lint
78+
7679
- &check-deprecated-apis
7780
name: check-deprecated-apis
7881
image: us-docker.pkg.dev/fairwinds-ops/oss/pluto:v5
7982
pull: always
8083
depends_on:
81-
- Render Manifests
84+
- lint
8285
commands:
8386
# we use --ignore-deprecations because we don't want the CI to fail when the API has not been removed yet.
8487
- /pluto detect $${KUBERNETES_MANIFESTS} --ignore-deprecations --target-versions=k8s=v1.35.0
@@ -102,7 +105,7 @@ kind: pipeline
102105
type: docker
103106

104107
depends_on:
105-
- Linting
108+
- validate
106109

107110
clone:
108111
depth: 1
@@ -114,7 +117,6 @@ platform:
114117
environment:
115118
# Mise configuration.
116119
MISE_DATA_DIR: "/mise-data"
117-
MISE_OVERRIDE_CONFIG_FILENAMES: "mise.ci.toml"
118120

119121
# Cluster version.
120122
CLUSTER_VERSION: "v1.33.2"
@@ -211,7 +213,7 @@ kind: pipeline
211213
type: docker
212214

213215
depends_on:
214-
- Linting
216+
- validate
215217

216218
clone:
217219
depth: 1
@@ -223,7 +225,6 @@ platform:
223225
environment:
224226
# Mise configuration.
225227
MISE_DATA_DIR: "/mise-data"
226-
MISE_OVERRIDE_CONFIG_FILENAMES: "mise.ci.toml"
227228

228229
# Cluster version.
229230
CLUSTER_VERSION: "v1.33.2"
@@ -320,7 +321,7 @@ kind: pipeline
320321
type: docker
321322

322323
depends_on:
323-
- Linting
324+
- validate
324325

325326
clone:
326327
depth: 1
@@ -332,7 +333,6 @@ platform:
332333
environment:
333334
# Mise configuration.
334335
MISE_DATA_DIR: "/mise-data"
335-
MISE_OVERRIDE_CONFIG_FILENAMES: "mise.ci.toml"
336336

337337
# Cluster version.
338338
CLUSTER_VERSION: "v1.34.0"
@@ -429,7 +429,7 @@ kind: pipeline
429429
type: docker
430430

431431
depends_on:
432-
- Linting
432+
- validate
433433

434434
clone:
435435
depth: 1
@@ -441,7 +441,6 @@ platform:
441441
environment:
442442
# Mise configuration.
443443
MISE_DATA_DIR: "/mise-data"
444-
MISE_OVERRIDE_CONFIG_FILENAMES: "mise.ci.toml"
445444

446445
# Cluster version.
447446
CLUSTER_VERSION: "v1.34.0"
@@ -538,7 +537,7 @@ kind: pipeline
538537
type: docker
539538

540539
depends_on:
541-
- Linting
540+
- validate
542541

543542
clone:
544543
depth: 1
@@ -550,7 +549,6 @@ platform:
550549
environment:
551550
# Mise configuration.
552551
MISE_DATA_DIR: "/mise-data"
553-
MISE_OVERRIDE_CONFIG_FILENAMES: "mise.ci.toml"
554552

555553
# Cluster version.
556554
CLUSTER_VERSION: "v1.35.0"
@@ -647,7 +645,7 @@ kind: pipeline
647645
type: docker
648646

649647
depends_on:
650-
- Linting
648+
- validate
651649

652650
clone:
653651
depth: 1
@@ -659,7 +657,6 @@ platform:
659657
environment:
660658
# Mise configuration.
661659
MISE_DATA_DIR: "/mise-data"
662-
MISE_OVERRIDE_CONFIG_FILENAMES: "mise.ci.toml"
663660

664661
# Cluster version.
665662
CLUSTER_VERSION: "v1.35.0"

.kube-linter.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright (c) 2017-present SIGHUP s.r.l All rights reserved.
2+
# Use of this source code is governed by a BSD-style
3+
# license that can be found in the LICENSE file.
4+
5+
checks:
6+
doNotAutoAddDefaults: false
7+
include:
8+
- exposed-services
9+
- use-namespace
10+
exclude:
11+
- job-ttl-seconds-after-finished
12+
- no-read-only-root-fs
13+
- pdb-unhealthy-pod-eviction-policy
14+
- privilege-escalation-container
15+
- privileged-container
16+
- run-as-non-root
17+
- unset-cpu-requirements
18+
- unset-memory-requirements
19+
ignorePaths:
20+
- katalog/tests/**

mise.toml

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
# license that can be found in the LICENSE file.
44

55
[tools]
6+
bats = "1.11.0"
7+
drone = "1.9.0"
68
kind = "0.31.0"
7-
kubectl = "1.35.5"
9+
kube-linter = "0.8.3"
10+
kubectl = "1.35.6"
811
kustomize = "5.6.0"
9-
bats = "1.11.0"
10-
drone = "latest"
1112
"ubi:google/addlicense" = "v1.1.1"
1213

1314
# Development task definitions
@@ -19,6 +20,14 @@ addlicense -c "SIGHUP s.r.l" -y "2017-present" -v -l bsd .
1920
echo "✅ License headers added!"
2021
'''
2122

23+
[tasks.check-license]
24+
description = "Check that all files have license headers"
25+
run = '''
26+
echo "🔍 Checking license headers..."
27+
addlicense -c "SIGHUP s.r.l" -y "2017-present" -v -l bsd --check .
28+
echo "✅ All files have license headers!"
29+
'''
30+
2231
[tasks.validate-manifests]
2332
description = "Validate all manifests can be built"
2433
run = '''
@@ -28,9 +37,10 @@ kustomize build katalog/kyverno > /dev/null && echo " ✅ kyverno"
2837
echo "✅ All manifests validated!"
2938
'''
3039

31-
[tasks.setup]
32-
description = "Complete development environment setup"
33-
depends = ["add-license", "validate-manifests"]
40+
[tasks.lint]
41+
description = "Lint all katalog manifests with kube-linter"
3442
run = '''
35-
echo "✅ Development environment ready!"
43+
echo "🔍 Linting katalog/ with kube-linter..."
44+
kube-linter lint --config .kube-linter.yaml katalog/
45+
echo "✅ All manifests passed linting!"
3646
'''

0 commit comments

Comments
 (0)