Skip to content

Commit

Permalink
chore: enable yamllint check (#136)
Browse files Browse the repository at this point in the history
Fix #129

---------

Signed-off-by: Loong <long0dai@foxmail.com>
  • Loading branch information
daixiang0 authored Jan 20, 2025
1 parent b3b4b7d commit 5defe2c
Show file tree
Hide file tree
Showing 10 changed files with 92 additions and 31 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,10 @@ jobs:
fail-fast: false
matrix:
include:
- name: v1.33.0
envoy_version: envoyproxy/envoy:v1.33.0
- name: latest
envoy_version: envoyproxy/envoy-dev:latest
- name: v1.33.0
envoy_version: envoyproxy/envoy:v1.33.0
- name: latest
envoy_version: envoyproxy/envoy-dev:latest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -156,10 +156,10 @@ jobs:
fail-fast: false
matrix:
include:
- name: v1.2.5
envoy_gateway_version: v1.2.5
- name: latest
envoy_gateway_version: v0.0.0-latest
- name: v1.2.5
envoy_gateway_version: v1.2.5
- name: latest
envoy_gateway_version: v0.0.0-latest
steps:
- uses: actions/checkout@v4
if: github.event_name != 'pull_request_target'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docker_builds_template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ jobs:
- uses: docker/setup-buildx-action@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0

- name: Set up Docker buildx
id: buildx
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1

- name: Login into GitHub Container Registry
uses: docker/login-action@v3
Expand Down
53 changes: 53 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---

ignore: |
manifests/charts/ai-gateway-helm

rules:
braces:
min-spaces-inside: 0
max-spaces-inside: 0
min-spaces-inside-empty: -1
max-spaces-inside-empty: -1
brackets:
min-spaces-inside: 0
max-spaces-inside: 1
min-spaces-inside-empty: -1
max-spaces-inside-empty: -1
colons:
max-spaces-before: 0
max-spaces-after: 1
commas:
max-spaces-before: 1
min-spaces-after: 1
max-spaces-after: 1
comments:
level: error
require-starting-space: true
min-spaces-from-content: 2
comments-indentation:
level: warning
document-end: disable
document-start: disable
empty-lines:
max: 2
max-start: 0
max-end: 1
empty-values:
forbid-in-block-mappings: false
forbid-in-flow-mappings: true
hyphens:
max-spaces-after: 1
indentation:
spaces: 2
indent-sequences: consistent # be consistent: don't mix indentation styles in one file.
check-multi-line-strings: false
key-duplicates: enable
key-ordering: disable
new-line-at-end-of-file: enable
new-lines:
type: unix
trailing-spaces: enable
truthy:
check-keys: false # GitHub Actions uses "on:" as a key
level: warning
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ codespell: $(CODESPELL)
@echo "spell => ./..."
@$(CODESPELL) --skip $(CODESPELL_SKIP) --ignore-words $(CODESPELL_IGNORE_WORDS)

.PHONY: yamllint
yamllint: $(YAMLLINT)
@echo "yamllint => ./..."
@$(YAMLLINT) --config-file=.yamllint $$(git ls-files :*.yml :*.yaml | xargs -L1 dirname | sort -u)

# This runs the formatter on the codebase as well as goimports via gci.
.PHONY: format
format: gci gofumpt
Expand All @@ -79,7 +84,7 @@ apigen: controller-gen

# This runs all necessary steps to prepare for a commit.
.PHONY: precommit
precommit: tidy codespell apigen format lint editorconfig helm-lint
precommit: tidy codespell apigen format lint editorconfig yamllint helm-lint

# This runs precommit and checks for any differences in the codebase, failing if there are any.
.PHONY: check
Expand Down
3 changes: 3 additions & 0 deletions Makefile.tools.mk
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ GO_FUMPT = $(LOCALBIN)/gofumpt
GCI = $(LOCALBIN)/gci
EDITORCONFIG_CHECKER = $(LOCALBIN)/editorconfig-checker
CODESPELL = $(LOCALBIN)/.venv/codespell@v2.3.0/bin/codespell
YAMLLINT = $(LOCALBIN)/.venv/yamllint@1.35.1/bin/yamllint
KIND ?= $(LOCALBIN)/kind

## Tool versions.
Expand Down Expand Up @@ -63,6 +64,8 @@ $(KIND): $(LOCALBIN)

$(CODESPELL): .bin/.venv/codespell@v2.3.0

$(YAMLLINT): .bin/.venv/yamllint@1.35.1

# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
# $1 - target path with name of binary
# $2 - package url which can be installed
Expand Down
8 changes: 4 additions & 4 deletions tests/cel-validation/testdata/aigatewayroutes/basic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ spec:
group: gateway.networking.k8s.io
rules:
- matches:
- headers:
- type: Exact
name: x-envoy-ai-gateway-model
value: llama3-70b
- headers:
- type: Exact
name: x-envoy-ai-gateway-model
value: llama3-70b
backendRefs:
- name: kserve
weight: 20
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ spec:
name: OpenAI
rules:
- matches:
- headers:
- type: Exact
name: x-envoy-ai-gateway-model
value: llama3-70b
- headers:
- type: Exact
name: x-envoy-ai-gateway-model
value: llama3-70b
backendRefs:
- name: kserve
weight: 20
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ spec:
group: gateway.networking.k8s.io
rules:
- matches:
- headers:
- type: Exact
name: x-envoy-ai-gateway-model
value: llama3-70b
- headers:
- type: Exact
name: x-envoy-ai-gateway-model
value: llama3-70b
backendRefs:
- name: kserve
weight: 20
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ spec:
group: gateway.networking.k8s.io
rules:
- matches:
- headers:
- type: Exact
name: x-envoy-ai-gateway-model
value: llama3-70b
- headers:
- type: Exact
name: x-envoy-ai-gateway-model
value: llama3-70b
backendRefs:
- name: kserve
weight: 20
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ spec:
group: gateway.networking.k8s.io
rules:
- matches:
- headers:
- type: RegularExpression
name: x-envoy-ai-gateway-model
value: llama3-70b
- headers:
- type: RegularExpression
name: x-envoy-ai-gateway-model
value: llama3-70b
backendRefs:
- name: kserve
weight: 20
Expand Down

0 comments on commit 5defe2c

Please sign in to comment.