From dd0c1cc60d874b0d27737fc8341cac08deaa5b83 Mon Sep 17 00:00:00 2001 From: Ben Ye Date: Fri, 11 Oct 2024 14:45:16 -0700 Subject: [PATCH 1/5] upgrade go version to 1.23.2 and update build image Signed-off-by: Ben Ye --- .github/workflows/test-build-deploy.yml | 14 +++++++------- Makefile | 2 +- go.mod | 4 +--- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test-build-deploy.yml b/.github/workflows/test-build-deploy.yml index 83e4a6cc113..883c98a21e6 100644 --- a/.github/workflows/test-build-deploy.yml +++ b/.github/workflows/test-build-deploy.yml @@ -17,7 +17,7 @@ jobs: lint: runs-on: ubuntu-20.04 container: - image: quay.io/cortexproject/build-image:master-582c03a76 + image: quay.io/cortexproject/build-image:master-d3778ce59 steps: - name: Checkout Repo uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0 @@ -46,7 +46,7 @@ jobs: test: runs-on: ubuntu-20.04 container: - image: quay.io/cortexproject/build-image:master-582c03a76 + image: quay.io/cortexproject/build-image:master-d3778ce59 steps: - name: Checkout Repo uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0 @@ -89,7 +89,7 @@ jobs: build: runs-on: ubuntu-20.04 container: - image: quay.io/cortexproject/build-image:master-582c03a76 + image: quay.io/cortexproject/build-image:master-d3778ce59 steps: - name: Checkout Repo uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0 @@ -148,7 +148,7 @@ jobs: - name: Upgrade golang uses: actions/setup-go@bfdd3570ce990073878bf10f6b2d79082de49492 # v2.2.0 with: - go-version: 1.22.5 + go-version: 1.23.2 - name: Checkout Repo uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0 - name: Install Docker Client @@ -224,14 +224,14 @@ jobs: run: | touch build-image/.uptodate MIGRATIONS_DIR=$(pwd)/cmd/cortex/migrations - make BUILD_IMAGE=quay.io/cortexproject/build-image:master-582c03a76 TTY='' configs-integration-test + make BUILD_IMAGE=quay.io/cortexproject/build-image:master-d3778ce59 TTY='' configs-integration-test deploy_website: needs: [build, test] if: (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) && github.repository == 'cortexproject/cortex' runs-on: ubuntu-20.04 container: - image: quay.io/cortexproject/build-image:master-582c03a76 + image: quay.io/cortexproject/build-image:master-d3778ce59 steps: - name: Checkout Repo uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0 @@ -273,7 +273,7 @@ jobs: if: (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) && github.repository == 'cortexproject/cortex' runs-on: ubuntu-20.04 container: - image: quay.io/cortexproject/build-image:master-582c03a76 + image: quay.io/cortexproject/build-image:master-d3778ce59 steps: - name: Checkout Repo uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0 diff --git a/Makefile b/Makefile index c3666f7af31..aa899d47935 100644 --- a/Makefile +++ b/Makefile @@ -115,7 +115,7 @@ build-image/$(UPTODATE): build-image/* SUDO := $(shell docker info >/dev/null 2>&1 || echo "sudo -E") BUILD_IN_CONTAINER := true BUILD_IMAGE ?= $(IMAGE_PREFIX)build-image -LATEST_BUILD_IMAGE_TAG ?= master-582c03a76 +LATEST_BUILD_IMAGE_TAG ?= master-d3778ce59 # TTY is parameterized to allow Google Cloud Builder to run builds, # as it currently disallows TTY devices. This value needs to be overridden diff --git a/go.mod b/go.mod index d5477040032..6c7651cb9f6 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,6 @@ module github.com/cortexproject/cortex -go 1.22.0 - -toolchain go1.22.5 +go 1.23.0 require ( github.com/Masterminds/squirrel v1.5.4 From 9d507b0959c512f41902ce136feaf27cd3fe12ed Mon Sep 17 00:00:00 2001 From: Ben Ye Date: Fri, 11 Oct 2024 14:47:12 -0700 Subject: [PATCH 2/5] changelog Signed-off-by: Ben Ye --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 69e340bbf04..23094f9fc5b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ * [ENHANCEMENT] StoreGateway: Implement metadata API limit in queryable. #6195 * [ENHANCEMENT] Ingester: Add matchers to ingester LabelNames() and LabelNamesStream() RPC. #6209 * [ENHANCEMENT] Ingester/Store Gateway Clients: Introduce an experimental HealthCheck handler to quickly fail requests directed to unhealthy targets. #6225 #6257 +* [ENHANCEMENT] Upgrade build image and Go version to 1.23.2. #6261 #6262 * [BUGFIX] Runtime-config: Handle absolute file paths when working directory is not / #6224 ## 1.18.0 2024-09-03 From 13af66a742a8a0aa8190f45213851981d0a28d3d Mon Sep 17 00:00:00 2001 From: Ben Ye Date: Sun, 13 Oct 2024 14:30:55 -0700 Subject: [PATCH 3/5] update to build image with newer version of golangci lint Signed-off-by: Ben Ye --- .github/workflows/test-build-deploy.yml | 12 ++++++------ Makefile | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test-build-deploy.yml b/.github/workflows/test-build-deploy.yml index 883c98a21e6..1b9232906f1 100644 --- a/.github/workflows/test-build-deploy.yml +++ b/.github/workflows/test-build-deploy.yml @@ -17,7 +17,7 @@ jobs: lint: runs-on: ubuntu-20.04 container: - image: quay.io/cortexproject/build-image:master-d3778ce59 + image: quay.io/cortexproject/build-image:master-ac7827fa9 steps: - name: Checkout Repo uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0 @@ -46,7 +46,7 @@ jobs: test: runs-on: ubuntu-20.04 container: - image: quay.io/cortexproject/build-image:master-d3778ce59 + image: quay.io/cortexproject/build-image:master-ac7827fa9 steps: - name: Checkout Repo uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0 @@ -89,7 +89,7 @@ jobs: build: runs-on: ubuntu-20.04 container: - image: quay.io/cortexproject/build-image:master-d3778ce59 + image: quay.io/cortexproject/build-image:master-ac7827fa9 steps: - name: Checkout Repo uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0 @@ -224,14 +224,14 @@ jobs: run: | touch build-image/.uptodate MIGRATIONS_DIR=$(pwd)/cmd/cortex/migrations - make BUILD_IMAGE=quay.io/cortexproject/build-image:master-d3778ce59 TTY='' configs-integration-test + make BUILD_IMAGE=quay.io/cortexproject/build-image:master-ac7827fa9 TTY='' configs-integration-test deploy_website: needs: [build, test] if: (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) && github.repository == 'cortexproject/cortex' runs-on: ubuntu-20.04 container: - image: quay.io/cortexproject/build-image:master-d3778ce59 + image: quay.io/cortexproject/build-image:master-ac7827fa9 steps: - name: Checkout Repo uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0 @@ -273,7 +273,7 @@ jobs: if: (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) && github.repository == 'cortexproject/cortex' runs-on: ubuntu-20.04 container: - image: quay.io/cortexproject/build-image:master-d3778ce59 + image: quay.io/cortexproject/build-image:master-ac7827fa9 steps: - name: Checkout Repo uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0 diff --git a/Makefile b/Makefile index aa899d47935..2704ee35b66 100644 --- a/Makefile +++ b/Makefile @@ -115,7 +115,7 @@ build-image/$(UPTODATE): build-image/* SUDO := $(shell docker info >/dev/null 2>&1 || echo "sudo -E") BUILD_IN_CONTAINER := true BUILD_IMAGE ?= $(IMAGE_PREFIX)build-image -LATEST_BUILD_IMAGE_TAG ?= master-d3778ce59 +LATEST_BUILD_IMAGE_TAG ?= master-ac7827fa9 # TTY is parameterized to allow Google Cloud Builder to run builds, # as it currently disallows TTY devices. This value needs to be overridden From 5756c6e049471f978ab661c2a68a013511afd8f5 Mon Sep 17 00:00:00 2001 From: Ben Ye Date: Sun, 13 Oct 2024 14:37:44 -0700 Subject: [PATCH 4/5] fix lint Signed-off-by: Ben Ye --- pkg/distributor/distributor.go | 3 +++ pkg/ring/kv/dynamodb/dynamodb.go | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/distributor/distributor.go b/pkg/distributor/distributor.go index 699035e6722..71808e206a4 100644 --- a/pkg/distributor/distributor.go +++ b/pkg/distributor/distributor.go @@ -662,11 +662,13 @@ func (d *Distributor) Push(ctx context.Context, req *cortexpb.WriteRequest) (*co if errors.Is(err, ha.ReplicasNotMatchError{}) { // These samples have been deduped. d.dedupedSamples.WithLabelValues(userID, cluster).Add(float64(numFloatSamples + numHistogramSamples)) + // nolint:govet return nil, httpgrpc.Errorf(http.StatusAccepted, err.Error()) } if errors.Is(err, ha.TooManyReplicaGroupsError{}) { d.validateMetrics.DiscardedSamples.WithLabelValues(validation.TooManyHAClusters, userID).Add(float64(numFloatSamples + numHistogramSamples)) + // nolint:govet return nil, httpgrpc.Errorf(http.StatusBadRequest, err.Error()) } @@ -930,6 +932,7 @@ func (d *Distributor) prepareSeriesKeys(ctx context.Context, req *cortexpb.Write if validationErr != nil && firstPartialErr == nil { // The series labels may be retained by validationErr but that's not a problem for this // use case because we format it calling Error() and then we discard it. + // nolint:govet firstPartialErr = httpgrpc.Errorf(http.StatusBadRequest, validationErr.Error()) } diff --git a/pkg/ring/kv/dynamodb/dynamodb.go b/pkg/ring/kv/dynamodb/dynamodb.go index 1e783189a5b..f54e5fe55be 100644 --- a/pkg/ring/kv/dynamodb/dynamodb.go +++ b/pkg/ring/kv/dynamodb/dynamodb.go @@ -237,7 +237,7 @@ func (kv dynamodbKV) Batch(ctx context.Context, put map[dynamodbKey][]byte, dele totalCapacity += getCapacityUnits(consumedCapacity) } - if resp.UnprocessedItems != nil && len(resp.UnprocessedItems) > 0 { + if len(resp.UnprocessedItems) > 0 { return totalCapacity, fmt.Errorf("error processing batch request for %s requests", resp.UnprocessedItems) } } From 97f60ba4490b0957b52b49c539f73e573e5225fa Mon Sep 17 00:00:00 2001 From: Ben Ye Date: Sun, 13 Oct 2024 14:59:53 -0700 Subject: [PATCH 5/5] disable printf govet lint Signed-off-by: Ben Ye --- .golangci.yml | 3 +++ pkg/distributor/distributor.go | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 77d8f8cab64..dbfe02e8371 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -21,6 +21,9 @@ linters-settings: local-prefixes: "github.com/cortexproject/cortex" revive: severity: error # We only want critical issues. + govet: + disable: + - printf depguard: rules: diff --git a/pkg/distributor/distributor.go b/pkg/distributor/distributor.go index 71808e206a4..699035e6722 100644 --- a/pkg/distributor/distributor.go +++ b/pkg/distributor/distributor.go @@ -662,13 +662,11 @@ func (d *Distributor) Push(ctx context.Context, req *cortexpb.WriteRequest) (*co if errors.Is(err, ha.ReplicasNotMatchError{}) { // These samples have been deduped. d.dedupedSamples.WithLabelValues(userID, cluster).Add(float64(numFloatSamples + numHistogramSamples)) - // nolint:govet return nil, httpgrpc.Errorf(http.StatusAccepted, err.Error()) } if errors.Is(err, ha.TooManyReplicaGroupsError{}) { d.validateMetrics.DiscardedSamples.WithLabelValues(validation.TooManyHAClusters, userID).Add(float64(numFloatSamples + numHistogramSamples)) - // nolint:govet return nil, httpgrpc.Errorf(http.StatusBadRequest, err.Error()) } @@ -932,7 +930,6 @@ func (d *Distributor) prepareSeriesKeys(ctx context.Context, req *cortexpb.Write if validationErr != nil && firstPartialErr == nil { // The series labels may be retained by validationErr but that's not a problem for this // use case because we format it calling Error() and then we discard it. - // nolint:govet firstPartialErr = httpgrpc.Errorf(http.StatusBadRequest, validationErr.Error()) }