Skip to content

chore(agent): build with Go 1.27 (MK8S-470) - #38

Open
ezekiel-alexrod wants to merge 3 commits into
mainfrom
chore/MK8S-470-go-1.27
Open

ezekiel-alexrod wants to merge 3 commits into
mainfrom
chore/MK8S-470-go-1.27

Conversation

@ezekiel-alexrod

@ezekiel-alexrod ezekiel-alexrod commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator

Component

agent, docs

Problem

Renovate bumps the go directive to 1.27.2 in #14, but its CI can't pass. The image still builds with golang:1.26 (go.mod requires go >= 1.27.2), and Go 1.27 makes the modernize linter flag every struct literal that names an embedded type. #14 came without the Dockerfile because Renovate dates a Docker tag by its last push: the official golang tags are pushed again at each rebuild, so they stay younger than our 7-day minimumReleaseAge.

Fix

Three commits, each one reads on its own. The second is mechanical, a quick scroll is enough.

  • go 1.27.2 in agent/go.mod. CI and the RPM build already read go-version-file. The docs now point to agent/go.mod instead of repeating a version.
  • Go 1.27 lets a struct literal set a promoted field directly (&corev1.Node{Name: n}). Fixed with golangci-lint --fix, no behaviour change.
  • The builder and devcontainer images are pinned by digest (golang:1.27@sha256), like the other platform repos. With scality/platform-renovate#47, the image no longer waits the 7-day delay, so the next bump moves go.mod, the Dockerfile and the devcontainer in one renovate/golang PR: the image first, the directive a week later. Nothing Renovate-specific stays in this repo.
  • The Dockerfile uses the BASE_IMAGE form of the kubebuilder v4.16 scaffold, so the next kubebuilder update has less to merge.

Better merged after scality/platform-renovate#47: before it, the next Go bump still leaves the images behind, as #14 did. Once merged, Renovate closes #14 by itself.

Test

Check Result
make -C agent lint, Go 1.27.2 0 issues
make -C agent test, Go 1.27.2 OK, tree clean afterwards
make -C agent docker-build, kustomize build config/default OK
same code with go 1.26.0 and Go 1.26.9 refused: unknown field Name in struct literal, as expected
make -C agent test-e2e on kind, image built from golang:1.27@sha256 (Go 1.27.3) 6/6 specs passed
renovate --platform=local --dry-run=lookup (44.167.7) with the preset of scality/platform-renovate#47 on an older digest: digest update right away, directive 1.27.3 pending its delay, both in renovate/golang

Out of scope

  • The // +build lines in test/e2e: make lint doesn't build that tag.
  • The go directive follows patch releases (rangeStrategy: bump in platform-renovate).

Relates-to: MK8S-470

Renovate bumps the go directive to 1.27.2 in #14, but the image still
builds with golang:1.26 and fails with "go.mod requires go >= 1.27.2".
The devcontainer and the docs move along.

Refs: MK8S-470
Go 1.27 lets a composite literal set a promoted field directly, and
the modernize embedlit check flags every literal that still names the
embedded type (ObjectMeta, NamespacedName, Descriptor). Applied with
golangci-lint --fix, no behaviour change.

Refs: MK8S-470
Comment thread .github/renovate.json5

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, it fits better there: scality/platform-renovate#47. I tested it with a local Renovate dry-run: a full golang:x.y.z tag without a digest is looked up as a Go release, so go.mod, the Dockerfile and the devcontainer land in one renovate/golang branch, with no annotation in the repo. Floating and digest-pinned tags keep the Docker lookup. I dropped the Renovate config from this PR, it only keeps the full tags now.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small comments

Comment thread agent/.devcontainer/devcontainer.json Outdated
{
"name": "Kubebuilder DevContainer",
"image": "golang:1.27",
"image": "golang:1.27.2",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing renovate annotations

Comment thread agent/Dockerfile Outdated
FROM golang:1.27 AS builder
# Override BASE_IMAGE to build from another registry, e.g.
# docker.io/library/golang:<the Go version of go.mod>
ARG BASE_IMAGE=golang:1.27.2

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

@ezekiel-alexrod

Copy link
Copy Markdown
Collaborator Author

@anthony-treuillier-scality the images moved from golang:1.27.2 to golang:1.27@sha256, to match the rework of scality/platform-renovate#47. Only the last commit changed; the e2e still passes locally with it. Could you have another look?

Comment thread agent/Dockerfile Outdated
The builder and devcontainer images use golang:1.27@sha256, like the
other platform repos. The tag follows the Go minor, the digest brings
each Go patch, and Renovate bumps both in the golang group, together
with the go directive.

Renovate dates a Docker tag by its last push, and the official golang
images are rebuilt about once a week, so with a 7-day delay the image
missed that group and #14 came without the Dockerfile.
platform-renovate drops the delay for the golang image: the image goes
first, and the directive, which keeps its delay, joins the same PR.

The Dockerfile uses the BASE_IMAGE form of the kubebuilder v4.16
scaffold, so the next kubebuilder update has less to merge.

Refs: MK8S-470
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants