← Back to Pull requests

[CI] Upgrade Go version compatibility baseline to 1.27 (#5178) #5188

Open
zhuangzhewei09 opened this pull request with 287 lines diff across 40 files
View on GitHub
zhuangzhewei09 zhuangzhewei09 commented on Aug 22, 2026 10:43 UTC
Author

<!-- Thank you for your contribution! -->

Why are these changes needed?

This change aligns the Kuberay repository with Go 1.27 after recent CI and build-tooling compatibility differences. It updates Go toolchain declarations, build/test images, and lint/tooling references to keep CI and local workflows consistent and avoid version drift between components.

Related issue number

Closes #5178

Labels

<!-- Please add the appropriate labels to this PR. -->

  • If this PR has user-facing changes that require documentation updates at release time, I have added the doc-updates-required label.

  • If this PR contains breaking changes, I have added the breaking-change label.
  • Checks

  • I've made sure the tests are passing.

  • Testing Strategy

  • - [ ] Unit tests
    - [ ] Manual tests
    - [x] This PR is not tested :(

    Diff: 287 lines (+134 / -153) across 40 files Reviewer: win5923 Review duration: 62184m
    All Vouch review confidence checks passed
    Residual risk 0.09 = Change Risk (0.72) × (1 − Review Confidence (0.88)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.72 · 287 lines diff across 40 files
    0.72
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.89 · 5 substantive comment(s)
    0.89
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 50%
    88%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.339
    Mass File Touch mass_file_touch
    0.080
    Real PR Conversation Timeline
    23 items
    machichima machichima commented on code on Aug 24, 2026 02:59 UTC
    Code Review
    .golangci.yml:1
    @@ -85,6 +85,9 @@ linters:
                 - '**/kubectl-plugin/pkg/util/*.go'
         modernize:
           disable:
    +        # Go 1.27's embedlit analyzer rewrites a large part of the existing codebase.
    +        # Keep this version upgrade focused; enable it in a dedicated cleanup.
    +        - embedlit

    Could you please open an issue to track this?

    machichima machichima commented on Aug 24, 2026 03:30 UTC
    Contributor

    I'm not sure if we are going to upgrade to go 1.27 that early, as projects that uses KubeRay (e.g. Kueue) are still in go 1.26. Should we wait for them to upgrade before we do so?

    cc @dentiny WDYT?

    dentiny dentiny commented on Aug 24, 2026 21:48 UTC
    Contributor

    I'm not sure if we are going to upgrade to go 1.27 that early

    v1.27 is already the stable release, instead of rc-release, or alpha/beta stage, I'm not sure why you think it's early stage?
    Do we meet any blocks, or if there's anything you think it unreasonable?
    Do you think these blockers will be addressed later if we defer upgrade?

    as projects that uses KubeRay (e.g. Kueue) are still in go 1.26. Should we wait for them to upgrade before we do so?

    I'm not sure all dependencies are well-maintained and will upgrade to latest version even. I'd like to keep updated to stable release.

    In terms of kueue, as a separate topic, I could take a look and see if I could make an upgrade.

    machichima machichima commented on Aug 25, 2026 02:37 UTC
    Contributor

    I'm not sure why you think it's early stage? Do we meet any blocks, or if there's anything you think it unreasonable? Do you think these blockers will be addressed later if we defer upgrade?

    No hard blocker, my concern was about downstream propagation. Based on https://go.dev/doc/toolchain#config

    A module’s go line must declare a version greater than or equal to the go version declared by each of the modules listed in require statements. A workspace’s go line must declare a version greater than or equal to the go version declared by each of the modules listed in use statements.

    For example, if module M requires a dependency D with a go.mod that declares go 1.22.0, then M’s go.mod cannot say go 1.21.3.

    If we upgrade to go 1.27, it will force all project that use kuberay as dependency to also upgrade to 1.27 to use newer KubeRay version. After second thought, I think it should be fine, as projects like Kueue follow new Go versions closely. Slower consumers can simply stay on older KubeRay releases.

    machichima machichima commented on Aug 25, 2026 02:37 UTC
    Contributor

    @chacha923 Please fix the CI failure

    cursor[bot] cursor[bot] commented on code on Aug 25, 2026 04:42 UTC
    Code Review
    historyserver/Makefile:1
    @@ -159,7 +154,7 @@ todolist: install-golint ## Run go lint against code.
     
     install-golint: ## check golint if not exist install golint tools
     ifneq ("$(wildcard $(GOBIN_GOLANGCILINT))","")
    -ifeq ($(shell $(GOBIN_GOLANGCILINT) version --format short), $(GOLANGCILINT_VERSION))
    +ifeq ($(shell $(GOBIN_GOLANGCILINT) version --short), $(patsubst v%,%,$(GOLANGCILINT_VERSION)))

    Broken golangci-lint version check

    Low Severity

    <!-- DESCRIPTION START -->
    The version comparison now strips the leading v from GOLANGCILINT_VERSION while still installing via go install, which reports a version that keeps the v prefix. The version --short rename alone should not change that format, so the check no longer matches and install-golint reinstalls on every run.
    <!-- DESCRIPTION END -->

    <!-- BUGBOT_BUG_ID: 8dc3fb4a-213f-464c-b341-345a655cc4d8 -->

    <!-- LOCATIONS START
    historyserver/Makefile#L156-L157
    LOCATIONS END -->
    <div><a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9DVVJTT1IiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OjI5MzZlOTg1LTQ1YjAtNDhjYS1hYWMwLTRiNDIzYjg5NzBkMyIsImVuY3J5cHRpb25LZXkiOiJqSEQyLW5ZWXByYkJ0a3o4dU0ta1JVVGYtR0hKQlVfaVRNdHJFZVFWb1pjIiwiYnJhbmNoIjoiY2kvdXBncmFkZS1nby0xLTI3IiwicmVwb093bmVyIjoicmF5LXByb2plY3QiLCJyZXBvTmFtZSI6Imt1YmVyYXkiLCJwcm92aWRlciI6ImdpdGh1YiJ9fQ" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-cursor-light.png"><img alt="Fix in Cursor" width="115" height="28" src="https://cursor.com/assets/images/fix-in-cursor-dark.png"></picture></a>&nbsp;<a href="https://cursor.com/agents?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9XRUIiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OjI5MzZlOTg1LTQ1YjAtNDhjYS1hYWMwLTRiNDIzYjg5NzBkMyIsImVuY3J5cHRpb25LZXkiOiJqSEQyLW5ZWXByYkJ0a3o4dU0ta1JVVGYtR0hKQlVfaVRNdHJFZVFWb1pjIiwiYnJhbmNoIjoiY2kvdXBncmFkZS1nby0xLTI3IiwicmVwb093bmVyIjoicmF5LXByb2plY3QiLCJyZXBvTmFtZSI6Imt1YmVyYXkiLCJwck51bWJlciI6NTE4OCwiY29tbWl0U2hhIjoiOTVkMzIzMzFlNjkyMTc4NTU3NDZkNTY2MzNhMTQ0M2UzNWE3MTUwNiIsInByb3ZpZGVyIjoiZ2l0aHViIn19" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-web-light.png"><img alt="Fix in Web" width="99" height="28" src="https://cursor.com/assets/images/fix-in-web-dark.png"></picture></a></div>

    <sup>Reviewed by Cursor Bugbot for commit 95d32331e69217855746d56633a1443e35a71506. Configure here.</sup>

    zhuangzhewei09 zhuangzhewei09 commented on code on Aug 25, 2026 04:49 UTC
    Code Review
    .golangci.yml:1
    @@ -85,6 +85,9 @@ linters:
                 - '**/kubectl-plugin/pkg/util/*.go'
         modernize:
           disable:
    +        # Go 1.27's embedlit analyzer rewrites a large part of the existing codebase.
    +        # Keep this version upgrade focused; enable it in a dedicated cleanup.
    +        - embedlit

    Could you please open an issue to track this?

    Sure. I’ll keep the Go 1.27 upgrade scoped to the current issue. Once the repository has been upgraded to Go 1.27, I’ll open a follow-up issue to track the embedlit cleanup and re-enable the analyzer.

    zhuangzhewei09 zhuangzhewei09 commented on code on Aug 26, 2026 06:03 UTC
    Code Review
    historyserver/Makefile:1
    @@ -159,7 +154,7 @@ todolist: install-golint ## Run go lint against code.
     
     install-golint: ## check golint if not exist install golint tools
     ifneq ("$(wildcard $(GOBIN_GOLANGCILINT))","")
    -ifeq ($(shell $(GOBIN_GOLANGCILINT) version --format short), $(GOLANGCILINT_VERSION))
    +ifeq ($(shell $(GOBIN_GOLANGCILINT) version --short), $(patsubst v%,%,$(GOLANGCILINT_VERSION)))

    With golangci-lint v2.13.1, version --short outputs 2.13.1 without the leading v. The patsubst normalizes v2.13.1 to the same format. I also verified that the Makefile takes the “version match” branch and does not reinstall the binary.

    zhuangzhewei09 zhuangzhewei09 commented on Aug 27, 2026 07:42 UTC
    Author

    @chacha923 Please fix the CI failure

    @machichima Build historyserver is failing in TestShutdown_DrainsRetriedTasks. The same failure has also occurred in #5018, #5126, and #5190, so it does not appear specific to this Go 1.27 change. I don’t have permission to rerun the job. Could you please help rerun it?

    win5923 win5923 commented on code on Aug 27, 2026 16:06 UTC
    Code Review
    apiserver/cmd/main.go:1
    @@ -230,7 +230,7 @@ func serveSwaggerFile(w http.ResponseWriter, r *http.Request) {
     		return
     	}
     
    -	p := strings.TrimPrefix(r.URL.Path, "/swagger/")
    +	p := path.Base(r.URL.Path)

    Just curious, what's the reason for changing this?

    win5923 win5923 commented on code on Aug 27, 2026 16:14 UTC
    Code Review
    apiserversdk/Makefile:1
    @@ -22,17 +22,12 @@ vet: ## Run go vet against code.
     
     .PHONY: golangci-lint
     golangci-lint: ## Download golangci_lint locally if necessary.
    -	test -s $(GOLANGCI_LINT) || (curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | bash -s -- -b $(REPO_ROOT_BIN)/ $(GOLANGCI_LINT_VERSION))
    +	test -s $(GOLANGCI_LINT) || (GOBIN=$(REPO_ROOT_BIN) go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION))

    Why change to go install?

    I saw the doc said:

    Using go install/go get, “tools pattern”, and tool command/directives installations aren’t guaranteed to work.

    We recommend using binary installation.

    https://golangci-lint.run/docs/welcome/install/local/#install-from-sources

    zhuangzhewei09 zhuangzhewei09 commented on code on Aug 28, 2026 04:16 UTC
    Code Review
    apiserver/cmd/main.go:1
    @@ -230,7 +230,7 @@ func serveSwaggerFile(w http.ResponseWriter, r *http.Request) {
     		return
     	}
     
    -	p := strings.TrimPrefix(r.URL.Path, "/swagger/")
    +	p := path.Base(r.URL.Path)

    Just curious, what's the reason for changing this?

    This was required by the updated gosec check, which reported G703 because a request-derived path was passed to http.ServeFile. This handler only needs the Swagger filename, so path.Base preserves valid requests while preventing path components from reaching the local file path.

    zhuangzhewei09 zhuangzhewei09 commented on code on Aug 28, 2026 04:16 UTC
    Code Review
    apiserversdk/Makefile:1
    @@ -22,17 +22,12 @@ vet: ## Run go vet against code.
     
     .PHONY: golangci-lint
     golangci-lint: ## Download golangci_lint locally if necessary.
    -	test -s $(GOLANGCI_LINT) || (curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | bash -s -- -b $(REPO_ROOT_BIN)/ $(GOLANGCI_LINT_VERSION))
    +	test -s $(GOLANGCI_LINT) || (GOBIN=$(REPO_ROOT_BIN) go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION))

    Why change to go install?

    > I saw the doc said:

    > > Using go install/go get, “tools pattern”, and tool command/directives installations aren’t guaranteed to work.

    > We recommend using binary installation.

    > https://golangci-lint.run/docs/welcome/install/local/#install-from-sources

    The existing binary installer failed in CI while installing v2.13.1 due to a checksum mismatch, so go install was used as a workaround. However, you’re right that upstream recommends binary installation. I’ll restore the documented binary installation method instead of keeping the source installation.

    win5923 win5923 commented on code on Aug 28, 2026 07:07 UTC
    Code Review
    apiserver/cmd/main.go:1
    @@ -230,7 +230,7 @@ func serveSwaggerFile(w http.ResponseWriter, r *http.Request) {
     		return
     	}
     
    -	p := strings.TrimPrefix(r.URL.Path, "/swagger/")
    +	p := path.Base(r.URL.Path)

    Thanks!

    win5923 win5923 commented on code on Aug 28, 2026 07:15 UTC
    Code Review
    apiserversdk/Makefile:1
    @@ -22,17 +22,12 @@ vet: ## Run go vet against code.
     
     .PHONY: golangci-lint
     golangci-lint: ## Download golangci_lint locally if necessary.
    -	test -s $(GOLANGCI_LINT) || (curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | bash -s -- -b $(REPO_ROOT_BIN)/ $(GOLANGCI_LINT_VERSION))
    +	test -s $(GOLANGCI_LINT) || (GOBIN=$(REPO_ROOT_BIN) go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION))

    This is related to https://github.com/golangci/golangci-lint/issues/6751.

    Should change to https://golangci-lint.run/install.sh instead.

    cursor[bot] cursor[bot] commented on code on Aug 28, 2026 10:45 UTC
    Code Review
    apiserver/Makefile:1
    @@ -260,7 +255,7 @@ MOCKGEN = $(REPO_ROOT_BIN)/mockgen
     KUSTOMIZE_VERSION ?= v5.4.3
     GOFUMPT_VERSION ?= v0.3.1
     GOIMPORTS_VERSION ?= v0.14.0
    -GOLANGCI_LINT_VERSION ?= v2.11.4
    +GOLANGCI_LINT_VERSION ?= v2.13.1

    Broken golangci-lint install URL remains

    Low Severity

    <!-- DESCRIPTION START -->
    GOLANGCI_LINT_VERSION is now v2.13.1, but apiserver still installs via the GitHub master install.sh. That installer hits the known checksum mismatch for v2.13.1, so a clean make golangci-lint or make dev-tools in apiserver fails. apiserversdk was switched to https://golangci-lint.run/install.sh, leaving the two Makefiles inconsistent.
    <!-- DESCRIPTION END -->

    <!-- BUGBOT_BUG_ID: da206d1b-922e-495f-9c51-89c7263394d7 -->

    <!-- LOCATIONS START
    apiserver/Makefile#L257-L258
    LOCATIONS END -->
    <div><a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9DVVJTT1IiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OmE3YzgzZDI0LTJmM2EtNDhlMy05NWI1LWFkNjlhYmQzYjVlMyIsImVuY3J5cHRpb25LZXkiOiJRY1hianhzZmZxLW50SXgxMDdDaC1teVNPQ05LS1otUTNWTGktWmNEb08wIiwiYnJhbmNoIjoiY2kvdXBncmFkZS1nby0xLTI3IiwicmVwb093bmVyIjoicmF5LXByb2plY3QiLCJyZXBvTmFtZSI6Imt1YmVyYXkiLCJwcm92aWRlciI6ImdpdGh1YiJ9fQ" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-cursor-light.png"><img alt="Fix in Cursor" width="115" height="28" src="https://cursor.com/assets/images/fix-in-cursor-dark.png"></picture></a>&nbsp;<a href="https://cursor.com/agents?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9XRUIiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OmE3YzgzZDI0LTJmM2EtNDhlMy05NWI1LWFkNjlhYmQzYjVlMyIsImVuY3J5cHRpb25LZXkiOiJRY1hianhzZmZxLW50SXgxMDdDaC1teVNPQ05LS1otUTNWTGktWmNEb08wIiwiYnJhbmNoIjoiY2kvdXBncmFkZS1nby0xLTI3IiwicmVwb093bmVyIjoicmF5LXByb2plY3QiLCJyZXBvTmFtZSI6Imt1YmVyYXkiLCJwck51bWJlciI6NTE4OCwiY29tbWl0U2hhIjoiMjFkOGQ0NGI4OTY1MjM0ZjQ0OTRkYzFkZDA2ZDEyMjA4NDI4OWI2NiIsInByb3ZpZGVyIjoiZ2l0aHViIn19" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-web-light.png"><img alt="Fix in Web" width="99" height="28" src="https://cursor.com/assets/images/fix-in-web-dark.png"></picture></a></div>

    <sup>Reviewed by Cursor Bugbot for commit 21d8d44b8965234f4494dc1dd06d122084289b66. Configure here.</sup>

    cursor[bot] cursor[bot] commented on Aug 28, 2026 10:45 UTC
    Reviewer

    <!-- BUGBOT_REVIEW -->
    Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

    There are 2 total unresolved issues (including 1 from previous review).

    <!-- BUGBOT_FIX_ALL -->
    <a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9BTExfSU5fQ1VSU09SIiwiZGF0YSI6eyJyZWRpc0tleSI6ImJ1Z2JvdC1tdWx0aTo4ZWI1NDgwZC1kNDM3LTRiYWItOTE2Yy0xNzg4OTRhZDMyZmYiLCJlbmNyeXB0aW9uS2V5IjoiOE16VDRibzdJZkFTbjZtc055MjB5Yk1pdGhsbUFkS2ZrbTVLTEdzSW9CNCIsImJyYW5jaCI6ImNpL3VwZ3JhZGUtZ28tMS0yNyIsInJlcG9Pd25lciI6InJheS1wcm9qZWN0IiwicmVwb05hbWUiOiJrdWJlcmF5IiwicHJvdmlkZXIiOiJnaXRodWIifX0" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-cursor-light.png"><img alt="Fix All in Cursor" width="115" height="28" src="https://cursor.com/assets/images/fix-in-cursor-dark.png"></picture></a>
    <!-- /BUGBOT_FIX_ALL -->

    <sup>Reviewed by Cursor Bugbot for commit 21d8d44b8965234f4494dc1dd06d122084289b66. Configure here.</sup>

    win5923 win5923 commented on code on Aug 31, 2026 17:55 UTC
    Code Review
    apiserver/Makefile:1
    @@ -260,7 +255,7 @@ MOCKGEN = $(REPO_ROOT_BIN)/mockgen
     KUSTOMIZE_VERSION ?= v5.4.3
     GOFUMPT_VERSION ?= v0.3.1
     GOIMPORTS_VERSION ?= v0.14.0
    -GOLANGCI_LINT_VERSION ?= v2.11.4
    +GOLANGCI_LINT_VERSION ?= v2.13.1

    @chacha923

    win5923 win5923 approved these changes on Sep 01, 2026 05:14 UTC
    Approved Reviewer

    Approved these changes.

    zhuangzhewei09 zhuangzhewei09 commented on Sep 16, 2026 07:06 UTC
    Author

    Hi @kevin85421, a gentle follow-up: CI is passing, the merge conflicts are resolved, and the embedlit cleanup is tracked in #5246. When you have a chance, could you please take a final look and help merge this PR if everything looks good? Thanks!

    machichima machichima commented on Sep 28, 2026 11:41 UTC
    Contributor

    Hi @zhuangzhewei09 ,
    Could you please fix the conflict? Thanks!
    This PR is on the list for final review from committers

    zhuangzhewei09 zhuangzhewei09 commented on Oct 01, 2026 15:58 UTC
    Author

    Hi @zhuangzhewei09 , Could you please fix the conflict? Thanks! This PR is on the list for final review from committers

    fix conflicted

    Reviewers
    Assignees
    zhuangzhewei09 zhuangzhewei09
    Labels
    risk: low confidence: 88.2% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 72.4% (HIGH) · Higher = larger blast radius
    72.4%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 88.2% · Lower = rushed or shallow review
    88.2%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 8.5% · Safe to merge
    8.5%