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:
@@ -14,6 +14,25 @@ env:
|
|||||||
GO_VERSION: 1.16.7
|
GO_VERSION: 1.16.7
|
||||||
|
|
||||||
jobs:
|
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:
|
test:
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
|
|||||||
+30
-1
@@ -14,11 +14,40 @@ FROM crazymax/osxcross:${OSXCROSS_VERSION} AS osxcross
|
|||||||
|
|
||||||
FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-alpine AS gobase
|
FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-alpine AS gobase
|
||||||
COPY --from=xx / /
|
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 GOFLAGS="-mod=vendor"
|
||||||
ENV CGO_ENABLED="1"
|
ENV CGO_ENABLED="1"
|
||||||
WORKDIR /src
|
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
|
FROM gobase AS version
|
||||||
ARG PKG
|
ARG PKG
|
||||||
RUN --mount=target=. \
|
RUN --mount=target=. \
|
||||||
|
|||||||
@@ -83,3 +83,15 @@ deb:
|
|||||||
.
|
.
|
||||||
docker run --rm --net=none $(BUILDIMG) tar cf - /release | tar xf -
|
docker run --rm --net=none $(BUILDIMG) tar cf - /release | tar xf -
|
||||||
docker rmi $(BUILDIMG)
|
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
|
||||||
|
|||||||
@@ -21,6 +21,20 @@ group "default" {
|
|||||||
targets = ["binaries"]
|
targets = ["binaries"]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
group "validate" {
|
||||||
|
targets = ["vendor-validate"]
|
||||||
|
}
|
||||||
|
|
||||||
|
target "vendor-validate" {
|
||||||
|
target = "vendor-validate"
|
||||||
|
output = ["type=cacheonly"]
|
||||||
|
}
|
||||||
|
|
||||||
|
target "vendor" {
|
||||||
|
target = "vendor-update"
|
||||||
|
output = ["."]
|
||||||
|
}
|
||||||
|
|
||||||
target "test" {
|
target "test" {
|
||||||
inherits = ["_common"]
|
inherits = ["_common"]
|
||||||
target = "test-coverage"
|
target = "test-coverage"
|
||||||
|
|||||||
Reference in New Issue
Block a user