Skip to content

Commit 18b5134

Browse files
authored
Update common Prometheus files (#1514)
Signed-off-by: prombot <[email protected]>
1 parent 542f7e6 commit 18b5134

File tree

3 files changed

+72
-16
lines changed

3 files changed

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

.github/workflows/golangci-lint.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ on:
1212
- ".golangci.yml"
1313
pull_request:
1414

15-
concurrency:
16-
group: ${{ github.workflow }}-${{ (github.event.pull_request && github.event.pull_request.number) || github.ref || github.run_id }}
17-
cancel-in-progress: true
18-
1915
permissions: # added using https://github.com/step-security/secure-repo
2016
contents: read
2117

@@ -28,15 +24,15 @@ jobs:
2824
runs-on: ubuntu-latest
2925
steps:
3026
- name: Checkout repository
31-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
27+
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
3228
- name: install Go
3329
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
3430
with:
35-
go-version: 1.20.x
31+
go-version: 1.22.x
3632
- name: Install snmp_exporter/generator dependencies
3733
run: sudo apt-get update && sudo apt-get -y install libsnmp-dev
3834
if: github.repository == 'prometheus/snmp_exporter'
3935
- name: Lint
4036
uses: golangci/golangci-lint-action@9d1e0624a798bb64f6c3cea93db47765312263dc # v5.1.0
4137
with:
42-
version: v1.54.2
38+
version: v1.56.2

Makefile.common

Lines changed: 17 additions & 9 deletions
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.54.2
65-
# golangci-lint only supports linux, darwin and windows platforms on i386/amd64.
64+
GOLANGCI_LINT_VERSION ?= v1.56.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-%:

0 commit comments

Comments
 (0)