Skip to content

Commit

Permalink
Use pre-commit to generate the expected files
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Apr 19, 2023
1 parent f3bd1a1 commit d54ef0f
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 24 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@ jobs:
- run: helm dependency update .
- run: helm lint .
- run: helm lint --values=tests/values.yaml .
- run: helm template --namespace=default --values=tests/values.yaml custom . > tests/actual.yaml
- run: diff --ignore-trailing-space tests/actual.yaml tests/expected.yaml
if: matrix.helm == 'master'

- name: Setup k3s/k3d
run: c2cciutils-k8s-install
Expand Down
17 changes: 17 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ ci:
- helm-lock
- helmlint
- ripsecrets
- helm-template-gen

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
Expand All @@ -29,6 +30,22 @@ repos:
- id: copyright
- id: workflows-require-timeout
- id: helm-lock
- repo: https://github.com/camptocamp/helm-common
rev: 0.6.0
hooks:
- id: helm-template-gen
files: |-
(?x)(
^templates/.*$
|^values\.yaml$
|^Chart\.yaml$
|^tests/values\.yaml$
)
args:
- --values=tests/values.yaml
- custom
- .
- tests/expected.yaml
- repo: https://github.com/codespell-project/codespell
rev: v2.2.4
hooks:
Expand Down
6 changes: 0 additions & 6 deletions Makefile

This file was deleted.

30 changes: 15 additions & 15 deletions tests/expected.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: custom-custom-pod-with-serv
name: custom-custom-pod-with-service-name
labels:
app.kubernetes.io/name: custom-pod
app.kubernetes.io/instance: custom
Expand Down Expand Up @@ -54,15 +54,15 @@ spec:
apiVersion: v1
kind: Service
metadata:
name: custom-custom-pod-with-serv
name: custom-custom-pod-with-service-name
labels:
helm.sh/chart: custom-pod
app.kubernetes.io/version: "1.0"
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: custom-pod
app.kubernetes.io/instance: custom
app.kubernetes.io/component: with-service-name
one-custom-label: "hello-world"
one-custom-label: hello-world
annotations:
one-custom-annotation: abc
two-custom-annotations: xyz
Expand Down Expand Up @@ -130,7 +130,7 @@ spec:
apiVersion: apps/v1
kind: Deployment
metadata:
name: custom-custom-pod-with-serv
name: custom-custom-pod-with-service-name
labels:
helm.sh/chart: custom-pod
app.kubernetes.io/version: "1.0"
Expand Down Expand Up @@ -168,7 +168,7 @@ spec:
imagePullPolicy: IfNotPresent
env:
- name: "TEST"
value: "aa"
value: aa
terminationMessagePolicy: FallbackToLogsOnError
resources:
limits:
Expand All @@ -192,7 +192,7 @@ spec:
name: "jwt-key-secret"
key: "JWT_SECRET_KEY"
- name: "MY_ENV_VAR"
value: "some-value"
value: some-value
terminationMessagePolicy: FallbackToLogsOnError
resources:
null
Expand Down Expand Up @@ -220,7 +220,7 @@ spec:
imagePullPolicy: IfNotPresent
env:
- name: "TEST"
value: "aa"
value: aa
terminationMessagePolicy: FallbackToLogsOnError
resources:
limits:
Expand All @@ -244,7 +244,7 @@ spec:
name: "jwt-key-secret"
key: "JWT_SECRET_KEY"
- name: "MY_ENV_VAR"
value: "some-value"
value: some-value
terminationMessagePolicy: FallbackToLogsOnError
resources:
null
Expand Down Expand Up @@ -329,7 +329,7 @@ spec:
imagePullPolicy: IfNotPresent
env:
- name: "TEST"
value: "aa"
value: aa
terminationMessagePolicy: FallbackToLogsOnError
resources:
limits:
Expand All @@ -353,7 +353,7 @@ spec:
name: "jwt-key-secret"
key: "JWT_SECRET_KEY"
- name: "MY_ENV_VAR"
value: "some-value"
value: some-value
terminationMessagePolicy: FallbackToLogsOnError
resources:
null
Expand Down Expand Up @@ -437,7 +437,7 @@ spec:
imagePullPolicy: IfNotPresent
env:
- name: "TEST"
value: "aa"
value: aa
terminationMessagePolicy: FallbackToLogsOnError
resources:
limits:
Expand All @@ -461,7 +461,7 @@ spec:
name: "jwt-key-secret"
key: "JWT_SECRET_KEY"
- name: "MY_ENV_VAR"
value: "some-value"
value: some-value
terminationMessagePolicy: FallbackToLogsOnError
resources:
null
Expand Down Expand Up @@ -532,7 +532,7 @@ spec:
pathType: Prefix
backend:
service:
name: custom-custom-pod-with-serv
name: custom-custom-pod-with-service-name
port:
number: 8080
- path: "/two"
Expand All @@ -556,7 +556,7 @@ spec:
pathType: Prefix
backend:
service:
name: custom-custom-pod-with-serv
name: custom-custom-pod-with-service-name
port:
number: 8080
- path: "/two"
Expand Down Expand Up @@ -602,7 +602,7 @@ spec:
pathType: Prefix
backend:
service:
name: custom-custom-pod-with-serv
name: custom-custom-pod-with-service-name
port:
number: 8080
- path: "/two"
Expand Down

0 comments on commit d54ef0f

Please sign in to comment.