Skip to content

Commit 3044376

Browse files
authored
Merge pull request #3069 from everettraven/actions/yamllint
🌱 add GitHub Action to lint yaml
2 parents ce42706 + 758ab61 commit 3044376

File tree

26 files changed

+48
-42
lines changed

26 files changed

+48
-42
lines changed

.github/workflows/lint.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,10 @@ jobs:
5050
token: ${{ secrets.GITHUB_TOKEN }}
5151
labels: kind/bug
5252
body: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
53+
54+
yamllint:
55+
runs-on: ubuntu-latest
56+
steps:
57+
- uses: actions/checkout@v3
58+
- name: Run yamllint make target
59+
run: make yamllint

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,17 @@ generate-testdata: ## Update/generate the testdata in $GOPATH/src/sigs.k8s.io/ku
7272
./test/testdata/generate.sh
7373

7474
.PHONY: lint
75-
lint: golangci-lint ## Run golangci-lint linter
75+
lint: golangci-lint yamllint ## Run golangci-lint linter & yamllint
7676
$(GOLANGCI_LINT) run
7777

7878
.PHONY: lint-fix
7979
lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes
8080
$(GOLANGCI_LINT) run --fix
8181

82+
.PHONY: yamllint
83+
yamllint:
84+
@docker run --rm $$(tty -s && echo "-it" || echo) -v $(PWD):/data cytopia/yamllint:latest testdata -d "{extends: relaxed, rules: {line-length: {max: 120}}}" --no-warnings
85+
8286
GOLANGCI_LINT = $(shell pwd)/bin/golangci-lint
8387
golangci-lint:
8488
@[ -f $(GOLANGCI_LINT) ] || { \

pkg/plugins/common/kustomize/v1/scaffolds/internal/templates/config/certmanager/kustomizeconfig.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func (f *KustomizeConfig) SetTemplateDefaults() error {
4444
}
4545

4646
//nolint:lll
47-
const kustomizeConfigTemplate = `# This configuration is for teaching kustomize how to update name ref and var substitution
47+
const kustomizeConfigTemplate = `# This configuration is for teaching kustomize how to update name ref and var substitution
4848
nameReference:
4949
- kind: Issuer
5050
group: cert-manager.io

pkg/plugins/common/kustomize/v2-alpha/scaffolds/internal/templates/config/certmanager/kustomizeconfig.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func (f *KustomizeConfig) SetTemplateDefaults() error {
4444
}
4545

4646
//nolint:lll
47-
const kustomizeConfigTemplate = `# This configuration is for teaching kustomize how to update name ref substitution
47+
const kustomizeConfigTemplate = `# This configuration is for teaching kustomize how to update name ref substitution
4848
nameReference:
4949
- kind: Issuer
5050
group: cert-manager.io

pkg/plugins/golang/deploy-image/v1alpha1/scaffolds/api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,5 +327,5 @@ const recorderTemplate = `
327327
Recorder: mgr.GetEventRecorderFor("%s-controller"),`
328328

329329
const envVarTemplate = `
330-
- name: %s_IMAGE
330+
- name: %s_IMAGE
331331
value: %s`

pkg/plugins/golang/deploy-image/v1alpha1/scaffolds/internal/templates/config/samples/crd_sample.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,11 @@ kind: {{ .Resource.Kind }}
4949
metadata:
5050
name: {{ lower .Resource.Kind }}-sample
5151
spec:
52-
# TODO(user): edit the following value to ensure the number
53-
# of Pods/Instances your Operand must have on cluster
52+
# TODO(user): edit the following value to ensure the number
53+
# of Pods/Instances your Operand must have on cluster
5454
size: 1
55-
56-
{{ if not (isEmptyStr .Port) -}}
55+
{{ if not (isEmptyStr .Port) -}}
5756
# TODO(user): edit the following value to ensure the container has the right port to be initialized
58-
containerPort: {{ .Port }}
59-
{{- end }}
57+
containerPort: {{ .Port }}
58+
{{- end }}
6059
`

pkg/plugins/golang/v2/scaffolds/internal/templates/config/certmanager/certificate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func (f *Certificate) SetTemplateDefaults() error {
4242

4343
const certManagerTemplate = `# The following manifests contain a self-signed issuer CR and a certificate CR.
4444
# More document can be found at https://docs.cert-manager.io
45-
# WARNING: Targets CertManager 0.11 check https://docs.cert-manager.io/en/latest/tasks/upgrading/index.html for
45+
# WARNING: Targets CertManager 0.11 check https://docs.cert-manager.io/en/latest/tasks/upgrading/index.html for
4646
# breaking changes
4747
apiVersion: cert-manager.io/v1alpha2
4848
kind: Issuer

pkg/plugins/golang/v2/scaffolds/internal/templates/config/certmanager/kustomizeconfig.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func (f *KustomizeConfig) SetTemplateDefaults() error {
4141
}
4242

4343
//nolint:lll
44-
const kustomizeConfigTemplate = `# This configuration is for teaching kustomize how to update name ref and var substitution
44+
const kustomizeConfigTemplate = `# This configuration is for teaching kustomize how to update name ref and var substitution
4545
nameReference:
4646
- kind: Issuer
4747
group: cert-manager.io

pkg/plugins/golang/v2/scaffolds/internal/templates/config/kdefault/manager_auth_proxy_patch.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func (f *ManagerAuthProxyPatch) SetTemplateDefaults() error {
4242
return nil
4343
}
4444

45-
const kustomizeAuthProxyPatchTemplate = `# This patch inject a sidecar container which is a HTTP proxy for the
45+
const kustomizeAuthProxyPatchTemplate = `# This patch inject a sidecar container which is a HTTP proxy for the
4646
# controller manager, it performs RBAC authorization against the Kubernetes API using SubjectAccessReviews.
4747
apiVersion: apps/v1
4848
kind: Deployment

testdata/project-v2/config/certmanager/certificate.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# The following manifests contain a self-signed issuer CR and a certificate CR.
22
# More document can be found at https://docs.cert-manager.io
3-
# WARNING: Targets CertManager 0.11 check https://docs.cert-manager.io/en/latest/tasks/upgrading/index.html for
3+
# WARNING: Targets CertManager 0.11 check https://docs.cert-manager.io/en/latest/tasks/upgrading/index.html for
44
# breaking changes
55
apiVersion: cert-manager.io/v1alpha2
66
kind: Issuer

0 commit comments

Comments
 (0)