Skip to content

Commit d337805

Browse files
committed
handle vendor validation
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
1 parent 5849cda commit d337805

2 files changed

Lines changed: 16 additions & 4 deletions

File tree

Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.PHONY: all
2+
all:
3+
4+
.PHONY: vendor
5+
vendor:
6+
$(eval $@_TMP_OUT := $(shell mktemp -d -t policy-helpers-output.XXXXXXXXXX))
7+
docker buildx bake --set "*.output=type=local,dest=$($@_TMP_OUT)" vendor
8+
rm -rf ./vendor
9+
cp -R "$($@_TMP_OUT)"/* ./
10+
rm -rf "$($@_TMP_OUT)"/*

hack/dockerfiles/vendor.Dockerfile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ RUN --mount=target=/context \
1515
set -e
1616
rsync -a /context/. .
1717
go mod tidy
18+
go mod vendor
1819
mkdir /out
19-
cp -r go.mod go.sum /out
20+
cp -r go.mod go.sum vendor /out
2021
EOT
2122

2223
FROM scratch AS update
@@ -28,10 +29,11 @@ RUN --mount=target=/context \
2829
set -e
2930
rsync -a /context/. .
3031
git add -A
32+
rm -rf vendor
3133
cp -rf /out/* .
32-
if [ -n "$(git status --porcelain -- go.mod go.sum)" ]; then
33-
echo >&2 'ERROR: Vendor result differs. Please vendor your package with "docker buildx bake vendor"'
34-
git status --porcelain -- go.mod go.sum
34+
if [ -n "$(git status --porcelain -- go.mod go.sum vendor)" ]; then
35+
echo >&2 'ERROR: Vendor result differs. Please vendor your package with "make vendor"'
36+
git status --porcelain -- go.mod go.sum vendor
3537
exit 1
3638
fi
3739
EOT

0 commit comments

Comments
 (0)