Skip to content

Commit 20775d7

Browse files
Update workflows to use the latest image with go 1.24.0 (#6637)
* bump go mod version to 1.24 Signed-off-by: dankrzeminski32 <[email protected]> * resolve non-constant format string in ErrorF calls Signed-off-by: dankrzeminski32 <[email protected]> * update build with go 1.24 dependancies Signed-off-by: dankrzeminski32 <[email protected]> --------- Signed-off-by: dankrzeminski32 <[email protected]>
1 parent 281284a commit 20775d7

File tree

20 files changed

+49
-49
lines changed

20 files changed

+49
-49
lines changed

.github/workflows/test-build-deploy.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
lint:
1818
runs-on: ubuntu-24.04
1919
container:
20-
image: quay.io/cortexproject/build-image:master-03a8f8c98
20+
image: quay.io/cortexproject/build-image:master-281284ac1
2121
steps:
2222
- name: Checkout Repo
2323
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -46,7 +46,7 @@ jobs:
4646
test:
4747
runs-on: ubuntu-24.04
4848
container:
49-
image: quay.io/cortexproject/build-image:master-03a8f8c98
49+
image: quay.io/cortexproject/build-image:master-281284ac1
5050
steps:
5151
- name: Checkout Repo
5252
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -64,7 +64,7 @@ jobs:
6464
test-no-race:
6565
runs-on: ubuntu-24.04
6666
container:
67-
image: quay.io/cortexproject/build-image:master-03a8f8c98
67+
image: quay.io/cortexproject/build-image:master-281284ac1
6868
steps:
6969
- name: Checkout Repo
7070
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -107,7 +107,7 @@ jobs:
107107
build:
108108
runs-on: ubuntu-24.04
109109
container:
110-
image: quay.io/cortexproject/build-image:master-03a8f8c98
110+
image: quay.io/cortexproject/build-image:master-281284ac1
111111
steps:
112112
- name: Checkout Repo
113113
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -247,14 +247,14 @@ jobs:
247247
run: |
248248
touch build-image/.uptodate
249249
MIGRATIONS_DIR=$(pwd)/cmd/cortex/migrations
250-
make BUILD_IMAGE=quay.io/cortexproject/build-image:master-03a8f8c98 TTY='' configs-integration-test
250+
make BUILD_IMAGE=quay.io/cortexproject/build-image:master-281284ac1 TTY='' configs-integration-test
251251
252252
deploy_website:
253253
needs: [build, test]
254254
if: (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) && github.repository == 'cortexproject/cortex'
255255
runs-on: ubuntu-24.04
256256
container:
257-
image: quay.io/cortexproject/build-image:master-03a8f8c98
257+
image: quay.io/cortexproject/build-image:master-281284ac1
258258
steps:
259259
- name: Checkout Repo
260260
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -296,7 +296,7 @@ jobs:
296296
if: (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) && github.repository == 'cortexproject/cortex'
297297
runs-on: ubuntu-24.04
298298
container:
299-
image: quay.io/cortexproject/build-image:master-03a8f8c98
299+
image: quay.io/cortexproject/build-image:master-281284ac1
300300
steps:
301301
- name: Checkout Repo
302302
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ build-image/$(UPTODATE): build-image/*
115115
SUDO := $(shell docker info >/dev/null 2>&1 || echo "sudo -E")
116116
BUILD_IN_CONTAINER := true
117117
BUILD_IMAGE ?= $(IMAGE_PREFIX)build-image
118-
LATEST_BUILD_IMAGE_TAG ?= master-03a8f8c98
118+
LATEST_BUILD_IMAGE_TAG ?= master-281284ac1
119119

120120
# TTY is parameterized to allow Google Cloud Builder to run builds,
121121
# as it currently disallows TTY devices. This value needs to be overridden

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/cortexproject/cortex
22

3-
go 1.23.0
3+
go 1.24.0
44

55
require (
66
github.com/Masterminds/squirrel v1.5.4

pkg/distributor/distributor.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -730,12 +730,12 @@ func (d *Distributor) Push(ctx context.Context, req *cortexpb.WriteRequest) (*co
730730
if errors.Is(err, ha.ReplicasNotMatchError{}) {
731731
// These samples have been deduped.
732732
d.dedupedSamples.WithLabelValues(userID, cluster).Add(float64(numFloatSamples + numHistogramSamples))
733-
return nil, httpgrpc.Errorf(http.StatusAccepted, err.Error())
733+
return nil, httpgrpc.Errorf(http.StatusAccepted, "%s", err.Error())
734734
}
735735

736736
if errors.Is(err, ha.TooManyReplicaGroupsError{}) {
737737
d.validateMetrics.DiscardedSamples.WithLabelValues(validation.TooManyHAClusters, userID).Add(float64(numFloatSamples + numHistogramSamples))
738-
return nil, httpgrpc.Errorf(http.StatusBadRequest, err.Error())
738+
return nil, httpgrpc.Errorf(http.StatusBadRequest, "%s", err.Error())
739739
}
740740

741741
return nil, err
@@ -1053,7 +1053,7 @@ func (d *Distributor) prepareSeriesKeys(ctx context.Context, req *cortexpb.Write
10531053
if validationErr != nil && firstPartialErr == nil {
10541054
// The series labels may be retained by validationErr but that's not a problem for this
10551055
// use case because we format it calling Error() and then we discard it.
1056-
firstPartialErr = httpgrpc.Errorf(http.StatusBadRequest, validationErr.Error())
1056+
firstPartialErr = httpgrpc.Errorf(http.StatusBadRequest, "%s", validationErr.Error())
10571057
}
10581058

10591059
// validateSeries would have returned an emptyPreallocSeries if there were no valid samples.

pkg/frontend/transport/handler.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ const (
3939
)
4040

4141
var (
42-
errCanceled = httpgrpc.Errorf(StatusClientClosedRequest, context.Canceled.Error())
43-
errDeadlineExceeded = httpgrpc.Errorf(http.StatusGatewayTimeout, context.DeadlineExceeded.Error())
44-
errRequestEntityTooLarge = httpgrpc.Errorf(http.StatusRequestEntityTooLarge, "http: request body too large")
42+
errCanceled = httpgrpc.Errorf(StatusClientClosedRequest, "%s", context.Canceled.Error())
43+
errDeadlineExceeded = httpgrpc.Errorf(http.StatusGatewayTimeout, "%s", context.DeadlineExceeded.Error())
44+
errRequestEntityTooLarge = httpgrpc.Errorf(http.StatusRequestEntityTooLarge, "%s", "http: request body too large")
4545
)
4646

4747
const (
@@ -279,7 +279,7 @@ func (f *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
279279
if resp.StatusCode/100 != 2 {
280280
body, err2 := tripperware.BodyBuffer(resp, f.log)
281281
if err2 == nil {
282-
err = httpgrpc.Errorf(resp.StatusCode, string(body))
282+
err = httpgrpc.Errorf(resp.StatusCode, "%s", string(body))
283283
}
284284
}
285285
}

pkg/ingester/ingester.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1168,7 +1168,7 @@ func (i *Ingester) Push(ctx context.Context, req *cortexpb.WriteRequest) (*corte
11681168
i.stoppedMtx.RUnlock()
11691169

11701170
if err := db.acquireAppendLock(); err != nil {
1171-
return &cortexpb.WriteResponse{}, httpgrpc.Errorf(http.StatusServiceUnavailable, wrapWithUser(err, userID).Error())
1171+
return &cortexpb.WriteResponse{}, httpgrpc.Errorf(http.StatusServiceUnavailable, "%s", wrapWithUser(err, userID).Error())
11721172
}
11731173
defer db.releaseAppendLock()
11741174

@@ -1506,7 +1506,7 @@ func (i *Ingester) Push(ctx context.Context, req *cortexpb.WriteRequest) (*corte
15061506
code = ve.code
15071507
}
15081508
level.Debug(logutil.WithContext(ctx, i.logger)).Log("msg", "partial failures to push", "totalSamples", succeededSamplesCount+failedSamplesCount, "failedSamples", failedSamplesCount, "totalHistograms", succeededHistogramsCount+failedHistogramsCount, "failedHistograms", failedHistogramsCount, "firstPartialErr", firstPartialErr)
1509-
return &cortexpb.WriteResponse{}, httpgrpc.Errorf(code, wrapWithUser(firstPartialErr, userID).Error())
1509+
return &cortexpb.WriteResponse{}, httpgrpc.Errorf(code, "%s", wrapWithUser(firstPartialErr, userID).Error())
15101510
}
15111511

15121512
return &cortexpb.WriteResponse{}, nil

pkg/ingester/ingester_test.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1316,7 +1316,7 @@ func TestIngester_Push(t *testing.T) {
13161316
},
13171317
cortexpb.API),
13181318
},
1319-
expectedErr: httpgrpc.Errorf(http.StatusBadRequest, wrapWithUser(wrappedTSDBIngestErr(storage.ErrOutOfOrderSample, model.Time(9), cortexpb.FromLabelsToLabelAdapters(metricLabels)), userID).Error()),
1319+
expectedErr: httpgrpc.Errorf(http.StatusBadRequest, "%s", wrapWithUser(wrappedTSDBIngestErr(storage.ErrOutOfOrderSample, model.Time(9), cortexpb.FromLabelsToLabelAdapters(metricLabels)), userID).Error()),
13201320
expectedIngested: []cortexpb.TimeSeries{
13211321
{Labels: metricLabelAdapters, Samples: []cortexpb.Sample{{Value: 2, TimestampMs: 10}}},
13221322
},
@@ -1384,7 +1384,7 @@ func TestIngester_Push(t *testing.T) {
13841384
},
13851385
cortexpb.API),
13861386
},
1387-
expectedErr: httpgrpc.Errorf(http.StatusBadRequest, wrapWithUser(wrappedTSDBIngestErr(storage.ErrOutOfBounds, model.Time(1575043969-(86400*1000)), cortexpb.FromLabelsToLabelAdapters(metricLabels)), userID).Error()),
1387+
expectedErr: httpgrpc.Errorf(http.StatusBadRequest, "%s", wrapWithUser(wrappedTSDBIngestErr(storage.ErrOutOfBounds, model.Time(1575043969-(86400*1000)), cortexpb.FromLabelsToLabelAdapters(metricLabels)), userID).Error()),
13881388
expectedIngested: []cortexpb.TimeSeries{
13891389
{Labels: metricLabelAdapters, Samples: []cortexpb.Sample{{Value: 2, TimestampMs: 1575043969}}},
13901390
},
@@ -1438,7 +1438,7 @@ func TestIngester_Push(t *testing.T) {
14381438
cortexpb.API),
14391439
},
14401440
oooTimeWindow: 5 * time.Minute,
1441-
expectedErr: httpgrpc.Errorf(http.StatusBadRequest, wrapWithUser(wrappedTSDBIngestErr(storage.ErrTooOldSample, model.Time(1575043969-(600*1000)), cortexpb.FromLabelsToLabelAdapters(metricLabels)), userID).Error()),
1441+
expectedErr: httpgrpc.Errorf(http.StatusBadRequest, "%s", wrapWithUser(wrappedTSDBIngestErr(storage.ErrTooOldSample, model.Time(1575043969-(600*1000)), cortexpb.FromLabelsToLabelAdapters(metricLabels)), userID).Error()),
14421442
expectedIngested: []cortexpb.TimeSeries{
14431443
{Labels: metricLabelAdapters, Samples: []cortexpb.Sample{{Value: 2, TimestampMs: 1575043969}}},
14441444
},
@@ -1534,7 +1534,7 @@ func TestIngester_Push(t *testing.T) {
15341534
},
15351535
oooTimeWindow: 5 * time.Minute,
15361536
enableOOONativeHistograms: false,
1537-
expectedErr: httpgrpc.Errorf(http.StatusBadRequest, wrapWithUser(wrappedTSDBIngestErr(storage.ErrOOONativeHistogramsDisabled, model.Time(1575043969-(10)), cortexpb.FromLabelsToLabelAdapters(metricLabels)), userID).Error()),
1537+
expectedErr: httpgrpc.Errorf(http.StatusBadRequest, "%s", wrapWithUser(wrappedTSDBIngestErr(storage.ErrOOONativeHistogramsDisabled, model.Time(1575043969-(10)), cortexpb.FromLabelsToLabelAdapters(metricLabels)), userID).Error()),
15381538
expectedIngested: []cortexpb.TimeSeries{
15391539
{Labels: metricLabelAdapters, Histograms: []cortexpb.Histogram{cortexpb.HistogramToHistogramProto(1575043969, tsdbutil.GenerateTestHistogram(1))}},
15401540
},
@@ -1593,7 +1593,7 @@ func TestIngester_Push(t *testing.T) {
15931593
},
15941594
oooTimeWindow: 5 * time.Minute,
15951595
enableOOONativeHistograms: true,
1596-
expectedErr: httpgrpc.Errorf(http.StatusBadRequest, wrapWithUser(wrappedTSDBIngestErr(storage.ErrTooOldSample, model.Time(1575043969-(600*1000)), cortexpb.FromLabelsToLabelAdapters(metricLabels)), userID).Error()),
1596+
expectedErr: httpgrpc.Errorf(http.StatusBadRequest, "%s", wrapWithUser(wrappedTSDBIngestErr(storage.ErrTooOldSample, model.Time(1575043969-(600*1000)), cortexpb.FromLabelsToLabelAdapters(metricLabels)), userID).Error()),
15971597
expectedIngested: []cortexpb.TimeSeries{
15981598
{Labels: metricLabelAdapters, Histograms: []cortexpb.Histogram{cortexpb.HistogramToHistogramProto(1575043969, tsdbutil.GenerateTestHistogram(1))}},
15991599
},
@@ -1712,7 +1712,7 @@ func TestIngester_Push(t *testing.T) {
17121712
nil,
17131713
cortexpb.API),
17141714
},
1715-
expectedErr: httpgrpc.Errorf(http.StatusBadRequest, wrapWithUser(wrappedTSDBIngestErr(storage.NewDuplicateFloatErr(1575043969, 2, 1), model.Time(1575043969), cortexpb.FromLabelsToLabelAdapters(metricLabels)), userID).Error()),
1715+
expectedErr: httpgrpc.Errorf(http.StatusBadRequest, "%s", wrapWithUser(wrappedTSDBIngestErr(storage.NewDuplicateFloatErr(1575043969, 2, 1), model.Time(1575043969), cortexpb.FromLabelsToLabelAdapters(metricLabels)), userID).Error()),
17161716
expectedIngested: []cortexpb.TimeSeries{
17171717
{Labels: metricLabelAdapters, Samples: []cortexpb.Sample{{Value: 2, TimestampMs: 1575043969}}},
17181718
},
@@ -1766,7 +1766,7 @@ func TestIngester_Push(t *testing.T) {
17661766
},
17671767
},
17681768
},
1769-
expectedErr: httpgrpc.Errorf(http.StatusBadRequest, wrapWithUser(wrappedTSDBIngestExemplarErr(errExemplarRef, model.Time(1000), cortexpb.FromLabelsToLabelAdapters(metricLabels), []cortexpb.LabelAdapter{{Name: "traceID", Value: "123"}}), userID).Error()),
1769+
expectedErr: httpgrpc.Errorf(http.StatusBadRequest, "%s", wrapWithUser(wrappedTSDBIngestExemplarErr(errExemplarRef, model.Time(1000), cortexpb.FromLabelsToLabelAdapters(metricLabels), []cortexpb.LabelAdapter{{Name: "traceID", Value: "123"}}), userID).Error()),
17701770
expectedIngested: nil,
17711771
expectedMetadataIngested: nil,
17721772
additionalMetrics: []string{
@@ -2260,7 +2260,7 @@ func TestIngester_PushNativeHistogramErrors(t *testing.T) {
22602260
req := cortexpb.ToWriteRequest([]labels.Labels{metricLabels}, nil, nil, tc.histograms, cortexpb.API)
22612261
// Push timeseries
22622262
_, err = i.Push(ctx, req)
2263-
assert.Equal(t, httpgrpc.Errorf(http.StatusBadRequest, wrapWithUser(wrappedTSDBIngestErr(tc.expectedErr, model.Time(10), metricLabelAdapters), userID).Error()), err)
2263+
assert.Equal(t, httpgrpc.Errorf(http.StatusBadRequest, "%s", wrapWithUser(wrappedTSDBIngestErr(tc.expectedErr, model.Time(10), metricLabelAdapters), userID).Error()), err)
22642264

22652265
require.Equal(t, testutil.ToFloat64(i.metrics.ingestedHistogramsFail), float64(1))
22662266
})
@@ -5557,7 +5557,7 @@ func TestIngesterPushErrorDuringForcedCompaction(t *testing.T) {
55575557
req, _ := mockWriteRequest(t, labels.Labels{{Name: labels.MetricName, Value: "test"}}, 0, util.TimeToMillis(time.Now()))
55585558
ctx := user.InjectOrgID(context.Background(), userID)
55595559
_, err = i.Push(ctx, req)
5560-
require.Equal(t, httpgrpc.Errorf(http.StatusServiceUnavailable, wrapWithUser(errors.New("forced compaction in progress"), userID).Error()), err)
5560+
require.Equal(t, httpgrpc.Errorf(http.StatusServiceUnavailable, "%s", wrapWithUser(errors.New("forced compaction in progress"), userID).Error()), err)
55615561

55625562
// Ingestion is successful after a flush.
55635563
require.True(t, db.casState(forceCompacting, active))

pkg/querier/tripperware/instantquery/instant_query.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ func (instantQueryCodec) DecodeResponse(ctx context.Context, r *http.Response, _
106106
return nil, err
107107
}
108108
if r.StatusCode/100 != 2 {
109-
return nil, httpgrpc.Errorf(r.StatusCode, string(buf))
109+
return nil, httpgrpc.Errorf(r.StatusCode, "%s", string(buf))
110110
}
111111

112112
var resp tripperware.PrometheusResponse

pkg/querier/tripperware/instantquery/limits.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ func (l limitsMiddleware) Do(ctx context.Context, r tripperware.Request) (trippe
4040

4141
tenantIDs, err := tenant.TenantIDs(ctx)
4242
if err != nil {
43-
return nil, httpgrpc.Errorf(http.StatusBadRequest, err.Error())
43+
return nil, httpgrpc.Errorf(http.StatusBadRequest, "%s", err.Error())
4444
}
4545

4646
// Enforce the max query length.
4747
if maxQueryLength := validation.SmallestPositiveNonZeroDurationPerTenant(tenantIDs, l.MaxQueryLength); maxQueryLength > 0 {
4848
expr, err := parser.ParseExpr(r.GetQuery())
4949
if err != nil {
50-
return nil, httpgrpc.Errorf(http.StatusBadRequest, err.Error())
50+
return nil, httpgrpc.Errorf(http.StatusBadRequest, "%s", err.Error())
5151
}
5252

5353
// Enforce query length across all selectors in the query.

pkg/querier/tripperware/instantquery/limits_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func TestLimitsMiddleware_MaxQueryLength(t *testing.T) {
3737
"even though failed to parse expression, should return no error since request will pass to next middleware": {
3838
query: `up[`,
3939
maxQueryLength: thirtyDays,
40-
expectedErr: httpgrpc.Errorf(http.StatusBadRequest, parserErr.Error()).Error(),
40+
expectedErr: httpgrpc.Errorf(http.StatusBadRequest, "%s", parserErr.Error()).Error(),
4141
},
4242
"should succeed on a query not exceeding time range": {
4343
query: `up`,

0 commit comments

Comments
 (0)