1
0
mirror of https://github.com/docker/docker-credential-helpers.git synced 2026-06-13 16:01:28 +05:30

Merge pull request #230 from crazy-max/vendor-license

vendor validation
This commit is contained in:
Sebastiaan van Stijn
2022-08-20 22:40:10 +02:00
committed by GitHub
4 changed files with 75 additions and 1 deletions
+19
View File
@@ -14,6 +14,25 @@ env:
GO_VERSION: 1.16.7
jobs:
validate:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
target:
- validate-vendor
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Run
run: |
make ${{ matrix.target }}
test:
runs-on: ${{ matrix.os }}
strategy:
+30 -1
View File
@@ -14,11 +14,40 @@ FROM crazymax/osxcross:${OSXCROSS_VERSION} AS osxcross
FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-alpine AS gobase
COPY --from=xx / /
RUN apk add --no-cache clang file git lld llvm pkgconf
RUN apk add --no-cache clang file git lld llvm pkgconf rsync
ENV GOFLAGS="-mod=vendor"
ENV CGO_ENABLED="1"
WORKDIR /src
FROM gobase AS vendored
RUN --mount=target=/context \
--mount=target=.,type=tmpfs \
--mount=target=/go/pkg/mod,type=cache <<EOT
set -e
rsync -a /context/. .
go mod tidy
go mod vendor
mkdir /out
cp -r go.mod go.sum vendor /out
EOT
FROM scratch AS vendor-update
COPY --from=vendored /out /
FROM vendored AS vendor-validate
RUN --mount=type=bind,target=.,rw <<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
FROM gobase AS version
ARG PKG
RUN --mount=target=. \
+12
View File
@@ -83,3 +83,15 @@ deb:
.
docker run --rm --net=none $(BUILDIMG) tar cf - /release | tar xf -
docker rmi $(BUILDIMG)
.PHONY: vendor
vendor:
$(eval $@_TMP_OUT := $(shell mktemp -d -t docker-output.XXXXXXXXXX))
docker buildx bake --set "*.output=type=local,dest=$($@_TMP_OUT)" vendor
rm -rf ./vendor
cp -R "$($@_TMP_OUT)"/* .
rm -rf "$($@_TMP_OUT)"
.PHONY: validate-vendor
validate-vendor:
docker buildx bake vendor-validate
+14
View File
@@ -21,6 +21,20 @@ group "default" {
targets = ["binaries"]
}
group "validate" {
targets = ["vendor-validate"]
}
target "vendor-validate" {
target = "vendor-validate"
output = ["type=cacheonly"]
}
target "vendor" {
target = "vendor-update"
output = ["."]
}
target "test" {
inherits = ["_common"]
target = "test-coverage"