Skip to content

Commit

Permalink
Update go to 1.23 in the CI
Browse files Browse the repository at this point in the history
This commit updates the go version to 1.23 in the CI, including
unit, e2e tests and promu crossbuild.

It also bumps bingo dependencies where needed.

Signed-off-by: Filip Petkovski <[email protected]>
  • Loading branch information
fpetkovski committed Oct 16, 2024
1 parent 9c925bf commit 9045370
Show file tree
Hide file tree
Showing 20 changed files with 3,985 additions and 37 deletions.
18 changes: 9 additions & 9 deletions .bingo/Variables.mk
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ GO ?= $(shell which go)
# @echo "Running alertmanager"
# @$(ALERTMANAGER) <flags/args..>
#
ALERTMANAGER := $(GOBIN)/alertmanager-v0.24.0
ALERTMANAGER := $(GOBIN)/alertmanager-v0.27.0
$(ALERTMANAGER): $(BINGO_DIR)/alertmanager.mod
@# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies.
@echo "(re)installing $(GOBIN)/alertmanager-v0.24.0"
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=alertmanager.mod -o=$(GOBIN)/alertmanager-v0.24.0 "github.com/prometheus/alertmanager/cmd/alertmanager"
@echo "(re)installing $(GOBIN)/alertmanager-v0.27.0"
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=alertmanager.mod -o=$(GOBIN)/alertmanager-v0.27.0 "github.com/prometheus/alertmanager/cmd/alertmanager"

BINGO := $(GOBIN)/bingo-v0.9.0
$(BINGO): $(BINGO_DIR)/bingo.mod
Expand Down Expand Up @@ -95,23 +95,23 @@ $(MDOX): $(BINGO_DIR)/mdox.mod
@echo "(re)installing $(GOBIN)/mdox-v0.9.1-0.20220713110358-25b9abcf90a0"
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=mdox.mod -o=$(GOBIN)/mdox-v0.9.1-0.20220713110358-25b9abcf90a0 "github.com/bwplotka/mdox"

MINIO := $(GOBIN)/minio-v0.0.0-20220720015624-ce8397f7d944
MINIO := $(GOBIN)/minio-v0.0.0-20241014163537-3da7c9cce3de
$(MINIO): $(BINGO_DIR)/minio.mod
@# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies.
@echo "(re)installing $(GOBIN)/minio-v0.0.0-20220720015624-ce8397f7d944"
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=minio.mod -o=$(GOBIN)/minio-v0.0.0-20220720015624-ce8397f7d944 "github.com/minio/minio"
@echo "(re)installing $(GOBIN)/minio-v0.0.0-20241014163537-3da7c9cce3de"
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=minio.mod -o=$(GOBIN)/minio-v0.0.0-20241014163537-3da7c9cce3de "github.com/minio/minio"

PROMDOC := $(GOBIN)/promdoc-v0.8.0
$(PROMDOC): $(BINGO_DIR)/promdoc.mod
@# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies.
@echo "(re)installing $(GOBIN)/promdoc-v0.8.0"
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=promdoc.mod -o=$(GOBIN)/promdoc-v0.8.0 "github.com/plexsystems/promdoc"

PROMETHEUS := $(GOBIN)/prometheus-v0.37.0
PROMETHEUS := $(GOBIN)/prometheus-v0.54.1
$(PROMETHEUS): $(BINGO_DIR)/prometheus.mod
@# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies.
@echo "(re)installing $(GOBIN)/prometheus-v0.37.0"
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=prometheus.mod -o=$(GOBIN)/prometheus-v0.37.0 "github.com/prometheus/prometheus/cmd/prometheus"
@echo "(re)installing $(GOBIN)/prometheus-v0.54.1"
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=prometheus.mod -o=$(GOBIN)/prometheus-v0.54.1 "github.com/prometheus/prometheus/cmd/prometheus"

PROMTOOL := $(GOBIN)/promtool-v0.47.0
$(PROMTOOL): $(BINGO_DIR)/promtool.mod
Expand Down
6 changes: 4 additions & 2 deletions .bingo/alertmanager.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT

go 1.14
go 1.21

require github.com/prometheus/alertmanager v0.24.0 // cmd/alertmanager
toolchain go1.23.1

require github.com/prometheus/alertmanager v0.27.0 // cmd/alertmanager
758 changes: 758 additions & 0 deletions .bingo/alertmanager.sum

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions .bingo/minio.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT

go 1.14
go 1.22

require github.com/minio/minio v0.0.0-20220720015624-ce8397f7d944
toolchain go1.23.1

require github.com/minio/minio v0.0.0-20241014163537-3da7c9cce3de
1,720 changes: 1,720 additions & 0 deletions .bingo/minio.sum

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions .bingo/prometheus.mod
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT

go 1.14
go 1.21.0

toolchain go1.23.1

replace k8s.io/klog => github.com/simonpasquier/klog-gokit v0.3.0

replace k8s.io/klog/v2 => github.com/simonpasquier/klog-gokit/v3 v3.0.0
replace k8s.io/klog/v2 => github.com/simonpasquier/klog-gokit/v3 v3.3.0

exclude github.com/linode/linodego v1.0.0

exclude github.com/grpc-ecosystem/grpc-gateway v1.14.7

exclude google.golang.org/api v0.30.0

require github.com/prometheus/prometheus v0.37.0 // cmd/prometheus
require github.com/prometheus/prometheus v0.54.1 // cmd/prometheus
1,454 changes: 1,454 additions & 0 deletions .bingo/prometheus.sum

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions .bingo/variables.env
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if [ -z "$GOBIN" ]; then
fi


ALERTMANAGER="${GOBIN}/alertmanager-v0.24.0"
ALERTMANAGER="${GOBIN}/alertmanager-v0.27.0"

BINGO="${GOBIN}/bingo-v0.9.0"

Expand All @@ -34,11 +34,11 @@ JSONNETFMT="${GOBIN}/jsonnetfmt-v0.18.0"

MDOX="${GOBIN}/mdox-v0.9.1-0.20220713110358-25b9abcf90a0"

MINIO="${GOBIN}/minio-v0.0.0-20220720015624-ce8397f7d944"
MINIO="${GOBIN}/minio-v0.0.0-20241014163537-3da7c9cce3de"

PROMDOC="${GOBIN}/promdoc-v0.8.0"

PROMETHEUS="${GOBIN}/prometheus-v0.37.0"
PROMETHEUS="${GOBIN}/prometheus-v0.54.1"

PROMTOOL="${GOBIN}/promtool-v0.47.0"

Expand Down
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ orbs:
executors:
golang:
docker:
- image: cimg/go:1.22-node
- image: cimg/go:1.23-node
golang-test:
docker:
- image: cimg/go:1.22-node
- image: cimg/go:1.23-node
- image: quay.io/thanos/docker-swift-onlyone-authv2-keystone:v0.1

jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: 1.22.x
go-version: 1.23.x

- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: 1.22.x
go-version: 1.23.x

- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
Expand All @@ -51,7 +51,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: 1.22.x
go-version: 1.23.x

- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
Expand Down Expand Up @@ -108,7 +108,7 @@ jobs:
check_filenames: false
check_hidden: true
skip: ./pkg/ui/*,./pkg/store/6545postingsrepro,./internal/*,./mixin/vendor/*,./.bingo/*,go.mod,go.sum
ignore_words_list: intrumentation,mmaped,nd,ot,re-use,ser,serie,sme,sudu,tast,te
ignore_words_list: intrumentation,mmaped,nd,ot,re-use,ser,serie,sme,sudu,tast,te,ans

e2e:
strategy:
Expand All @@ -127,7 +127,7 @@ jobs:
- name: Install Go.
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: 1.22.x
go-version: 1.23.x

- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
Expand Down
2 changes: 1 addition & 1 deletion .go-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.22
1.23
2 changes: 1 addition & 1 deletion .promu.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
go:
version: 1.22
version: 1.23
repository:
path: github.com/thanos-io/thanos
build:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.e2e-tests
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Taking a non-alpine image for e2e tests so that cgo can be enabled for the race detector.
FROM golang:1.23 as builder
FROM golang:1.23.2 as builder

WORKDIR $GOPATH/src/github.com/thanos-io/thanos

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.multi-stage
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# By default we pin to amd64 sha. Use make docker to automatically adjust for arm64 versions.
ARG BASE_DOCKER_SHA="14d68ca3d69fceaa6224250c83d81d935c053fb13594c811038c461194599973"
FROM golang:1.22-alpine3.18 as builder
FROM golang:1.23.2-alpine3.20 as builder

WORKDIR $GOPATH/src/github.com/thanos-io/thanos
# Change in the docker context invalidates the cache so to leverage docker
Expand Down
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -395,8 +395,7 @@ go-lint: check-git deps $(GOLANGCI_LINT) $(FAILLINT)
$(call require_clean_work_tree,'detected not clean work tree before running lint, previous job changed something?')
@echo ">> verifying modules being imported"
@# TODO(bwplotka): Add, Printf, DefaultRegisterer, NewGaugeFunc and MustRegister once exception are accepted. Add fmt.{Errorf}=github.com/pkg/errors.{Errorf} once https://github.com/fatih/faillint/issues/10 is addressed.
@$(FAILLINT) -paths "errors=github.com/pkg/errors,\
github.com/prometheus/tsdb=github.com/prometheus/prometheus/tsdb,\
@$(FAILLINT) -paths "github.com/prometheus/tsdb=github.com/prometheus/prometheus/tsdb,\
github.com/prometheus/prometheus/pkg/testutils=github.com/thanos-io/thanos/pkg/testutil,\
github.com/prometheus/client_golang/prometheus.{DefaultGatherer,DefBuckets,NewUntypedFunc,UntypedFunc},\
github.com/prometheus/client_golang/prometheus.{NewCounter,NewCounterVec,NewCounterVec,NewGauge,NewGaugeVec,NewGaugeFunc,\
Expand Down
2 changes: 1 addition & 1 deletion pkg/rules/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ func TestManager_Rules(t *testing.T) {
thanosRuleMgr.Run()
thanosRuleMgr.Stop()
}()
testRulesAgainstExamples(t, filepath.Join(curr, "../../examples/alerts"), thanosRuleMgr)
testRulesAgainstExamples(t, filepath.Join(curr, "../../examples/alerts"), thanosRuleMgr, false)
}

func TestManagerUpdateWithNoRules(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/rules/prometheus_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@ rule_files:
promRules := NewPrometheus(u, promclient.NewDefaultClient(), func() labels.Labels {
return labels.FromStrings("replica", "test1")
})
testRulesAgainstExamples(t, filepath.Join(root, "examples/alerts"), promRules)
testRulesAgainstExamples(t, filepath.Join(root, "examples/alerts"), promRules, true)
}
15 changes: 13 additions & 2 deletions pkg/rules/rules_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import (
"testing"
"time"

"golang.org/x/exp/slices"

"github.com/efficientgo/core/testutil"
"github.com/gogo/protobuf/proto"
"github.com/prometheus/prometheus/model/labels"
Expand All @@ -25,7 +27,7 @@ func TestMain(m *testing.M) {
}

// testRulesAgainstExamples tests against alerts.yaml and rules.yaml examples.
func testRulesAgainstExamples(t *testing.T, dir string, server rulespb.RulesServer) {
func testRulesAgainstExamples(t *testing.T, dir string, server rulespb.RulesServer, removeEmptyGroups bool) {
t.Helper()

// We don't test internals, just if groups are expected.
Expand Down Expand Up @@ -158,7 +160,9 @@ func testRulesAgainstExamples(t *testing.T, dir string, server rulespb.RulesServ
}
testutil.Ok(t, err)

expectedForType := expected
expectedForType := make([]*rulespb.RuleGroup, len(expected))
copy(expectedForType, expected)

if tcase.requestedType != rulespb.RulesRequest_ALL {
expectedForType = make([]*rulespb.RuleGroup, len(expected))
for i, g := range expected {
Expand All @@ -180,6 +184,13 @@ func testRulesAgainstExamples(t *testing.T, dir string, server rulespb.RulesServ
}
}

// The Prometheus API does not return groups with no rules.
if removeEmptyGroups {
expectedForType = slices.DeleteFunc(expectedForType, func(group *rulespb.RuleGroup) bool {
return len(group.Rules) == 0
})
}

got := groups.Groups

// We don't want to be picky, just check what number and types of rules within group are.
Expand Down
2 changes: 1 addition & 1 deletion pkg/testutil/e2eutil/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import (
)

const (
defaultPrometheusVersion = "v0.37.0"
defaultPrometheusVersion = "v0.54.1"
defaultAlertmanagerVersion = "v0.20.0"
defaultMinioVersion = "RELEASE.2022-07-30T05-21-40Z"

Expand Down

0 comments on commit 9045370

Please sign in to comment.