Skip to content

Commit 2120573

Browse files
authored
Update common Prometheus files (#915)
Signed-off-by: prombot <prometheus-team@googlegroups.com>
1 parent 228386a commit 2120573

4 files changed

Lines changed: 30 additions & 82 deletions

File tree

.github/workflows/golangci-lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
with:
3131
persist-credentials: false
3232
- name: Install Go
33-
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
33+
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
3434
with:
3535
go-version: 1.26.x
3636
- name: Install snmp_exporter/generator dependencies

.github/workflows/govulncheck.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
name: govulncheck
3+
on:
4+
pull_request:
5+
paths:
6+
- VERSION
7+
- .github/workflows/govulncheck.yml
8+
push:
9+
branches:
10+
- main
11+
- master
12+
schedule:
13+
- cron: '33 2 * * *'
14+
15+
permissions:
16+
contents: read
17+
18+
jobs:
19+
govulncheck:
20+
runs-on: ubuntu-latest
21+
name: Run govulncheck
22+
steps:
23+
- id: govulncheck
24+
uses: golang/govulncheck-action@b625fbe08f3bccbe446d94fbf87fcc875a4f50ee # v1.0.4
25+
env:
26+
GOOS: ${{ contains(github.repository, 'windows_exporter') && 'windows' || '' }}

Makefile.common

Lines changed: 2 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ 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 ?= v2.10.1
64+
GOLANGCI_LINT_VERSION ?= v2.11.4
6565
GOLANGCI_FMT_OPTS ?=
6666
# golangci-lint only supports linux, darwin and windows platforms on i386/amd64/arm64.
6767
# windows isn't included here because of the path separator being different.
@@ -90,9 +90,7 @@ ifdef DOCKERFILE_PATH
9090
$(error DOCKERFILE_PATH is deprecated. Use DOCKERFILE_VARIANTS ?= $(DOCKERFILE_PATH) in the Makefile)
9191
endif
9292

93-
DOCKER_ARCHS ?= amd64 armv7 arm64 ppc64le riscv64 s390x
94-
DOCKERFILE_ARCH_EXCLUSIONS ?=
95-
DOCKER_REGISTRY_ARCH_EXCLUSIONS ?= quay.io:riscv64
93+
DOCKER_ARCHS ?= amd64 arm64 armv7 ppc64le riscv64 s390x
9694
DOCKERFILE_VARIANTS ?= $(wildcard Dockerfile Dockerfile.*)
9795

9896
# Function to extract variant from Dockerfile label.
@@ -111,24 +109,6 @@ endif
111109
# Build variant:dockerfile pairs for shell iteration.
112110
DOCKERFILE_VARIANTS_WITH_NAMES := $(foreach df,$(DOCKERFILE_VARIANTS),$(call dockerfile_variant,$(df)):$(df))
113111

114-
# Shell helper to check whether a dockerfile/arch pair is excluded.
115-
define dockerfile_arch_is_excluded
116-
case " $(DOCKERFILE_ARCH_EXCLUSIONS) " in \
117-
*" $$dockerfile:$(1) "*) true ;; \
118-
*) false ;; \
119-
esac
120-
endef
121-
122-
# Shell helper to check whether a registry/arch pair is excluded.
123-
# Extracts registry from DOCKER_REPO (e.g., quay.io/prometheus -> quay.io)
124-
define registry_arch_is_excluded
125-
registry=$$(echo "$(DOCKER_REPO)" | cut -d'/' -f1); \
126-
case " $(DOCKER_REGISTRY_ARCH_EXCLUSIONS) " in \
127-
*" $$registry:$(1) "*) true ;; \
128-
*) false ;; \
129-
esac
130-
endef
131-
132112
BUILD_DOCKER_ARCHS = $(addprefix common-docker-,$(DOCKER_ARCHS))
133113
PUBLISH_DOCKER_ARCHS = $(addprefix common-docker-publish-,$(DOCKER_ARCHS))
134114
TAG_DOCKER_ARCHS = $(addprefix common-docker-tag-latest-,$(DOCKER_ARCHS))
@@ -270,10 +250,6 @@ $(BUILD_DOCKER_ARCHS): common-docker-%:
270250
@for variant in $(DOCKERFILE_VARIANTS_WITH_NAMES); do \
271251
dockerfile=$${variant#*:}; \
272252
variant_name=$${variant%%:*}; \
273-
if $(call dockerfile_arch_is_excluded,$*); then \
274-
echo "Skipping $$variant_name variant for linux-$* (excluded by DOCKERFILE_ARCH_EXCLUSIONS)"; \
275-
continue; \
276-
fi; \
277253
distroless_arch="$*"; \
278254
if [ "$*" = "armv7" ]; then \
279255
distroless_arch="arm"; \
@@ -308,14 +284,6 @@ $(PUBLISH_DOCKER_ARCHS): common-docker-publish-%:
308284
@for variant in $(DOCKERFILE_VARIANTS_WITH_NAMES); do \
309285
dockerfile=$${variant#*:}; \
310286
variant_name=$${variant%%:*}; \
311-
if $(call dockerfile_arch_is_excluded,$*); then \
312-
echo "Skipping push for $$variant_name variant on linux-$* (excluded by DOCKERFILE_ARCH_EXCLUSIONS)"; \
313-
continue; \
314-
fi; \
315-
if $(call registry_arch_is_excluded,$*); then \
316-
echo "Skipping push for $$variant_name variant on linux-$* to $(DOCKER_REPO) (excluded by DOCKER_REGISTRY_ARCH_EXCLUSIONS)"; \
317-
continue; \
318-
fi; \
319287
if [ "$$dockerfile" != "Dockerfile" ] || [ "$$variant_name" != "default" ]; then \
320288
echo "Pushing $$variant_name variant for linux-$*"; \
321289
docker push "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(SANITIZED_DOCKER_IMAGE_TAG)-$$variant_name"; \
@@ -343,14 +311,6 @@ $(TAG_DOCKER_ARCHS): common-docker-tag-latest-%:
343311
@for variant in $(DOCKERFILE_VARIANTS_WITH_NAMES); do \
344312
dockerfile=$${variant#*:}; \
345313
variant_name=$${variant%%:*}; \
346-
if $(call dockerfile_arch_is_excluded,$*); then \
347-
echo "Skipping tag for $$variant_name variant on linux-$* (excluded by DOCKERFILE_ARCH_EXCLUSIONS)"; \
348-
continue; \
349-
fi; \
350-
if $(call registry_arch_is_excluded,$*); then \
351-
echo "Skipping tag for $$variant_name variant on linux-$* for $(DOCKER_REPO) (excluded by DOCKER_REGISTRY_ARCH_EXCLUSIONS)"; \
352-
continue; \
353-
fi; \
354314
if [ "$$dockerfile" != "Dockerfile" ] || [ "$$variant_name" != "default" ]; then \
355315
echo "Tagging $$variant_name variant for linux-$* as latest"; \
356316
docker tag "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(SANITIZED_DOCKER_IMAGE_TAG)-$$variant_name" "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:latest-$$variant_name"; \
@@ -372,14 +332,6 @@ common-docker-manifest:
372332
echo "Creating manifest for $$variant_name variant"; \
373333
refs=""; \
374334
for arch in $(DOCKER_ARCHS); do \
375-
if $(call dockerfile_arch_is_excluded,$$arch); then \
376-
echo " Skipping $$arch for $$variant_name (excluded by DOCKERFILE_ARCH_EXCLUSIONS)"; \
377-
continue; \
378-
fi; \
379-
if $(call registry_arch_is_excluded,$$arch); then \
380-
echo " Skipping $$arch for $$variant_name on $(DOCKER_REPO) (excluded by DOCKER_REGISTRY_ARCH_EXCLUSIONS)"; \
381-
continue; \
382-
fi; \
383335
refs="$$refs $(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$$arch:$(SANITIZED_DOCKER_IMAGE_TAG)-$$variant_name"; \
384336
done; \
385337
if [ -z "$$refs" ]; then \
@@ -393,14 +345,6 @@ common-docker-manifest:
393345
echo "Creating default variant ($$variant_name) manifest"; \
394346
refs=""; \
395347
for arch in $(DOCKER_ARCHS); do \
396-
if $(call dockerfile_arch_is_excluded,$$arch); then \
397-
echo " Skipping $$arch for default variant (excluded by DOCKERFILE_ARCH_EXCLUSIONS)"; \
398-
continue; \
399-
fi; \
400-
if $(call registry_arch_is_excluded,$$arch); then \
401-
echo " Skipping $$arch for default variant on $(DOCKER_REPO) (excluded by DOCKER_REGISTRY_ARCH_EXCLUSIONS)"; \
402-
continue; \
403-
fi; \
404348
refs="$$refs $(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$$arch:$(SANITIZED_DOCKER_IMAGE_TAG)"; \
405349
done; \
406350
if [ -z "$$refs" ]; then \
@@ -415,14 +359,6 @@ common-docker-manifest:
415359
echo "Creating manifest for $$variant_name variant version tag"; \
416360
refs=""; \
417361
for arch in $(DOCKER_ARCHS); do \
418-
if $(call dockerfile_arch_is_excluded,$$arch); then \
419-
echo " Skipping $$arch for $$variant_name version tag (excluded by DOCKERFILE_ARCH_EXCLUSIONS)"; \
420-
continue; \
421-
fi; \
422-
if $(call registry_arch_is_excluded,$$arch); then \
423-
echo " Skipping $$arch for $$variant_name version tag on $(DOCKER_REPO) (excluded by DOCKER_REGISTRY_ARCH_EXCLUSIONS)"; \
424-
continue; \
425-
fi; \
426362
refs="$$refs $(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$$arch:v$(DOCKER_MAJOR_VERSION_TAG)-$$variant_name"; \
427363
done; \
428364
if [ -z "$$refs" ]; then \
@@ -436,14 +372,6 @@ common-docker-manifest:
436372
echo "Creating default variant version tag manifest"; \
437373
refs=""; \
438374
for arch in $(DOCKER_ARCHS); do \
439-
if $(call dockerfile_arch_is_excluded,$$arch); then \
440-
echo " Skipping $$arch for default variant version tag (excluded by DOCKERFILE_ARCH_EXCLUSIONS)"; \
441-
continue; \
442-
fi; \
443-
if $(call registry_arch_is_excluded,$$arch); then \
444-
echo " Skipping $$arch for default variant version tag on $(DOCKER_REPO) (excluded by DOCKER_REGISTRY_ARCH_EXCLUSIONS)"; \
445-
continue; \
446-
fi; \
447375
refs="$$refs $(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$$arch:v$(DOCKER_MAJOR_VERSION_TAG)"; \
448376
done; \
449377
if [ -z "$$refs" ]; then \
@@ -497,9 +425,3 @@ $(1)_precheck:
497425
exit 1; \
498426
fi
499427
endef
500-
501-
govulncheck: install-govulncheck
502-
govulncheck ./...
503-
504-
install-govulncheck:
505-
command -v govulncheck > /dev/null || go install golang.org/x/vuln/cmd/govulncheck@latest

SECURITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
The Prometheus security policy, including how to report vulnerabilities, can be
44
found here:
55

6-
<https://prometheus.io/docs/operating/security/>
6+
[https://prometheus.io/docs/operating/security/](https://prometheus.io/docs/operating/security/)

0 commit comments

Comments
 (0)