Skip to content

Commit

Permalink
Merge pull request #3069 from everettraven/actions/yamllint
Browse files Browse the repository at this point in the history
🌱 add GitHub Action to lint yaml
  • Loading branch information
k8s-ci-robot authored Nov 28, 2022
2 parents ce42706 + 758ab61 commit 3044376
Show file tree
Hide file tree
Showing 26 changed files with 48 additions and 42 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,10 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
labels: kind/bug
body: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}

yamllint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run yamllint make target
run: make yamllint
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,17 @@ generate-testdata: ## Update/generate the testdata in $GOPATH/src/sigs.k8s.io/ku
./test/testdata/generate.sh

.PHONY: lint
lint: golangci-lint ## Run golangci-lint linter
lint: golangci-lint yamllint ## Run golangci-lint linter & yamllint
$(GOLANGCI_LINT) run

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

.PHONY: yamllint
yamllint:
@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

GOLANGCI_LINT = $(shell pwd)/bin/golangci-lint
golangci-lint:
@[ -f $(GOLANGCI_LINT) ] || { \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func (f *KustomizeConfig) SetTemplateDefaults() error {
}

//nolint:lll
const kustomizeConfigTemplate = `# This configuration is for teaching kustomize how to update name ref and var substitution
const kustomizeConfigTemplate = `# This configuration is for teaching kustomize how to update name ref and var substitution
nameReference:
- kind: Issuer
group: cert-manager.io
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func (f *KustomizeConfig) SetTemplateDefaults() error {
}

//nolint:lll
const kustomizeConfigTemplate = `# This configuration is for teaching kustomize how to update name ref substitution
const kustomizeConfigTemplate = `# This configuration is for teaching kustomize how to update name ref substitution
nameReference:
- kind: Issuer
group: cert-manager.io
Expand Down
2 changes: 1 addition & 1 deletion pkg/plugins/golang/deploy-image/v1alpha1/scaffolds/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,5 +327,5 @@ const recorderTemplate = `
Recorder: mgr.GetEventRecorderFor("%s-controller"),`

const envVarTemplate = `
- name: %s_IMAGE
- name: %s_IMAGE
value: %s`
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,11 @@ kind: {{ .Resource.Kind }}
metadata:
name: {{ lower .Resource.Kind }}-sample
spec:
# TODO(user): edit the following value to ensure the number
# of Pods/Instances your Operand must have on cluster
# TODO(user): edit the following value to ensure the number
# of Pods/Instances your Operand must have on cluster
size: 1
{{ if not (isEmptyStr .Port) -}}
{{ if not (isEmptyStr .Port) -}}
# TODO(user): edit the following value to ensure the container has the right port to be initialized
containerPort: {{ .Port }}
{{- end }}
containerPort: {{ .Port }}
{{- end }}
`
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func (f *Certificate) SetTemplateDefaults() error {

const certManagerTemplate = `# The following manifests contain a self-signed issuer CR and a certificate CR.
# More document can be found at https://docs.cert-manager.io
# WARNING: Targets CertManager 0.11 check https://docs.cert-manager.io/en/latest/tasks/upgrading/index.html for
# WARNING: Targets CertManager 0.11 check https://docs.cert-manager.io/en/latest/tasks/upgrading/index.html for
# breaking changes
apiVersion: cert-manager.io/v1alpha2
kind: Issuer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func (f *KustomizeConfig) SetTemplateDefaults() error {
}

//nolint:lll
const kustomizeConfigTemplate = `# This configuration is for teaching kustomize how to update name ref and var substitution
const kustomizeConfigTemplate = `# This configuration is for teaching kustomize how to update name ref and var substitution
nameReference:
- kind: Issuer
group: cert-manager.io
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func (f *ManagerAuthProxyPatch) SetTemplateDefaults() error {
return nil
}

const kustomizeAuthProxyPatchTemplate = `# This patch inject a sidecar container which is a HTTP proxy for the
const kustomizeAuthProxyPatchTemplate = `# This patch inject a sidecar container which is a HTTP proxy for the
# controller manager, it performs RBAC authorization against the Kubernetes API using SubjectAccessReviews.
apiVersion: apps/v1
kind: Deployment
Expand Down
2 changes: 1 addition & 1 deletion testdata/project-v2/config/certmanager/certificate.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# The following manifests contain a self-signed issuer CR and a certificate CR.
# More document can be found at https://docs.cert-manager.io
# WARNING: Targets CertManager 0.11 check https://docs.cert-manager.io/en/latest/tasks/upgrading/index.html for
# WARNING: Targets CertManager 0.11 check https://docs.cert-manager.io/en/latest/tasks/upgrading/index.html for
# breaking changes
apiVersion: cert-manager.io/v1alpha2
kind: Issuer
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This configuration is for teaching kustomize how to update name ref and var substitution
# This configuration is for teaching kustomize how to update name ref and var substitution
nameReference:
- kind: Issuer
group: cert-manager.io
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This patch inject a sidecar container which is a HTTP proxy for the
# This patch inject a sidecar container which is a HTTP proxy for the
# controller manager, it performs RBAC authorization against the Kubernetes API using SubjectAccessReviews.
apiVersion: apps/v1
kind: Deployment
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This configuration is for teaching kustomize how to update name ref and var substitution
# This configuration is for teaching kustomize how to update name ref and var substitution
nameReference:
- kind: Issuer
group: cert-manager.io
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This configuration is for teaching kustomize how to update name ref and var substitution
# This configuration is for teaching kustomize how to update name ref and var substitution
nameReference:
- kind: Issuer
group: cert-manager.io
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This configuration is for teaching kustomize how to update name ref and var substitution
# This configuration is for teaching kustomize how to update name ref and var substitution
nameReference:
- kind: Issuer
group: cert-manager.io
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ spec:
image: controller:latest
name: manager
env:
- name: BUSYBOX_IMAGE
- name: BUSYBOX_IMAGE
value: busybox:1.28
- name: MEMCACHED_IMAGE
- name: MEMCACHED_IMAGE
value: memcached:1.4.36-alpine
securityContext:
allowPrivilegeEscalation: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ kind: Busybox
metadata:
name: busybox-sample
spec:
# TODO(user): edit the following value to ensure the number
# of Pods/Instances your Operand must have on cluster
# TODO(user): edit the following value to ensure the number
# of Pods/Instances your Operand must have on cluster
size: 1


Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ kind: Memcached
metadata:
name: memcached-sample
spec:
# TODO(user): edit the following value to ensure the number
# of Pods/Instances your Operand must have on cluster
# TODO(user): edit the following value to ensure the number
# of Pods/Instances your Operand must have on cluster
size: 1

# TODO(user): edit the following value to ensure the container has the right port to be initialized
# TODO(user): edit the following value to ensure the container has the right port to be initialized
containerPort: 11211
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This configuration is for teaching kustomize how to update name ref and var substitution
# This configuration is for teaching kustomize how to update name ref and var substitution
nameReference:
- kind: Issuer
group: cert-manager.io
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This configuration is for teaching kustomize how to update name ref substitution
# This configuration is for teaching kustomize how to update name ref substitution
nameReference:
- kind: Issuer
group: cert-manager.io
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This configuration is for teaching kustomize how to update name ref substitution
# This configuration is for teaching kustomize how to update name ref substitution
nameReference:
- kind: Issuer
group: cert-manager.io
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This configuration is for teaching kustomize how to update name ref substitution
# This configuration is for teaching kustomize how to update name ref substitution
nameReference:
- kind: Issuer
group: cert-manager.io
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ spec:
image: controller:latest
name: manager
env:
- name: BUSYBOX_IMAGE
- name: BUSYBOX_IMAGE
value: busybox:1.28
- name: MEMCACHED_IMAGE
- name: MEMCACHED_IMAGE
value: memcached:1.4.36-alpine
securityContext:
allowPrivilegeEscalation: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ kind: Busybox
metadata:
name: busybox-sample
spec:
# TODO(user): edit the following value to ensure the number
# of Pods/Instances your Operand must have on cluster
# TODO(user): edit the following value to ensure the number
# of Pods/Instances your Operand must have on cluster
size: 1


Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ kind: Memcached
metadata:
name: memcached-sample
spec:
# TODO(user): edit the following value to ensure the number
# of Pods/Instances your Operand must have on cluster
# TODO(user): edit the following value to ensure the number
# of Pods/Instances your Operand must have on cluster
size: 1

# TODO(user): edit the following value to ensure the container has the right port to be initialized
# TODO(user): edit the following value to ensure the container has the right port to be initialized
containerPort: 11211
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This configuration is for teaching kustomize how to update name ref substitution
# This configuration is for teaching kustomize how to update name ref substitution
nameReference:
- kind: Issuer
group: cert-manager.io
Expand Down

0 comments on commit 3044376

Please sign in to comment.