Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ jobs:
- test-go-redirects
- dockerfile-lint
- path-warnings
- validate-vendor
steps:
-
name: Set up Docker Buildx
Expand Down
19 changes: 18 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ RUN apk add --no-cache \
git \
nodejs \
npm \
gcompat
gcompat \
rsync

# npm downloads Node.js dependencies
FROM base AS npm
Expand Down Expand Up @@ -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)
Expand Down
7 changes: 6 additions & 1 deletion docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down Expand Up @@ -157,6 +157,11 @@ target "vendor" {
provenance = false
}

target "validate-vendor" {
target = "validate-vendor"
output = ["type=cacheonly"]
}

variable "UPSTREAM_MODULE_NAME" {
default = null
}
Expand Down