Skip to content

Commit 3743987

Browse files
authored
Update common Prometheus files (#1076)
Signed-off-by: prombot <[email protected]>
1 parent 3be4edc commit 3743987

File tree

4 files changed

+95
-15
lines changed

4 files changed

+95
-15
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
name: Push README to Docker Hub
3+
on:
4+
push:
5+
paths:
6+
- "README.md"
7+
- "README-containers.md"
8+
- ".github/workflows/container_description.yml"
9+
branches: [ main, master ]
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
PushDockerHubReadme:
16+
runs-on: ubuntu-latest
17+
name: Push README to Docker Hub
18+
if: github.repository_owner == 'prometheus' || github.repository_owner == 'prometheus-community' # Don't run this workflow on forks.
19+
steps:
20+
- name: git checkout
21+
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
22+
- name: Set docker hub repo name
23+
run: echo "DOCKER_REPO_NAME=$(make docker-repo-name)" >> $GITHUB_ENV
24+
- name: Push README to Dockerhub
25+
uses: christian-korneck/update-container-description-action@d36005551adeaba9698d8d67a296bd16fa91f8e8 # v1
26+
env:
27+
DOCKER_USER: ${{ secrets.DOCKER_HUB_LOGIN }}
28+
DOCKER_PASS: ${{ secrets.DOCKER_HUB_PASSWORD }}
29+
with:
30+
destination_container_repo: ${{ env.DOCKER_REPO_NAME }}
31+
provider: dockerhub
32+
short_description: ${{ env.DOCKER_REPO_NAME }}
33+
# Empty string results in README-containers.md being pushed if it
34+
# exists. Otherwise, README.md is pushed.
35+
readme_file: ''
36+
37+
PushQuayIoReadme:
38+
runs-on: ubuntu-latest
39+
name: Push README to quay.io
40+
if: github.repository_owner == 'prometheus' || github.repository_owner == 'prometheus-community' # Don't run this workflow on forks.
41+
steps:
42+
- name: git checkout
43+
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
44+
- name: Set quay.io org name
45+
run: echo "DOCKER_REPO=$(echo quay.io/${GITHUB_REPOSITORY_OWNER} | tr -d '-')" >> $GITHUB_ENV
46+
- name: Set quay.io repo name
47+
run: echo "DOCKER_REPO_NAME=$(make docker-repo-name)" >> $GITHUB_ENV
48+
- name: Push README to quay.io
49+
uses: christian-korneck/update-container-description-action@d36005551adeaba9698d8d67a296bd16fa91f8e8 # v1
50+
env:
51+
DOCKER_APIKEY: ${{ secrets.QUAY_IO_API_TOKEN }}
52+
with:
53+
destination_container_repo: ${{ env.DOCKER_REPO_NAME }}
54+
provider: quay
55+
# Empty string results in README-containers.md being pushed if it
56+
# exists. Otherwise, README.md is pushed.
57+
readme_file: ''

.github/workflows/golangci-lint.yml

+13-6
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,28 @@ on:
1212
- ".golangci.yml"
1313
pull_request:
1414

15+
permissions: # added using https://github.com/step-security/secure-repo
16+
contents: read
17+
1518
jobs:
1619
golangci:
20+
permissions:
21+
contents: read # for actions/checkout to fetch code
22+
pull-requests: read # for golangci/golangci-lint-action to fetch pull requests
1723
name: lint
1824
runs-on: ubuntu-latest
1925
steps:
2026
- name: Checkout repository
21-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
22-
- name: install Go
23-
uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0
27+
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
28+
- name: Install Go
29+
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
2430
with:
25-
go-version: 1.21.x
31+
go-version: 1.23.x
2632
- name: Install snmp_exporter/generator dependencies
2733
run: sudo apt-get update && sudo apt-get -y install libsnmp-dev
2834
if: github.repository == 'prometheus/snmp_exporter'
2935
- name: Lint
30-
uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc # v3.7.0
36+
uses: golangci/golangci-lint-action@aaa42aa0628b4ae2578232a66b541047968fac86 # v6.1.0
3137
with:
32-
version: v1.54.2
38+
args: --verbose
39+
version: v1.60.2

.yamllint

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
---
22
extends: default
3+
ignore: |
4+
ui/react-app/node_modules
35

46
rules:
57
braces:

Makefile.common

+23-9
Original file line numberDiff line numberDiff line change
@@ -49,23 +49,23 @@ endif
4949
GOTEST := $(GO) test
5050
GOTEST_DIR :=
5151
ifneq ($(CIRCLE_JOB),)
52-
ifneq ($(shell command -v gotestsum > /dev/null),)
52+
ifneq ($(shell command -v gotestsum 2> /dev/null),)
5353
GOTEST_DIR := test-results
5454
GOTEST := gotestsum --junitfile $(GOTEST_DIR)/unit-tests.xml --
5555
endif
5656
endif
5757

58-
PROMU_VERSION ?= 0.15.0
58+
PROMU_VERSION ?= 0.17.0
5959
PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_VERSION)/promu-$(PROMU_VERSION).$(GO_BUILD_PLATFORM).tar.gz
6060

6161
SKIP_GOLANGCI_LINT :=
6262
GOLANGCI_LINT :=
6363
GOLANGCI_LINT_OPTS ?=
64-
GOLANGCI_LINT_VERSION ?= v1.55.2
65-
# golangci-lint only supports linux, darwin and windows platforms on i386/amd64.
64+
GOLANGCI_LINT_VERSION ?= v1.60.2
65+
# golangci-lint only supports linux, darwin and windows platforms on i386/amd64/arm64.
6666
# windows isn't included here because of the path separator being different.
6767
ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux darwin))
68-
ifeq ($(GOHOSTARCH),$(filter $(GOHOSTARCH),amd64 i386))
68+
ifeq ($(GOHOSTARCH),$(filter $(GOHOSTARCH),amd64 i386 arm64))
6969
# If we're in CI and there is an Actions file, that means the linter
7070
# is being run in Actions, so we don't need to run it here.
7171
ifneq (,$(SKIP_GOLANGCI_LINT))
@@ -169,16 +169,20 @@ common-vet:
169169
common-lint: $(GOLANGCI_LINT)
170170
ifdef GOLANGCI_LINT
171171
@echo ">> running golangci-lint"
172-
# 'go list' needs to be executed before staticcheck to prepopulate the modules cache.
173-
# Otherwise staticcheck might fail randomly for some reason not yet explained.
174-
$(GO) list -e -compiled -test=true -export=false -deps=true -find=false -tags= -- ./... > /dev/null
175172
$(GOLANGCI_LINT) run $(GOLANGCI_LINT_OPTS) $(pkgs)
176173
endif
177174

175+
.PHONY: common-lint-fix
176+
common-lint-fix: $(GOLANGCI_LINT)
177+
ifdef GOLANGCI_LINT
178+
@echo ">> running golangci-lint fix"
179+
$(GOLANGCI_LINT) run --fix $(GOLANGCI_LINT_OPTS) $(pkgs)
180+
endif
181+
178182
.PHONY: common-yamllint
179183
common-yamllint:
180184
@echo ">> running yamllint on all YAML files in the repository"
181-
ifeq (, $(shell command -v yamllint > /dev/null))
185+
ifeq (, $(shell command -v yamllint 2> /dev/null))
182186
@echo "yamllint not installed so skipping"
183187
else
184188
yamllint .
@@ -204,6 +208,10 @@ common-tarball: promu
204208
@echo ">> building release tarball"
205209
$(PROMU) tarball --prefix $(PREFIX) $(BIN_DIR)
206210

211+
.PHONY: common-docker-repo-name
212+
common-docker-repo-name:
213+
@echo "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)"
214+
207215
.PHONY: common-docker $(BUILD_DOCKER_ARCHS)
208216
common-docker: $(BUILD_DOCKER_ARCHS)
209217
$(BUILD_DOCKER_ARCHS): common-docker-%:
@@ -267,3 +275,9 @@ $(1)_precheck:
267275
exit 1; \
268276
fi
269277
endef
278+
279+
govulncheck: install-govulncheck
280+
govulncheck ./...
281+
282+
install-govulncheck:
283+
command -v govulncheck > /dev/null || go install golang.org/x/vuln/cmd/govulncheck@latest

0 commit comments

Comments
 (0)