-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Bake workflow for validation #3664
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
1b721f4
hack: bake definition with vendor targets
crazy-max 416883f
hack: authors Dockerfile and bake target
crazy-max c888041
hack: lint bake target
crazy-max d31e77f
hack: doctoc bake target
crazy-max d2a4031
hack: generated-files bake target
crazy-max 0582a1a
hack: shfmt bake target
crazy-max 8eb972c
ci(validate): use bake
crazy-max File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,46 +1,78 @@ | ||
| prefix=/usr/local | ||
| bindir=$(prefix)/bin | ||
|
|
||
| binaries: FORCE | ||
| export BUILDX_CMD ?= docker buildx | ||
|
|
||
| .PHONY: binaries | ||
| binaries: | ||
| hack/binaries | ||
|
|
||
| images: FORCE | ||
| .PHONY: images | ||
| images: | ||
| # moby/buildkit:local and moby/buildkit:local-rootless are created on Docker | ||
| hack/images local moby/buildkit | ||
| TARGET=rootless hack/images local moby/buildkit | ||
|
|
||
| install: FORCE | ||
| .PHONY: install | ||
| install: | ||
| mkdir -p $(DESTDIR)$(bindir) | ||
| install bin/* $(DESTDIR)$(bindir) | ||
|
|
||
| clean: FORCE | ||
| .PHONY: clean | ||
| clean: | ||
| rm -rf ./bin | ||
|
|
||
| .PHONY: test | ||
| test: | ||
| ./hack/test integration gateway dockerfile | ||
|
|
||
| .PHONY: lint | ||
| lint: | ||
| ./hack/lint | ||
| $(BUILDX_CMD) bake lint | ||
|
|
||
| .PHONY: validate-vendor | ||
| validate-vendor: | ||
| ./hack/validate-vendor | ||
| $(BUILDX_CMD) bake validate-vendor | ||
|
|
||
| .PHONY: validate-shfmt | ||
| validate-shfmt: | ||
| ./hack/validate-shfmt | ||
| $(BUILDX_CMD) bake validate-shfmt | ||
|
|
||
| .PHONY: shfmt | ||
| shfmt: | ||
| ./hack/shfmt | ||
| $(BUILDX_CMD) bake shfmt | ||
|
|
||
| .PHONY: validate-authors | ||
| validate-authors: | ||
| $(BUILDX_CMD) bake validate-authors | ||
|
|
||
| .PHONY: validate-generated-files | ||
| validate-generated-files: | ||
| ./hack/validate-generated-files | ||
| $(BUILDX_CMD) bake validate-generated-files | ||
|
|
||
| validate-all: test lint validate-vendor validate-generated-files | ||
| .PHONY: validate-doctoc | ||
| validate-doctoc: | ||
| $(BUILDX_CMD) bake validate-doctoc | ||
|
|
||
| .PHONY: validate-all | ||
| validate-all: test lint validate-vendor validate-generated-files validate-doctoc | ||
|
|
||
| .PHONY: vendor | ||
| vendor: | ||
| ./hack/update-vendor | ||
| $(eval $@_TMP_OUT := $(shell mktemp -d -t buildkit-output.XXXXXXXXXX)) | ||
| $(BUILDX_CMD) bake --set "*.output=type=local,dest=$($@_TMP_OUT)" vendor | ||
| rm -rf ./vendor | ||
| cp -R "$($@_TMP_OUT)"/out/* . | ||
| rm -rf "$($@_TMP_OUT)"/ | ||
|
|
||
| .PHONY: generated-files | ||
| generated-files: | ||
| ./hack/update-generated-files | ||
| $(BUILDX_CMD) bake generated-files | ||
|
|
||
| .PHONY: authors | ||
| authors: | ||
| $(BUILDX_CMD) bake authors | ||
|
|
||
| .PHONY: vendor generated-files test binaries images install clean lint validate-all validate-vendor validate-generated-files | ||
| FORCE: | ||
| .PHONY: doctoc | ||
| doctoc: | ||
| $(BUILDX_CMD) bake doctoc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| variable "ALPINE_VERSION" { | ||
| default = null | ||
| } | ||
|
|
||
| variable "GO_VERSION" { | ||
| default = null | ||
| } | ||
|
|
||
| variable "NODE_VERSION" { | ||
| default = null | ||
| } | ||
|
|
||
| target "_common" { | ||
| args = { | ||
| ALPINE_VERSION = ALPINE_VERSION | ||
| GO_VERSION = GO_VERSION | ||
| NODE_VERSION = NODE_VERSION | ||
| BUILDKIT_CONTEXT_KEEP_GIT_DIR = 1 | ||
| } | ||
| } | ||
|
|
||
| group "validate" { | ||
| targets = ["lint", "validate-vendor", "validate-doctoc", "validate-generated-files", "validate-shfmt"] | ||
| } | ||
|
|
||
| target "lint" { | ||
| inherits = ["_common"] | ||
| dockerfile = "./hack/dockerfiles/lint.Dockerfile" | ||
| output = ["type=cacheonly"] | ||
| } | ||
|
|
||
| target "validate-vendor" { | ||
| inherits = ["_common"] | ||
| dockerfile = "./hack/dockerfiles/vendor.Dockerfile" | ||
| target = "validate" | ||
| output = ["type=cacheonly"] | ||
| } | ||
|
|
||
| target "validate-generated-files" { | ||
| inherits = ["_common"] | ||
| dockerfile = "./hack/dockerfiles/generated-files.Dockerfile" | ||
| target = "validate" | ||
| output = ["type=cacheonly"] | ||
| } | ||
|
|
||
| target "validate-shfmt" { | ||
| inherits = ["_common"] | ||
| dockerfile = "./hack/dockerfiles/shfmt.Dockerfile" | ||
| target = "validate" | ||
| output = ["type=cacheonly"] | ||
| } | ||
|
|
||
| target "validate-doctoc" { | ||
| inherits = ["_common"] | ||
| dockerfile = "./hack/dockerfiles/doctoc.Dockerfile" | ||
| target = "validate-toc" | ||
| output = ["type=cacheonly"] | ||
| } | ||
|
|
||
| target "validate-authors" { | ||
| inherits = ["_common"] | ||
| dockerfile = "./hack/dockerfiles/authors.Dockerfile" | ||
| target = "validate" | ||
| output = ["type=cacheonly"] | ||
| } | ||
|
|
||
| target "vendor" { | ||
| inherits = ["_common"] | ||
| dockerfile = "./hack/dockerfiles/vendor.Dockerfile" | ||
| target = "update" | ||
| output = ["."] | ||
| } | ||
|
|
||
| target "generated-files" { | ||
| inherits = ["_common"] | ||
| dockerfile = "./hack/dockerfiles/generated-files.Dockerfile" | ||
| target = "update" | ||
| output = ["."] | ||
| } | ||
|
|
||
| target "shfmt" { | ||
| inherits = ["_common"] | ||
| dockerfile = "./hack/dockerfiles/shfmt.Dockerfile" | ||
| target = "update" | ||
| output = ["."] | ||
| } | ||
|
|
||
| target "doctoc" { | ||
| inherits = ["_common"] | ||
| dockerfile = "./hack/dockerfiles/doctoc.Dockerfile" | ||
| target = "update" | ||
| output = ["."] | ||
| } | ||
|
|
||
| target "authors" { | ||
| inherits = ["_common"] | ||
| dockerfile = "./hack/dockerfiles/authors.Dockerfile" | ||
| target = "update" | ||
| output = ["."] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| # syntax=docker/dockerfile-upstream:master | ||
|
|
||
| ARG ALPINE_VERSION=3.17 | ||
|
|
||
| FROM alpine:${ALPINE_VERSION} AS gen | ||
| RUN apk add --no-cache git | ||
| WORKDIR /src | ||
| RUN --mount=type=bind,target=. <<EOT | ||
| set -e | ||
| mkdir /out | ||
| # see also ".mailmap" for how email addresses and names are deduplicated | ||
| { | ||
| echo "# This file lists all individuals having contributed content to the repository." | ||
| echo "# For how it is generated, see hack/dockerfiles/authors.Dockerfile." | ||
| echo | ||
| git log --format='%aN <%aE>' | LC_ALL=C.UTF-8 sort -uf | ||
| } > /out/AUTHORS | ||
| cat /out/AUTHORS | ||
| EOT | ||
|
|
||
| FROM scratch AS update | ||
| COPY --from=gen /out / | ||
|
|
||
| FROM gen AS validate | ||
| RUN --mount=type=bind,target=.,rw <<EOT | ||
| set -e | ||
| git add -A | ||
| cp -rf /out/* . | ||
| if [ -n "$(git status --porcelain -- AUTHORS)" ]; then | ||
| echo >&2 'ERROR: Authors result differs. Please update with "make authors"' | ||
| git status --porcelain -- AUTHORS | ||
| exit 1 | ||
| fi | ||
| EOT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| # syntax=docker/dockerfile-upstream:master | ||
|
|
||
| ARG NODE_VERSION=19 | ||
|
|
||
| FROM node:${NODE_VERSION}-alpine AS base | ||
| RUN apk add --no-cache git | ||
| WORKDIR /src | ||
|
|
||
| FROM base AS doctoc | ||
| RUN npm install -g doctoc | ||
| RUN --mount=type=bind,source=README.md,target=README.md,rw <<EOT | ||
| set -e | ||
| doctoc README.md | ||
| mkdir /out | ||
| cp README.md /out/ | ||
| EOT | ||
|
|
||
| FROM scratch AS update | ||
| COPY --from=doctoc /out / | ||
|
|
||
| FROM base AS validate-toc | ||
| RUN --mount=type=bind,target=.,rw \ | ||
| --mount=type=bind,from=doctoc,source=/out/README.md,target=./README.md <<EOT | ||
| set -e | ||
| diff=$(git status --porcelain -- 'README.md') | ||
| if [ -n "$diff" ]; then | ||
| echo >&2 'ERROR: The result of "doctoc" differs. Please update with "make doctoc"' | ||
| echo "$diff" | ||
| exit 1 | ||
| fi | ||
| EOT | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.