forked from distribution/distribution
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request distribution#3644 from crazy-max/cleanup-ci
ci: cleanup ci workflow
- Loading branch information
Showing
10 changed files
with
118 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# syntax=docker/dockerfile:1 | ||
|
||
ARG GO_VERSION=1.18 | ||
ARG ALPINE_VERSION=3.16 | ||
|
||
FROM alpine:${ALPINE_VERSION} AS base | ||
RUN apk add --no-cache git gpg | ||
|
||
FROM golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS gitvalidation | ||
ARG GIT_VALIDATION_VERSION=v1.1.0 | ||
RUN --mount=type=cache,target=/root/.cache \ | ||
--mount=type=cache,target=/go/pkg/mod \ | ||
GOBIN=/out go install "github.com/vbatts/git-validation@${GIT_VALIDATION_VERSION}" | ||
|
||
FROM base AS validate | ||
ARG COMMIT_RANGE | ||
RUN if [ -z "$COMMIT_RANGE" ]; then echo "COMMIT_RANGE required" && exit 1; fi | ||
ENV GIT_CHECK_EXCLUDE="./vendor" | ||
WORKDIR /src | ||
RUN --mount=type=bind,target=. \ | ||
--mount=type=cache,target=/root/.cache \ | ||
--mount=from=gitvalidation,source=/out/git-validation,target=/usr/bin/git-validation \ | ||
git-validation -q -range "${COMMIT_RANGE}" -run short-subject,dangling-whitespace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,18 @@ | ||
# syntax=docker/dockerfile:1 | ||
|
||
ARG GO_VERSION=1.18 | ||
ARG ALPINE_VERSION=3.16 | ||
ARG GOLANGCI_LINT_VERSION=v1.45 | ||
|
||
FROM golangci/golangci-lint:${GOLANGCI_LINT_VERSION}-alpine AS golangci-lint | ||
|
||
FROM golang:${GO_VERSION}-alpine AS base | ||
FROM golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS base | ||
RUN apk add --no-cache gcc musl-dev | ||
WORKDIR /src | ||
|
||
FROM base | ||
ENV GOFLAGS="-buildvcs=false" | ||
RUN --mount=type=bind,target=. \ | ||
--mount=type=cache,target=/root/.cache \ | ||
--mount=from=golangci-lint,source=/usr/bin/golangci-lint,target=/usr/bin/golangci-lint \ | ||
golangci-lint run | ||
--mount=type=cache,target=/root/.cache \ | ||
--mount=from=golangci-lint,source=/usr/bin/golangci-lint,target=/usr/bin/golangci-lint \ | ||
golangci-lint run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,47 @@ | ||
# syntax=docker/dockerfile:1 | ||
|
||
ARG GO_VERSION=1.18 | ||
ARG ALPINE_VERSION=3.16 | ||
ARG MODOUTDATED_VERSION=v0.8.0 | ||
|
||
FROM golang:${GO_VERSION}-alpine AS base | ||
FROM golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS base | ||
RUN apk add --no-cache git rsync | ||
WORKDIR /src | ||
|
||
FROM base 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 | ||
--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 update | ||
COPY --from=vendored /out /out | ||
|
||
FROM vendored AS validate | ||
RUN --mount=target=/context \ | ||
--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 | ||
--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 | ||
|
||
FROM psampaz/go-mod-outdated:${MODOUTDATED_VERSION} AS go-mod-outdated | ||
FROM base AS outdated | ||
ARG _RANDOM | ||
RUN --mount=target=.,ro \ | ||
--mount=target=/go/pkg/mod,type=cache \ | ||
--mount=from=go-mod-outdated,source=/home/go-mod-outdated,target=/usr/bin/go-mod-outdated \ | ||
go list -mod=readonly -u -m -json all | go-mod-outdated -update -direct | ||
--mount=target=/go/pkg/mod,type=cache \ | ||
--mount=from=go-mod-outdated,source=/home/go-mod-outdated,target=/usr/bin/go-mod-outdated \ | ||
go list -mod=readonly -u -m -json all | go-mod-outdated -update -direct |
This file was deleted.
Oops, something went wrong.