mod-outdated target to check for outdated dependencies

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax 2022-04-22 16:24:46 +02:00
parent ffa3019c1f
commit c052659543
No known key found for this signature in database
GPG key ID: 3248E46B6BB8C7F7
3 changed files with 24 additions and 1 deletions

View file

@ -38,7 +38,7 @@ BINARIES=$(addprefix bin/,$(COMMANDS))
TESTFLAGS ?= -v $(TESTFLAGS_RACE) TESTFLAGS ?= -v $(TESTFLAGS_RACE)
TESTFLAGS_PARALLEL ?= 8 TESTFLAGS_PARALLEL ?= 8
.PHONY: all build binaries check clean test test-race test-full integration coverage validate-vendor vendor .PHONY: all build binaries check clean test test-race test-full integration coverage validate-vendor vendor mod-outdated
.DEFAULT: all .DEFAULT: all
all: binaries all: binaries
@ -110,3 +110,6 @@ vendor: ## update vendor
rm -rf ./vendor rm -rf ./vendor
cp -R "$($@_TMP_OUT)"/out/* . cp -R "$($@_TMP_OUT)"/out/* .
rm -rf $($@_TMP_OUT)/* rm -rf $($@_TMP_OUT)/*
mod-outdated: ## check outdated dependencies
docker buildx bake mod-outdated

View file

@ -35,6 +35,17 @@ target "update-vendor" {
output = ["."] output = ["."]
} }
target "mod-outdated" {
dockerfile = "./dockerfiles/vendor.Dockerfile"
target = "outdated"
args = {
// used to invalidate cache for outdated run stage
// can be dropped when https://github.com/moby/buildkit/issues/1213 fixed
_RANDOM = uuidv4()
}
output = ["type=cacheonly"]
}
target "binary" { target "binary" {
inherits = ["_common"] inherits = ["_common"]
target = "binary" target = "binary"

View file

@ -1,6 +1,7 @@
# syntax=docker/dockerfile:1 # syntax=docker/dockerfile:1
ARG GO_VERSION=1.17 ARG GO_VERSION=1.17
ARG MODOUTDATED_VERSION=v0.8.0
FROM golang:${GO_VERSION}-alpine AS base FROM golang:${GO_VERSION}-alpine AS base
RUN apk add --no-cache git rsync RUN apk add --no-cache git rsync
@ -35,3 +36,11 @@ if [ -n "$(git status --porcelain -- go.mod go.sum vendor)" ]; then
exit 1 exit 1
fi fi
EOT 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