Skip to content

Commit f284cc8

Browse files
authored
uplift(Go): version from 1.23 to 1.24 (#148)
- Go 1.23 is EOL - fix linter: usetesting context.Background() - context.Background() create independent context but this is causing lint error but this wont have rate limit - t.Context() is shared by all testscases in the same test, this could cause rate limit by the client esp when many run in parallel. to add a 30seconds as a workaround to mitigate rate limit issue. - uplift setup-go to use v5.5.0 across all workflow and use go.mod for Go version ~~DO NOT MERGE TILL #139 IS IN FIRST~~ Approved-by: rhdedgar
1 parent 7751adc commit f284cc8

16 files changed

+49
-60
lines changed

.github/workflows/build-image.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ jobs:
1313
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main'
1414
runs-on: ubuntu-24.04
1515
steps:
16-
- name: Set up Go 1.23
17-
uses: actions/setup-go@be3c94b385c4f180051c996d336f57a34c397495 # v3.6.1
16+
- name: Set up Go 1.24
17+
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
1818
with:
19-
go-version: '1.23'
19+
go-version-file: go.mod
2020

2121
- name: Checkout code
2222
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0

.github/workflows/code-coverage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Set up Go
1616
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
1717
with:
18-
go-version: '1.21'
18+
go-version-file: go.mod
1919

2020
- name: Set up limgo
2121
uses: GoTestTools/limgo-action@d4a725a46ab3bdbbf23186bbbe54b4ff4a35d5a7 # v1.0.2

.github/workflows/generate-release.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ permissions:
1919
env:
2020
GIT_USER_NAME: github-actions[bot]
2121
GIT_USER_EMAIL: github-actions[bot]@users.noreply.github.com
22-
GO_VERSION: '1.23'
2322

2423
jobs:
2524
generate-release:
@@ -91,9 +90,9 @@ jobs:
9190
fi
9291
9392
- name: Set up Go
94-
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5
93+
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 #v 5.5.0
9594
with:
96-
go-version: ${{ env.GO_VERSION }}
95+
go-version-file: go.mod
9796

9897
- name: Prepare release files
9998
shell: bash
@@ -244,9 +243,9 @@ jobs:
244243
GH_TOKEN: ${{ github.token }}
245244

246245
- name: Set up Go
247-
uses: actions/setup-go@a26af69be951a213d495a4c3e4e4022e16d87065
246+
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
248247
with:
249-
go-version: ${{ env.GO_VERSION }}
248+
go-version-file: go.mod
250249

251250
- name: Build release image
252251
shell: bash

.github/workflows/release-image.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ jobs:
2020
build-release-image:
2121
runs-on: ubuntu-24.04
2222
steps:
23-
- name: Set up Go 1.23
24-
uses: actions/setup-go@be3c94b385c4f180051c996d336f57a34c397495 # v3.6.1
23+
- name: Set up Go 1.24
24+
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
2525
with:
26-
go-version: '1.23'
26+
go-version-file: go.mod
2727

2828
- name: Checkout code
2929
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0

.github/workflows/run-e2e-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Set up Go
1616
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
1717
with:
18-
go-version: '1.21'
18+
go-version-file: go.mod
1919

2020
- name: Set up Docker Buildx
2121
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Build the manager binary
2-
ARG GOLANG_VERSION=1.23
2+
ARG GOLANG_VERSION=1.24
33

4-
FROM registry.access.redhat.com/ubi8/go-toolset:${GOLANG_VERSION} as builder
4+
FROM registry.access.redhat.com/ubi9/go-toolset:${GOLANG_VERSION} as builder
55
ARG TARGETOS=linux
66
ARG TARGETARCH
77
ARG CGO_ENABLED=1

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,11 @@ test-e2e: ## Run e2e tests
151151
GOLANGCI_LINT_TIMEOUT ?= 5m0s
152152
.PHONY: lint
153153
lint: golangci-lint ## Run golangci-lint against code.
154-
$(GOLANGCI_LINT) run --timeout=$(GOLANGCI_LINT_TIMEOUT) --sort-results
154+
$(GOLANGCI_LINT) run --timeout=$(GOLANGCI_LINT_TIMEOUT)
155155

156156
.PHONY: lint-fix
157157
lint-fix: golangci-lint ## Run golangci-lint fix against code.
158-
$(GOLANGCI_LINT) run --fix --sort-results
158+
$(GOLANGCI_LINT) run --fix
159159

160160
##@ Build
161161

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ kubectl apply -f config/samples/example-with-configmap.yaml
109109
### Prerequisites
110110

111111
- Kubernetes cluster (v1.20 or later)
112-
- Go version **go1.23**
112+
- Go version **go1.24**
113113
- operator-sdk **v1.39.2** (v4 layout) or newer
114114
- kubectl configured to access your cluster
115115
- A running inference server:

controllers/llamastackdistribution_controller_test.go

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package controllers_test
22

33
import (
4-
"context"
54
"encoding/json"
65
"fmt"
76
"io"
@@ -111,9 +110,9 @@ func TestStorageConfiguration(t *testing.T) {
111110

112111
// arrange
113112
instance := tt.buildInstance(namespace.Name)
114-
require.NoError(t, k8sClient.Create(context.Background(), instance))
113+
require.NoError(t, k8sClient.Create(t.Context(), instance))
115114
t.Cleanup(func() {
116-
if err := k8sClient.Delete(context.Background(), instance); err != nil && !apierrors.IsNotFound(err) {
115+
if err := k8sClient.Delete(t.Context(), instance); err != nil && !apierrors.IsNotFound(err) {
117116
t.Logf("Failed to delete LlamaStackDistribution instance %s/%s: %v", instance.Namespace, instance.Name, err)
118117
}
119118
})
@@ -179,15 +178,15 @@ server:
179178
port: 8321`,
180179
},
181180
}
182-
require.NoError(t, k8sClient.Create(context.Background(), configMap))
181+
require.NoError(t, k8sClient.Create(t.Context(), configMap))
183182

184183
// Create a LlamaStackDistribution that references the ConfigMap
185184
instance := NewDistributionBuilder().
186185
WithName("test-configmap-reference").
187186
WithNamespace(namespace.Name).
188187
WithUserConfig(configMap.Name).
189188
Build()
190-
require.NoError(t, k8sClient.Create(context.Background(), instance))
189+
require.NoError(t, k8sClient.Create(t.Context(), instance))
191190

192191
// Reconcile to create initial deployment
193192
ReconcileDistribution(t, instance, false)
@@ -204,7 +203,7 @@ server:
204203
require.NotEmpty(t, initialHash, "ConfigMap hash should not be empty")
205204

206205
// Update the ConfigMap data
207-
require.NoError(t, k8sClient.Get(context.Background(),
206+
require.NoError(t, k8sClient.Get(t.Context(),
208207
types.NamespacedName{Name: configMap.Name, Namespace: configMap.Namespace}, configMap))
209208

210209
configMap.Data["run.yaml"] = `version: '2'
@@ -223,7 +222,7 @@ models:
223222
model_type: llm
224223
server:
225224
port: 8321`
226-
require.NoError(t, k8sClient.Update(context.Background(), configMap))
225+
require.NoError(t, k8sClient.Update(t.Context(), configMap))
227226

228227
// Wait a moment for the watch to trigger
229228
time.Sleep(2 * time.Second)
@@ -250,7 +249,7 @@ server:
250249
"some-key": "some-value",
251250
},
252251
}
253-
require.NoError(t, k8sClient.Create(context.Background(), unrelatedConfigMap))
252+
require.NoError(t, k8sClient.Create(t.Context(), unrelatedConfigMap))
254253

255254
// Note: In test environment, field indexer might not be set up properly,
256255
// so we skip the isConfigMapReferenced checks which rely on field indexing
@@ -284,7 +283,7 @@ func TestReconcile(t *testing.T) {
284283
WithDistribution("starter").
285284
WithPort(instancePort).
286285
Build()
287-
require.NoError(t, k8sClient.Create(context.Background(), instance))
286+
require.NoError(t, k8sClient.Create(t.Context(), instance))
288287

289288
// --- act ---
290289
ReconcileDistribution(t, instance, true)
@@ -399,7 +398,7 @@ func TestLlamaStackProviderAndVersionInfo(t *testing.T) {
399398
WithName("test-status-instance").
400399
WithNamespace(namespace.Name).
401400
Build()
402-
require.NoError(t, k8sClient.Create(context.Background(), instance))
401+
require.NoError(t, k8sClient.Create(t.Context(), instance))
403402

404403
testClusterInfo := &cluster.ClusterInfo{
405404
DistributionImages: map[string]string{
@@ -417,7 +416,7 @@ func TestLlamaStackProviderAndVersionInfo(t *testing.T) {
417416

418417
// act (part 1)
419418
// run the first reconciliation to create the initial resources like the deployment
420-
_, err := reconciler.Reconcile(context.Background(), ctrl.Request{
419+
_, err := reconciler.Reconcile(t.Context(), ctrl.Request{
421420
NamespacedName: types.NamespacedName{Name: instance.Name, Namespace: instance.Namespace},
422421
})
423422
require.NoError(t, err)
@@ -430,11 +429,11 @@ func TestLlamaStackProviderAndVersionInfo(t *testing.T) {
430429

431430
deployment.Status.ReadyReplicas = 1
432431
deployment.Status.Replicas = 1
433-
require.NoError(t, k8sClient.Status().Update(context.Background(), deployment))
432+
require.NoError(t, k8sClient.Status().Update(t.Context(), deployment))
434433

435434
// act (part 2)
436435
// run the second reconciliation to trigger the status update logic
437-
_, err = reconciler.Reconcile(context.Background(), ctrl.Request{
436+
_, err = reconciler.Reconcile(t.Context(), ctrl.Request{
438437
NamespacedName: types.NamespacedName{Name: instance.Name, Namespace: instance.Namespace},
439438
})
440439
require.NoError(t, err)
@@ -492,8 +491,8 @@ func TestNetworkPolicyConfiguration(t *testing.T) {
492491
WithNamespace(namespace.Name).
493492
WithDistribution("starter").
494493
Build()
495-
require.NoError(t, k8sClient.Create(context.Background(), instance))
496-
t.Cleanup(func() { _ = k8sClient.Delete(context.Background(), instance) })
494+
require.NoError(t, k8sClient.Create(t.Context(), instance))
495+
t.Cleanup(func() { _ = k8sClient.Delete(t.Context(), instance) })
497496

498497
// preconditions for this scenario
499498
tt.setup(t, instance)

controllers/resource_helper_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ limitations under the License.
1717
package controllers
1818

1919
import (
20-
"context"
2120
"strings"
2221
"testing"
2322

@@ -183,7 +182,7 @@ func TestBuildContainerSpec(t *testing.T) {
183182

184183
for _, tc := range testCases {
185184
t.Run(tc.name, func(t *testing.T) {
186-
result := buildContainerSpec(context.Background(), nil, tc.instance, tc.image)
185+
result := buildContainerSpec(t.Context(), nil, tc.instance, tc.image)
187186
assert.Equal(t, tc.expectedResult.Name, result.Name)
188187
assert.Equal(t, tc.expectedResult.Image, result.Image)
189188
assert.Equal(t, tc.expectedResult.Ports, result.Ports)
@@ -275,7 +274,7 @@ func TestConfigurePodStorage(t *testing.T) {
275274

276275
for _, tc := range testCases {
277276
t.Run(tc.name, func(t *testing.T) {
278-
result := configurePodStorage(context.Background(), nil, tc.instance, tc.container)
277+
result := configurePodStorage(t.Context(), nil, tc.instance, tc.container)
279278

280279
// Verify container was added.
281280
assert.Len(t, result.Containers, 1)

0 commit comments

Comments
 (0)