ci: add yamllint

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
Tonis Tiigi 2024-07-12 17:32:55 -07:00
parent 0d37d68efd
commit c46193baba
No known key found for this signature in database
GPG Key ID: AFA9DE5F8AB7AF39
4 changed files with 54 additions and 41 deletions

View File

@ -90,7 +90,7 @@ body:
FROM alpine FROM alpine
echo hello echo hello
``` ```
```hcl ```hcl
group "default" { group "default" {
targets = ["app"] targets = ["app"]
@ -100,7 +100,7 @@ body:
target = "build" target = "build"
} }
``` ```
```console ```console
$ docker buildx build . $ docker buildx build .
$ docker buildx bake $ docker buildx bake

75
.github/labeler.yml vendored
View File

@ -1,104 +1,103 @@
# Add 'area/project' label to changes in basic project documentation and .github folder, excluding .github/workflows # Add 'area/project' label to changes in basic project documentation and .github folder, excluding .github/workflows
area/project: area/project:
- all: - all:
- changed-files: - changed-files:
- any-glob-to-any-file: - any-glob-to-any-file:
- .github/** - .github/**
- LICENSE - LICENSE
- AUTHORS - AUTHORS
- MAINTAINERS - MAINTAINERS
- PROJECT.md - PROJECT.md
- README.md - README.md
- .gitignore - .gitignore
- codecov.yml - codecov.yml
- all-globs-to-all-files: '!.github/workflows/*' - all-globs-to-all-files: '!.github/workflows/*'
# Add 'area/github-actions' label to changes in the .github/workflows folder # Add 'area/github-actions' label to changes in the .github/workflows folder
area/ci: area/ci:
- changed-files: - changed-files:
- any-glob-to-any-file: '.github/workflows/**' - any-glob-to-any-file: '.github/workflows/**'
# Add 'area/bake' label to changes in the bake # Add 'area/bake' label to changes in the bake
area/bake: area/bake:
- changed-files: - changed-files:
- any-glob-to-any-file: 'bake/**' - any-glob-to-any-file: 'bake/**'
# Add 'area/bake/compose' label to changes in the bake+compose # Add 'area/bake/compose' label to changes in the bake+compose
area/bake/compose: area/bake/compose:
- changed-files: - changed-files:
- any-glob-to-any-file: - any-glob-to-any-file:
- bake/compose.go - bake/compose.go
- bake/compose_test.go - bake/compose_test.go
# Add 'area/build' label to changes in build files # Add 'area/build' label to changes in build files
area/build: area/build:
- changed-files: - changed-files:
- any-glob-to-any-file: 'build/**' - any-glob-to-any-file: 'build/**'
# Add 'area/builder' label to changes in builder files # Add 'area/builder' label to changes in builder files
area/builder: area/builder:
- changed-files: - changed-files:
- any-glob-to-any-file: 'builder/**' - any-glob-to-any-file: 'builder/**'
# Add 'area/cli' label to changes in the CLI # Add 'area/cli' label to changes in the CLI
area/cli: area/cli:
- changed-files: - changed-files:
- any-glob-to-any-file: - any-glob-to-any-file:
- cmd/** - cmd/**
- commands/** - commands/**
# Add 'area/controller' label to changes in the controller # Add 'area/controller' label to changes in the controller
area/controller: area/controller:
- changed-files: - changed-files:
- any-glob-to-any-file: 'controller/**' - any-glob-to-any-file: 'controller/**'
# Add 'area/docs' label to markdown files in the docs folder # Add 'area/docs' label to markdown files in the docs folder
area/docs: area/docs:
- changed-files: - changed-files:
- any-glob-to-any-file: 'docs/**/*.md' - any-glob-to-any-file: 'docs/**/*.md'
# Add 'area/dependencies' label to changes in go dependency files # Add 'area/dependencies' label to changes in go dependency files
area/dependencies: area/dependencies:
- changed-files: - changed-files:
- any-glob-to-any-file: - any-glob-to-any-file:
- go.mod - go.mod
- go.sum - go.sum
- vendor/** - vendor/**
# Add 'area/driver' label to changes in the driver folder # Add 'area/driver' label to changes in the driver folder
area/driver: area/driver:
- changed-files: - changed-files:
- any-glob-to-any-file: 'driver/**' - any-glob-to-any-file: 'driver/**'
# Add 'area/driver/docker' label to changes in the docker driver # Add 'area/driver/docker' label to changes in the docker driver
area/driver/docker: area/driver/docker:
- changed-files: - changed-files:
- any-glob-to-any-file: 'driver/docker/**' - any-glob-to-any-file: 'driver/docker/**'
# Add 'area/driver/docker-container' label to changes in the docker-container driver # Add 'area/driver/docker-container' label to changes in the docker-container driver
area/driver/docker-container: area/driver/docker-container:
- changed-files: - changed-files:
- any-glob-to-any-file: 'driver/docker-container/**' - any-glob-to-any-file: 'driver/docker-container/**'
# Add 'area/driver/kubernetes' label to changes in the kubernetes driver # Add 'area/driver/kubernetes' label to changes in the kubernetes driver
area/driver/kubernetes: area/driver/kubernetes:
- changed-files: - changed-files:
- any-glob-to-any-file: 'driver/kubernetes/**' - any-glob-to-any-file: 'driver/kubernetes/**'
# Add 'area/driver/remote' label to changes in the remote driver # Add 'area/driver/remote' label to changes in the remote driver
area/driver/remote: area/driver/remote:
- changed-files: - changed-files:
- any-glob-to-any-file: 'driver/remote/**' - any-glob-to-any-file: 'driver/remote/**'
# Add 'area/hack' label to changes in the hack folder # Add 'area/hack' label to changes in the hack folder
area/hack: area/hack:
- changed-files: - changed-files:
- any-glob-to-any-file: 'hack/**' - any-glob-to-any-file: 'hack/**'
# Add 'area/tests' label to changes in test files # Add 'area/tests' label to changes in test files
area/tests: area/tests:
- changed-files: - changed-files:
- any-glob-to-any-file: - any-glob-to-any-file:
- tests/** - tests/**
- '**/*_test.go' - '**/*_test.go'

View File

@ -31,7 +31,7 @@ group "default" {
} }
group "validate" { group "validate" {
targets = ["lint", "lint-gopls", "validate-golangci", "validate-vendor", "validate-docs"] targets = ["lint", "lint-gopls", "lint-yaml", "validate-golangci", "validate-vendor", "validate-docs"]
} }
target "lint" { target "lint" {
@ -64,6 +64,14 @@ target "lint-gopls" {
target = "gopls-analyze" target = "gopls-analyze"
} }
target "lint-yaml" {
description = "Lint Github Actions workflows and other YAML files"
inherits = ["_common"]
dockerfile = "./hack/dockerfiles/lint.Dockerfile"
target = "yamllint"
output = ["type=cacheonly"]
}
target "validate-vendor" { target "validate-vendor" {
inherits = ["_common"] inherits = ["_common"]
dockerfile = "./hack/dockerfiles/vendor.Dockerfile" dockerfile = "./hack/dockerfiles/vendor.Dockerfile"

View File

@ -75,4 +75,10 @@ RUN --mount=target=. \
done done
EOF EOF
FROM alpine AS yamllint
RUN apk add --no-cache yamllint
WORKDIR /go/src/github.com/docker/buildx
RUN --mount=type=bind \
yamllint -c .yamllint.yml --strict .
FROM lint FROM lint