validate vendor target

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax 2025-06-12 11:32:59 +02:00
parent fc6d7a28b4
commit 77ea1f9bc3
No known key found for this signature in database
GPG Key ID: ADE44D8C9D44FBE4
3 changed files with 25 additions and 2 deletions

View File

@ -91,6 +91,7 @@ jobs:
- test-go-redirects
- dockerfile-lint
- path-warnings
- validate-vendor
steps:
-
name: Set up Docker Buildx

View File

@ -14,7 +14,8 @@ RUN apk add --no-cache \
git \
nodejs \
npm \
gcompat
gcompat \
rsync
# npm downloads Node.js dependencies
FROM base AS npm
@ -87,6 +88,22 @@ FROM scratch AS vendor
COPY --from=update-modules /project/_vendor /_vendor
COPY --from=update-modules /project/go.* /
FROM base AS validate-vendor
RUN --mount=target=/context \
--mount=type=bind,from=vendor,target=/out \
--mount=target=.,type=tmpfs <<EOT
set -e
rsync -a /context/. .
git add -A
rm -rf _vendor
cp -rf /out/* .
if [ -n "$(git status --porcelain -- go.mod go.sum _vendor)" ]; then
echo >&2 'ERROR: Vendor result differs. Please vendor your package with "make vendor"'
git status --porcelain -- go.mod go.sum _vendor
exit 1
fi
EOT
# build-upstream builds an upstream project with a replacement module
FROM build-base AS build-upstream
# UPSTREAM_MODULE_NAME is the canonical upstream repository name and namespace (e.g. moby/buildkit)

View File

@ -36,7 +36,7 @@ target "release" {
}
group "validate" {
targets = ["lint", "test", "unused-media", "test-go-redirects", "dockerfile-lint", "path-warnings"]
targets = ["lint", "test", "unused-media", "test-go-redirects", "dockerfile-lint", "path-warnings", "validate-vendor"]
}
target "test" {
@ -157,6 +157,11 @@ target "vendor" {
provenance = false
}
target "validate-vendor" {
target = "validate-vendor"
output = ["type=cacheonly"]
}
variable "UPSTREAM_MODULE_NAME" {
default = null
}