Skip to content

Add option to specify Golang default version#911

Merged
openshift-merge-bot[bot] merged 3 commits intoopenshift-knative:mainfrom
creydr:add-golang-version-default
Mar 3, 2026
Merged

Add option to specify Golang default version#911
openshift-merge-bot[bot] merged 3 commits intoopenshift-knative:mainfrom
creydr:add-golang-version-default

Conversation

@creydr
Copy link
Copy Markdown
Collaborator

@creydr creydr commented Mar 2, 2026

Currently the Go version for the dockerfiles is parsed from the go.mod file. This can lead to issues, when different components for a specific SO version lack behind (e.g. eventing is on 1.23, while SO requires through some dependencies 1.25, would lead to build issues for eventing).

This PR addresses it and allows to specify the default Golang version through the config files. It has the following order:

  1. component specific version setting per branch (by setting for a component & branch e.g. in config/eventing.yaml) --> allows to override in specific cases
  2. SO version specific version setting (by setting by branch in config/serverless-operator.yaml) -> should be the default to align all component versions for a SO release
  3. Version in go.mod from component --> fallback

Comment thread pkg/dockerfilegen/generator.go Outdated
// If no repo-branch specific config is set, it uses the one from the coresponding SO branch config.
// If SO does not have a default go version in it's config neither it uses the go version from the
// repositories go.mod file.
func goVersion(goModGoVersion string, metadata *project.Metadata) (string, error) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'd consider returning (*string, error) and then work with nil, nil return in the generator to avoid additional input variable goModGoVersion string.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

EOD it isn't simplifying a whole lot, so no hard opinion either way.

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.

👍 updated it

Comment thread pkg/dockerfilegen/generator.go Outdated
@dsimansk
Copy link
Copy Markdown
Contributor

dsimansk commented Mar 2, 2026

/approve
/lgtm

if comments need to be addressed
/hold

@openshift-ci openshift-ci Bot removed the lgtm label Mar 3, 2026
@creydr creydr requested a review from dsimansk March 3, 2026 06:46
@creydr
Copy link
Copy Markdown
Collaborator Author

creydr commented Mar 3, 2026

/unhold
as review is addressed

@dsimansk
Copy link
Copy Markdown
Contributor

dsimansk commented Mar 3, 2026

/approve
/lgtm

@openshift-ci openshift-ci Bot added the lgtm label Mar 3, 2026
@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented Mar 3, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: creydr, dsimansk

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot openshift-merge-bot Bot merged commit df6334f into openshift-knative:main Mar 3, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants