Skip to content

Commit 8b4bb64

Browse files
author
Steven Swartz
committed
Merge branch 'main' into NewConstHistogramWithCreatedTimestamp
2 parents 4c3d4ac + 34e02e2 commit 8b4bb64

32 files changed

+1572
-274
lines changed

.github/labeler.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Config file for pr-auto-label workflow
2+
3+
# enable auto-labeler on issues, prs, or both.
4+
enable:
5+
prs: true
6+
7+
# Labels is an object where:
8+
# - keys are labels
9+
# - values are objects of { include: [ pattern ], exclude: [ pattern ] }
10+
# - pattern must be a valid regex, and is applied globally to
11+
# title + description of issues and/or prs (see enabled config above)
12+
# - 'include' patterns will associate a label if any of these patterns match
13+
# - 'exclude' patterns will ignore this label if any of these patterns match
14+
labels:
15+
'kind/BUGFIX':
16+
include:
17+
- '/kind (fix|bugfix)'
18+
exclude: []
19+
'kind/ENHANCEMENT':
20+
include:
21+
- '/kind enhancement'
22+
exclude: []
23+
'kind/FEATURE':
24+
include:
25+
- '/kind (feat|feature)'
26+
exclude: []
27+
'kind/CHANGE':
28+
include:
29+
- '/kind change'
30+
exclude: []
31+
'release-note-none':
32+
include:
33+
- '/kind (none|NONE|release-note-none|release-notes-none)'
34+
exclude: []

.github/pull-request-template.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!-- Refer to CONTRIBUTING.md for more details and examples.
2+
https://github.com/prometheus/client_golang/blob/main/CONTRIBUTING.md#how-to-write-a-pr-description
3+
-->
4+
### Describe your PR
5+
6+
7+
### What type of PR is this?
8+
9+
<!-- Format: /kind followed by ONE of the type {fix, bugfix, enhancement, feature, feat, change, release-note-none} -->
10+
11+
12+
### Changelog Entry
13+
```release-note
14+
15+
```
16+
<!-- Briefly describe any USER-FACING changes introduced in your PR. If your change should not appear in the changelog, write NONE. -->

.github/workflows/automerge-dependabot.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
name: Dependabot auto-merge
22
on: pull_request
33

4+
concurrency:
5+
group: ${{ github.workflow }}-${{ (github.event.pull_request && github.event.pull_request.number) || github.ref || github.run_id }}
6+
cancel-in-progress: true
7+
48
permissions:
59
contents: write
610
pull-requests: write
@@ -12,7 +16,7 @@ jobs:
1216
steps:
1317
- name: Dependabot metadata
1418
id: metadata
15-
uses: dependabot/fetch-metadata@c9c4182bf1b97f5224aee3906fd373f6b61b4526 # v1.6.0
19+
uses: dependabot/fetch-metadata@5e5f99653a5b510e8555840e80cbf1514ad4af38 # v2.1.0
1620
with:
1721
github-token: "${{ secrets.GITHUB_TOKEN }}"
1822
- name: Enable auto-merge for Dependabot PRs

.github/workflows/codeql-analysis.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ on:
2020
schedule:
2121
- cron: '31 21 * * 6'
2222

23+
concurrency:
24+
group: ${{ github.workflow }}-${{ (github.event.pull_request && github.event.pull_request.number) || github.ref || github.run_id }}
25+
cancel-in-progress: true
26+
2327
# Minimal permissions to be inherited by any job that don't declare it's own permissions
2428
permissions:
2529
contents: read
@@ -46,7 +50,7 @@ jobs:
4650

4751
# Initializes the CodeQL tools for scanning.
4852
- name: Initialize CodeQL
49-
uses: github/codeql-action/init@8a470fddafa5cbb6266ee11b37ef4d8aae19c571 # v3.24.6
53+
uses: github/codeql-action/init@d39d31e687223d841ef683f52467bd88e9b21c14 # v3.25.3
5054
with:
5155
languages: ${{ matrix.language }}
5256
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -57,7 +61,7 @@ jobs:
5761
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
5862
# If this step fails, then you should remove it and run the build manually (see below)
5963
- name: Autobuild
60-
uses: github/codeql-action/autobuild@8a470fddafa5cbb6266ee11b37ef4d8aae19c571 # v3.24.6
64+
uses: github/codeql-action/autobuild@d39d31e687223d841ef683f52467bd88e9b21c14 # v3.25.3
6165

6266
# ℹ️ Command-line programs to run using the OS shell.
6367
# 📚 https://git.io/JvXDl
@@ -71,4 +75,4 @@ jobs:
7175
# make release
7276

7377
- name: Perform CodeQL Analysis
74-
uses: github/codeql-action/analyze@8a470fddafa5cbb6266ee11b37ef4d8aae19c571 # v3.24.6
78+
uses: github/codeql-action/analyze@d39d31e687223d841ef683f52467bd88e9b21c14 # v3.25.3
Lines changed: 57 additions & 0 deletions
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@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
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@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
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/go.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ on:
77
- main
88
- "release-*"
99

10+
concurrency:
11+
group: ${{ github.workflow }}-${{ (github.event.pull_request && github.event.pull_request.number) || github.ref || github.run_id }}
12+
cancel-in-progress: true
13+
1014
# Minimal permissions to be inherited by any job that don't declare it's own permissions
1115
permissions:
1216
contents: read

.github/workflows/golangci-lint.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,16 @@ jobs:
2424
runs-on: ubuntu-latest
2525
steps:
2626
- name: Checkout repository
27-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
28-
- name: install Go
29-
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
27+
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
28+
- name: Install Go
29+
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
3030
with:
31-
go-version: 1.20.x
31+
go-version: 1.22.x
3232
- name: Install snmp_exporter/generator dependencies
3333
run: sudo apt-get update && sudo apt-get -y install libsnmp-dev
3434
if: github.repository == 'prometheus/snmp_exporter'
3535
- name: Lint
36-
uses: golangci/golangci-lint-action@3cfe3a4abbb849e10058ce4af15d205b6da42804 # v4.0.0
36+
uses: golangci/golangci-lint-action@a4f60bb28d35aeee14e6880718e0c85ff1882e64 # v6.0.1
3737
with:
38-
version: v1.54.2
38+
args: --verbose
39+
version: v1.59.1

.github/workflows/pr-auto-label.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
name: Changelog automation
3+
4+
on:
5+
pull_request_target:
6+
types: [opened, edited]
7+
8+
permissions:
9+
contents: read # the config file
10+
pull-requests: write # for labeling pull requests (on: pull_request_target or on: pull_request)
11+
statuses: write # to generate status
12+
checks: write # to generate status
13+
14+
jobs:
15+
changelog-automation:
16+
name: Changelog automation
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Remove old PR labels
20+
uses: mondeja/[email protected]
21+
with:
22+
token: ${{ secrets.GITHUB_TOKEN }}
23+
labels: |
24+
kind/BUGFIX
25+
kind/ENHANCEMENT
26+
kind/FEATURE
27+
kind/CHANGE
28+
release-note-none
29+
- name: Add label to PR
30+
id: labeler
31+
uses: jimschubert/labeler-action@v1
32+
with:
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
# Adjust the configuration in /.github/labeler.yml
35+
36+
- name: Verify Label
37+
id: preview_label_check
38+
uses: docker://agilepathway/pull-request-label-checker:latest
39+
with:
40+
any_of: kind/BUGFIX,kind/ENHANCEMENT,kind/FEATURE,kind/CHANGE,release-note-none
41+
repo_token: ${{ secrets.GITHUB_TOKEN }}
42+
allow_failure: true
43+
- name: Comment on Label Check Failure
44+
uses: thollander/[email protected]
45+
if: steps.preview_label_check.outputs.label_check == 'failure'
46+
with:
47+
message: |
48+
PR body does not contain a valid type of change. Please refer to [CONTRIBUTING.md](https://github.com/prometheus/client_golang/blob/main/CONTRIBUTING.md#how-to-write-a-pr-description) for more information.
49+
comment_tag: labelfailure
50+
mode: recreate
51+
- name: Remove Label Check Failure Comment
52+
uses: thollander/[email protected]
53+
if: steps.preview_label_check.outputs.label_check == 'success'
54+
with:
55+
message: |
56+
PR body contains a valid type of change.
57+
comment_tag: labelfailure
58+
mode: delete
59+
create_if_not_exists: false
60+
- name: Exit on Failure
61+
if: steps.preview_label_check.outputs.label_check == 'failure'
62+
run: exit 1

.golangci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
run:
3-
deadline: 5m
3+
timeout: 5m
44
skip-files:
55
# Skip autogenerated files.
66
- ^.*\.(pb|y)\.go$

CONTRIBUTING.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Contributing
22

3+
Thank you for contributing to our project! Here are the steps and guidelines to follow when creating a pull request (PR).
4+
35
Prometheus uses GitHub to manage reviews of pull requests.
46

57
* If you have a trivial fix or improvement, go ahead and create a pull request,
@@ -18,3 +20,55 @@ Prometheus uses GitHub to manage reviews of pull requests.
1820
Environments](http://peter.bourgon.org/go-in-production/#formatting-and-style).
1921

2022
* Be sure to sign off on the [DCO](https://github.com/probot/dco#how-it-works)
23+
24+
## How to write a PR description
25+
26+
### Describe your PR
27+
28+
In this section, provide a clear and concise description of what your PR does. This helps reviewers understand the purpose and context of your changes.
29+
30+
### What type of PR is this?
31+
32+
Indicate the type of PR by adding one of the following options:
33+
34+
- `/kind fix`
35+
- `/kind bugfix`
36+
- `/kind enhancement`
37+
- `/kind feature`
38+
- `/kind feat`
39+
- `/kind change`
40+
- `/kind release-note-none`
41+
42+
If this change should not appear in the changelog, use `/kind release-note-none`.
43+
44+
Example 1:
45+
```
46+
### What type of PR is this?
47+
/kind feature
48+
```
49+
50+
Example 2:
51+
```
52+
### What type of PR is this?
53+
/kind release-note-none
54+
```
55+
56+
### Changelog Entry
57+
58+
Include a brief summary of your change for the changelog. This helps users understand what has been modified, added, or fixed in the project. If your change should not appear in the changelog, write `NONE`. Make sure to add only user-facing changes.
59+
60+
Example 1:
61+
```
62+
### Changelog Entry
63+
```release-note
64+
api: Switch to POST for `LabelNames`.
65+
```
66+
```
67+
68+
Example 2:
69+
```
70+
### Changelog Entry
71+
```release-note
72+
NONE
73+
```
74+
```

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.59.1
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)