Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

golangci-lint: remove Dockerfile.golangci-lint and update renovate config #2044

Merged
merged 3 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 11 additions & 12 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -427,20 +427,19 @@
},
{
"customType": "regex",
// explicitely not writing ^Makefile$ to match files with Makefile.extension
"fileMatch": [
"^Makefile\\.cli$"
],
"matchStrings": [
"# renovate: datasource=(?<datasource>.*?)\\s+GO_IMAGE[[:blank:]]*=[[:blank:]]*(?<depName>.*?):(?<currentValue>[^\\s@]*)@?(?<currentDigest>sha256:[a-f0-9]+)?",
]
},
{
"customType": "regex",
"fileMatch": [
"^Makefile$"
],
"^Makefile"
],
// This regex is for upgrading docker image full reference in Makefiles, for examples:
//
// # renovate: datasource=docker
// GOLANGCILINT_IMAGE=docker.io/golangci/golangci-lint:v1.55.2@sha256:e699df940be1810b08ba6ec050bfc34cc1931027283b5a7f607fb6a67b503876
//
// # renovate: datasource=docker
// GO_IMAGE = docker.io/library/golang:1.21.6-alpine@sha256:a6a7f1fcf12f5efa9e04b1e75020931a616cd707f14f62ab5262bfbe109aa84
"matchStrings": [
"# renovate: datasource=(?<datasource>.*?) depName=(?<depName>.*?)\\s+GOLANGCILINT_WANT_VERSION[[:blank:]]*=[[:blank:]]*(?<currentValue>[^\\s]*)"
"# renovate: datasource=(?<datasource>.*?)\\s+.+[[:blank:]]*=[[:blank:]]*(?<depName>.*?):(?<currentValue>[^\\s@]*)@?(?<currentDigest>sha256:[a-f0-9]+)?"
]
},
{
Expand Down
5 changes: 0 additions & 5 deletions Dockerfile.golangci-lint

This file was deleted.

14 changes: 6 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ E2E_TEST_TIMEOUT ?= 20m
BUILD_PKG_DIR ?= $(shell pwd)/build/$(TARGET_ARCH)
VERSION ?= $(shell git describe --tags --always)

# renovate: datasource=docker depName=docker.io/golangci/golangci-lint
GOLANGCILINT_WANT_VERSION = v1.55.2
GOLANGCILINT_VERSION = $(shell golangci-lint version 2>/dev/null)

# Do a parallel build with multiple jobs, based on the number of CPUs online
# in this system: 'make -j8' on a 8-CPU system, etc.
#
Expand Down Expand Up @@ -352,21 +348,23 @@ codegen: image-codegen
protoc-gen-go-tetragon:
$(GO_BUILD) -o bin/$@ ./cmd/protoc-gen-go-tetragon/

# renovate: datasource=docker
GOLANGCILINT_IMAGE=docker.io/golangci/golangci-lint:v1.55.2@sha256:e699df940be1810b08ba6ec050bfc34cc1931027283b5a7f607fb6a67b503876
GOLANGCILINT_WANT_VERSION := $(subst @sha256,,$(patsubst v%,%,$(word 2,$(subst :, ,$(lastword $(subst /, ,$(GOLANGCILINT_IMAGE)))))))
GOLANGCILINT_VERSION = $(shell golangci-lint version 2>/dev/null)
.PHONY: check
ifneq (,$(findstring $(GOLANGCILINT_WANT_VERSION),$(GOLANGCILINT_VERSION)))
check:
golangci-lint run
else
check:
$(CONTAINER_ENGINE) build -t golangci-lint:tetragon . -f Dockerfile.golangci-lint
$(CONTAINER_ENGINE) run --rm -v `pwd`:/app:Z -w /app golangci-lint:tetragon golangci-lint run
$(CONTAINER_ENGINE) run --rm -v `pwd`:/app:Z -w /app --env GOTOOLCHAIN=auto $(GOLANGCILINT_IMAGE) golangci-lint run
endif

.PHONY: copy-golangci-lint
copy-golangci-lint:
mkdir -p bin/
$(CONTAINER_ENGINE) build -t golangci-lint:tetragon . -f Dockerfile.golangci-lint
$(eval xid=$(shell docker create golangci-lint:tetragon))
$(eval xid=$(shell $(CONTAINER_ENGINE) create $(GOLANGCILINT_IMAGE)))
echo ${xid}
docker cp ${xid}:/usr/bin/golangci-lint bin/golangci-lint
docker rm ${xid}
Expand Down
Loading