Skip to content

Commit 4537c89

Browse files
committed
Update common Prometheus files
Signed-off-by: prombot <[email protected]>
1 parent ac9d013 commit 4537c89

File tree

3 files changed

+27
-9
lines changed

3 files changed

+27
-9
lines changed

.github/workflows/container_description.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ jobs:
1919
steps:
2020
- name: git checkout
2121
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
22+
with:
23+
persist-credentials: false
2224
- name: Set docker hub repo name
2325
run: echo "DOCKER_REPO_NAME=$(make docker-repo-name)" >> $GITHUB_ENV
2426
- name: Push README to Dockerhub
@@ -41,6 +43,8 @@ jobs:
4143
steps:
4244
- name: git checkout
4345
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
46+
with:
47+
persist-credentials: false
4448
- name: Set quay.io org name
4549
run: echo "DOCKER_REPO=$(echo quay.io/${GITHUB_REPOSITORY_OWNER} | tr -d '-')" >> $GITHUB_ENV
4650
- name: Set quay.io repo name

.github/workflows/golangci-lint.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,20 @@ jobs:
2525
steps:
2626
- name: Checkout repository
2727
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
28+
with:
29+
persist-credentials: false
2830
- name: Install Go
29-
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
31+
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
3032
with:
31-
go-version: 1.24.x
33+
go-version: 1.25.x
3234
- name: Install snmp_exporter/generator dependencies
3335
run: sudo apt-get update && sudo apt-get -y install libsnmp-dev
3436
if: github.repository == 'prometheus/snmp_exporter'
37+
- name: Get golangci-lint version
38+
id: golangci-lint-version
39+
run: echo "version=$(make print-golangci-lint-version)" >> $GITHUB_OUTPUT
3540
- name: Lint
36-
uses: golangci/golangci-lint-action@55c2c1448f86e01eaae002a5a3a9624417608d84 # v6.5.2
41+
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0
3742
with:
3843
args: --verbose
39-
version: v1.64.6
44+
version: ${{ steps.golangci-lint-version.outputs.version }}

Makefile.common

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_
6161
SKIP_GOLANGCI_LINT :=
6262
GOLANGCI_LINT :=
6363
GOLANGCI_LINT_OPTS ?=
64-
GOLANGCI_LINT_VERSION ?= v1.64.6
64+
GOLANGCI_LINT_VERSION ?= v2.6.0
65+
GOLANGCI_FMT_OPTS ?=
6566
# golangci-lint only supports linux, darwin and windows platforms on i386/amd64/arm64.
6667
# windows isn't included here because of the path separator being different.
6768
ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux darwin))
@@ -138,7 +139,7 @@ common-deps:
138139
update-go-deps:
139140
@echo ">> updating Go dependencies"
140141
@for m in $$($(GO) list -mod=readonly -m -f '{{ if and (not .Indirect) (not .Main)}}{{.Path}}{{end}}' all); do \
141-
$(GO) get -d $$m; \
142+
$(GO) get $$m; \
142143
done
143144
$(GO) mod tidy
144145

@@ -156,9 +157,13 @@ $(GOTEST_DIR):
156157
@mkdir -p $@
157158

158159
.PHONY: common-format
159-
common-format:
160+
common-format: $(GOLANGCI_LINT)
160161
@echo ">> formatting code"
161162
$(GO) fmt $(pkgs)
163+
ifdef GOLANGCI_LINT
164+
@echo ">> formatting code with golangci-lint"
165+
$(GOLANGCI_LINT) fmt $(GOLANGCI_FMT_OPTS)
166+
endif
162167

163168
.PHONY: common-vet
164169
common-vet:
@@ -248,8 +253,8 @@ $(PROMU):
248253
cp $(PROMU_TMP)/promu-$(PROMU_VERSION).$(GO_BUILD_PLATFORM)/promu $(FIRST_GOPATH)/bin/promu
249254
rm -r $(PROMU_TMP)
250255

251-
.PHONY: proto
252-
proto:
256+
.PHONY: common-proto
257+
common-proto:
253258
@echo ">> generating code from proto files"
254259
@./scripts/genproto.sh
255260

@@ -261,6 +266,10 @@ $(GOLANGCI_LINT):
261266
| sh -s -- -b $(FIRST_GOPATH)/bin $(GOLANGCI_LINT_VERSION)
262267
endif
263268

269+
.PHONY: common-print-golangci-lint-version
270+
common-print-golangci-lint-version:
271+
@echo $(GOLANGCI_LINT_VERSION)
272+
264273
.PHONY: precheck
265274
precheck::
266275

0 commit comments

Comments
 (0)