Skip to content

Commit fabd2cd

Browse files
authored
Merge pull request #65 from prometheus-community/superq/update_build
Update build
2 parents d609150 + bb56c5f commit fabd2cd

File tree

8 files changed

+96
-1029
lines changed

8 files changed

+96
-1029
lines changed

.circleci/config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ executors:
88
# Whenever the Go version is updated here, .promu.yml should also be updated.
99
golang:
1010
docker:
11-
- image: quay.io/prometheus/golang-builder:1.20-base
11+
- image: quay.io/prometheus/golang-builder:1.22-base
1212

1313
jobs:
1414
test:

.github/dependabot.yml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "gomod"
4+
directory: "/"
5+
schedule:
6+
interval: "monthly"

.github/workflows/golangci-lint.yml

+19-11
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
---
2+
# This action is synced from https://github.com/prometheus/prometheus
13
name: golangci-lint
24
on:
35
push:
@@ -9,23 +11,29 @@ on:
911
- ".github/workflows/golangci-lint.yml"
1012
- ".golangci.yml"
1113
pull_request:
12-
paths:
13-
- "go.sum"
14-
- "go.mod"
15-
- "**.go"
16-
- "scripts/errcheck_excludes.txt"
17-
- ".github/workflows/golangci-lint.yml"
18-
- ".golangci.yml"
14+
15+
permissions: # added using https://github.com/step-security/secure-repo
16+
contents: read
1917

2018
jobs:
2119
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
2223
name: lint
2324
runs-on: ubuntu-latest
2425
steps:
2526
- name: Checkout repository
26-
uses: actions/checkout@v2
27-
27+
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
28+
- name: Install Go
29+
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
30+
with:
31+
go-version: 1.22.x
32+
- name: Install snmp_exporter/generator dependencies
33+
run: sudo apt-get update && sudo apt-get -y install libsnmp-dev
34+
if: github.repository == 'prometheus/snmp_exporter'
2835
- name: Lint
29-
uses: golangci/golangci-lint-action@v2
36+
uses: golangci/golangci-lint-action@a4f60bb28d35aeee14e6880718e0c85ff1882e64 # v6.0.1
3037
with:
31-
version: v1.42.0
38+
args: --verbose
39+
version: v1.59.1

.promu.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
go:
22
# Whenever the Go version is updated here,
33
# .circle/config.yml should also be updated.
4-
version: 1.20
4+
version: 1.22
55
repository:
66
path: github.com/prometheus-community/avalanche
77
build:
88
binaries:
99
- name: avalanche
1010
path: ./cmd
11-
flags: -a -tags netgo
1211
ldflags: |
1312
-X github.com/prometheus/common/version.Version={{.Version}}
1413
-X github.com/prometheus/common/version.Revision={{.Revision}}

Makefile.common

+25-15
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 which gotestsum),)
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.13.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.49.0
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))
@@ -91,6 +91,8 @@ BUILD_DOCKER_ARCHS = $(addprefix common-docker-,$(DOCKER_ARCHS))
9191
PUBLISH_DOCKER_ARCHS = $(addprefix common-docker-publish-,$(DOCKER_ARCHS))
9292
TAG_DOCKER_ARCHS = $(addprefix common-docker-tag-latest-,$(DOCKER_ARCHS))
9393

94+
SANITIZED_DOCKER_IMAGE_TAG := $(subst +,-,$(DOCKER_IMAGE_TAG))
95+
9496
ifeq ($(GOHOSTARCH),amd64)
9597
ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux freebsd darwin windows))
9698
# Only supported on amd64
@@ -167,16 +169,20 @@ common-vet:
167169
common-lint: $(GOLANGCI_LINT)
168170
ifdef GOLANGCI_LINT
169171
@echo ">> running golangci-lint"
170-
# 'go list' needs to be executed before staticcheck to prepopulate the modules cache.
171-
# Otherwise staticcheck might fail randomly for some reason not yet explained.
172-
$(GO) list -e -compiled -test=true -export=false -deps=true -find=false -tags= -- ./... > /dev/null
173172
$(GOLANGCI_LINT) run $(GOLANGCI_LINT_OPTS) $(pkgs)
174173
endif
175174

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+
176182
.PHONY: common-yamllint
177183
common-yamllint:
178184
@echo ">> running yamllint on all YAML files in the repository"
179-
ifeq (, $(shell which yamllint))
185+
ifeq (, $(shell command -v yamllint 2> /dev/null))
180186
@echo "yamllint not installed so skipping"
181187
else
182188
yamllint .
@@ -202,10 +208,14 @@ common-tarball: promu
202208
@echo ">> building release tarball"
203209
$(PROMU) tarball --prefix $(PREFIX) $(BIN_DIR)
204210

211+
.PHONY: common-docker-repo-name
212+
common-docker-repo-name:
213+
@echo "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)"
214+
205215
.PHONY: common-docker $(BUILD_DOCKER_ARCHS)
206216
common-docker: $(BUILD_DOCKER_ARCHS)
207217
$(BUILD_DOCKER_ARCHS): common-docker-%:
208-
docker build -t "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(DOCKER_IMAGE_TAG)" \
218+
docker build -t "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(SANITIZED_DOCKER_IMAGE_TAG)" \
209219
-f $(DOCKERFILE_PATH) \
210220
--build-arg ARCH="$*" \
211221
--build-arg OS="linux" \
@@ -214,19 +224,19 @@ $(BUILD_DOCKER_ARCHS): common-docker-%:
214224
.PHONY: common-docker-publish $(PUBLISH_DOCKER_ARCHS)
215225
common-docker-publish: $(PUBLISH_DOCKER_ARCHS)
216226
$(PUBLISH_DOCKER_ARCHS): common-docker-publish-%:
217-
docker push "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(DOCKER_IMAGE_TAG)"
227+
docker push "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(SANITIZED_DOCKER_IMAGE_TAG)"
218228

219229
DOCKER_MAJOR_VERSION_TAG = $(firstword $(subst ., ,$(shell cat VERSION)))
220230
.PHONY: common-docker-tag-latest $(TAG_DOCKER_ARCHS)
221231
common-docker-tag-latest: $(TAG_DOCKER_ARCHS)
222232
$(TAG_DOCKER_ARCHS): common-docker-tag-latest-%:
223-
docker tag "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(DOCKER_IMAGE_TAG)" "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:latest"
224-
docker tag "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(DOCKER_IMAGE_TAG)" "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:v$(DOCKER_MAJOR_VERSION_TAG)"
233+
docker tag "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(SANITIZED_DOCKER_IMAGE_TAG)" "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:latest"
234+
docker tag "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(SANITIZED_DOCKER_IMAGE_TAG)" "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:v$(DOCKER_MAJOR_VERSION_TAG)"
225235

226236
.PHONY: common-docker-manifest
227237
common-docker-manifest:
228-
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest create -a "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)" $(foreach ARCH,$(DOCKER_ARCHS),$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$(ARCH):$(DOCKER_IMAGE_TAG))
229-
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest push "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)"
238+
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest create -a "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(SANITIZED_DOCKER_IMAGE_TAG)" $(foreach ARCH,$(DOCKER_ARCHS),$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$(ARCH):$(SANITIZED_DOCKER_IMAGE_TAG))
239+
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest push "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(SANITIZED_DOCKER_IMAGE_TAG)"
230240

231241
.PHONY: promu
232242
promu: $(PROMU)

cmd/avalanche.go

-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ func main() {
9898
if len(*remotePprofURLs) == 0 {
9999
log.Fatal("remote profiling interval specified wihout any remote pprof urls")
100100
}
101-
rand.Seed(time.Now().UnixNano())
102101
suffix := rand.Intn(1000)
103102
go func() {
104103
ticker := time.NewTicker(*remotePprofInterval)

go.mod

+16-7
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,25 @@
11
module github.com/prometheus-community/avalanche
22

3-
go 1.14
3+
go 1.21
44

55
require (
6-
github.com/alecthomas/units v0.0.0-20201120081800-1786d5ef83d4 // indirect
76
github.com/gogo/protobuf v1.3.2
87
github.com/golang/snappy v0.0.4
98
github.com/nelkinda/health-go v0.0.1
10-
github.com/prometheus/client_golang v1.9.0
11-
github.com/prometheus/client_model v0.2.0
12-
github.com/prometheus/common v0.15.0
13-
github.com/prometheus/prometheus v1.8.2-0.20201119181812-c8f810083d3f
14-
golang.org/x/sys v0.1.0 // indirect
9+
github.com/prometheus/client_golang v1.19.1
10+
github.com/prometheus/client_model v0.6.1
11+
github.com/prometheus/common v0.54.0
12+
github.com/prometheus/prometheus v0.53.1
1513
gopkg.in/alecthomas/kingpin.v2 v2.2.6
1614
)
15+
16+
require (
17+
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 // indirect
18+
github.com/alecthomas/units v0.0.0-20231202071711-9a357b53e9c9 // indirect
19+
github.com/beorn7/perks v1.0.1 // indirect
20+
github.com/cespare/xxhash/v2 v2.3.0 // indirect
21+
github.com/nelkinda/http-go v0.0.1 // indirect
22+
github.com/prometheus/procfs v0.12.0 // indirect
23+
golang.org/x/sys v0.21.0 // indirect
24+
google.golang.org/protobuf v1.34.1 // indirect
25+
)

0 commit comments

Comments
 (0)