Skip to content

Add automated Go version update workflow and version schemas - #21

Open
mpryc wants to merge 2 commits into
medik8s:mainfrom
mpryc:automated-go-version-update
Open

Add automated Go version update workflow and version schemas#21
mpryc wants to merge 2 commits into
medik8s:mainfrom
mpryc:automated-go-version-update

Conversation

@mpryc

@mpryc mpryc commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a reusable GitHub Actions workflow and centralized Go version schemas
to automate Go version updates across all medik8s operator repos.

What's included

  • go-versions/ — flat YAML config files keyed by OCP version (ocp-4.19.yaml, ocp-4.20.yaml, ocp-4.21.yaml), each defining the Go minor version and CI operator image tag
  • .github/workflows/update-go-version.yaml — reusable workflow_call workflow that:
    1. Fetches the version schema from this repo
    2. Updates go.mod to the target Go minor version (e.g. go 1.25, not 1.25.0)
    3. Removes the toolchain directive (patch versions handled by CI builder image)
    4. Runs go mod tidy + go mod vendor (when vendor dir exists)
    5. Updates .ci-operator.yaml builder image tag
    6. Verifies make build passes
    7. Creates a PR via peter-evans/create-pull-request

Design principles

  • go.mod tracks minor version onlygo 1.25, not go 1.25.0
  • No toolchain directive — patch-level updates (1.25.x) are handled by updating the CI builder image, not go.mod
  • Zero external tool dependencies — uses only curl, grep, sed (pre-installed on GitHub runners)
  • Each operator repo adds a thin caller (~15 lines) referencing a version schema

Usage in operator repos

# .github/workflows/go-update.yaml
name: Go Version Update
on:
  schedule:
    - cron: '0 8 * * 1'
  workflow_dispatch:

jobs:
  update:
    uses: medik8s/.github/.github/workflows/update-go-version.yaml@main
    with:
      version-schema: ocp-4.21

Bumping Go for a new OCP release

  1. Add go-versions/ocp-X.Y.yaml to this repo
  2. Each operator updates their caller to reference the new schema
  3. Workflow creates PRs with all necessary changes (go.mod, vendor, CI config)

Test plan

  • Verify version schema parsing works (tested locally with grep/sed)
  • Merge this PR, then test operator caller workflows via workflow_dispatch
  • Verify dry-run mode shows expected changes without creating PRs

Summary by CodeRabbit

  • New Features

    • Added an automated workflow for updating Go versions and CI operator images across repositories.
    • Supports dry-run previews, dependency synchronization, build verification, and automatic pull request creation.
    • Added version schemas for OCP 4.19 through 4.22, including their corresponding Go versions and CI images.
  • Documentation

    • Added guidance for defining Go version schemas and using the automated update workflow.

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Review Change Stack

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c6f42110-9504-4cd3-9958-7f607b470f9b

📝 Walkthrough

Walkthrough

Adds reusable schema-driven automation for updating Go versions and CI operator images in operator repositories, with build verification, dry-run reporting, and optional pull request creation. Documents schemas and adds mappings for OCP 4.19 through 4.22.

Changes

Go version management

Layer / File(s) Summary
Go version schemas and usage contract
.github/workflows/update-go-version.yaml, go-versions/README.md, go-versions/ocp-4.19.yaml, go-versions/ocp-4.20.yaml, go-versions/ocp-4.21.yaml, go-versions/ocp-4.22.yaml
Documents the schema format and adds Go and CI operator image mappings for OCP 4.19 through 4.22.
Workflow input, detection, and updates
.github/workflows/update-go-version.yaml
Defines reusable workflow inputs, fetches schema values, compares repository configuration, updates go.mod and .ci-operator.yaml, and refreshes dependencies.
Verification and change delivery
.github/workflows/update-go-version.yaml
Detects changes, runs build verification, reports dry-run diffs, and opens a pull request when updates are present.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested reviewers: razo7, clobrano

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant UpdateWorkflow
  participant VersionSchema
  participant OperatorRepository
  participant PullRequestAction
  Caller->>UpdateWorkflow: Provide version-schema and dry-run
  UpdateWorkflow->>VersionSchema: Fetch Go and CI image values
  VersionSchema-->>UpdateWorkflow: Return schema configuration
  UpdateWorkflow->>OperatorRepository: Update repository configuration and dependencies
  OperatorRepository-->>UpdateWorkflow: Return build result and change status
  UpdateWorkflow->>PullRequestAction: Create pull request when changes exist
  PullRequestAction-->>OperatorRepository: Open update pull request
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: a reusable Go version update workflow plus centralized version schemas.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Add a reusable GitHub Actions workflow that operator repos can call to
automate Go version updates. Version schemas are defined as flat YAML
files in go-versions/, keyed by OCP release.

Design principles:
- go.mod tracks Go minor version only (e.g. "1.25", not "1.25.0")
- No toolchain directive — patch updates handled by CI builder image
- Each operator repo adds a thin caller workflow referencing a schema
- Workflow updates go.mod, .ci-operator.yaml, runs tidy/vendor, and
  creates a PR via peter-evans/create-pull-request
- Uses only pre-installed runner tools (curl, grep, sed) — no yq needed

Signed-off-by: Michal Pryc <mpryc@redhat.com>
@mpryc
mpryc force-pushed the automated-go-version-update branch from 80840fd to 75f05da Compare July 17, 2026 19:52

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (5)
.github/workflows/update-go-version.yaml (5)

28-31: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Disable credential persistence to prevent token leakage.

By default, actions/checkout persists the GitHub token in the local Git configuration. Because this workflow subsequently executes make build or go build (which executes code from the repository), it is a security best practice to disable credential persistence to prevent unintended access to the token during the build step.

🛡️ Proposed refactor
       - name: Checkout operator repo
         uses: actions/checkout@v6
         with:
           fetch-depth: 0
+          persist-credentials: false
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/update-go-version.yaml around lines 28 - 31, Update the
“Checkout operator repo” actions/checkout step to disable credential persistence
by setting persist-credentials to false, while preserving the existing
full-fetch configuration.

Source: Linters/SAST tools


124-131: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Use git status to reliably detect all changes, including untracked files.

git diff --quiet only detects changes to already-tracked files. If go mod vendor introduces new dependencies and generates new files in the vendor/ directory, they remain untracked until added. While changes to the tracked go.sum file usually accompany new dependencies and trigger the condition anyway, using git status --porcelain is a more robust way to verify if the working directory is completely clean.

💡 Proposed refactor
       - name: Check for changes
         id: changes
         run: |
-          if git diff --quiet; then
+          if [ -z "$(git status --porcelain)" ]; then
             echo "No file changes — everything is up to date"
             echo "has-changes=false" >> "${GITHUB_OUTPUT}"
           else
             echo "has-changes=true" >> "${GITHUB_OUTPUT}"
-            git diff --stat
+            git status --short
           fi
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/update-go-version.yaml around lines 124 - 131, Replace the
git diff --quiet check in the workflow’s change-detection step with git status
--porcelain so both tracked modifications and untracked files are detected.
Preserve the existing has-changes outputs and status summary behavior for clean
and changed working trees.

102-113: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Move toolchain removal after dependency updates.

Starting with Go 1.21, go mod tidy can automatically append a new toolchain directive to go.mod if any downloaded dependency requires a newer patch version. To guarantee the directive remains entirely removed as intended, move the sed command to execute after the go mod tidy step.

♻️ Proposed refactor
-          # Remove toolchain directive — patch versions are handled by the builder
-          sed -i '/^toolchain /d' go.mod
 
       - name: Update dependencies
         run: |
           # Always run tidy + vendor to pick up dependency security patches,
           # even when the Go version itself hasn't changed
           go mod tidy
 
           if [ -d vendor ]; then
             go mod vendor
           fi
+
+          # Remove toolchain directive — patch versions are handled by the builder
+          sed -i '/^toolchain /d' go.mod
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/update-go-version.yaml around lines 102 - 113, Move the
`sed -i '/^toolchain /d' go.mod` command from before the “Update dependencies”
step to after `go mod tidy` completes, so any automatically added toolchain
directive is removed. Keep the existing conditional `go mod vendor` flow
unchanged.

153-156: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Note: PRs created with GITHUB_TOKEN will not trigger downstream GitHub Actions workflows.

By default, GitHub prevents workflows triggered by the GITHUB_TOKEN from initiating subsequent workflow runs (such as CI checks running on the newly created PR). If the operator repositories rely on GitHub Actions workflows for PR validation, those checks will not run automatically. You can bypass this limitation by using a Personal Access Token (PAT) or a GitHub App token instead.

If the repositories strictly use an external CI system like OpenShift Prow (which listens to webhook events independently), this setup is perfectly fine as-is.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/update-go-version.yaml around lines 153 - 156, Update the
create-pull-request step using the github.token input so it authenticates with
the repository’s configured PAT or GitHub App token instead, while preserving
the existing dry-run and has-changes condition. Use the appropriate existing
secret or token configuration rather than introducing an unrelated credential.

45-48: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

yq is pre-installed on GitHub-hosted runners.

The comment indicates that yq is not pre-installed, but it is officially included on ubuntu-24.04 and other standard GitHub-hosted runners.

While the grep approach works fine for this flat configuration file, avoiding yq introduces critical parsing bugs for the nested .ci-operator.yaml file later in the workflow. Since yq is already pre-installed, using it fully satisfies your goal of leveraging only pre-installed tools while ensuring robust YAML manipulation.

♻️ Proposed refactor to use yq
-          # Parse simple key: "value" YAML without yq (not pre-installed on runners)
-          GO_VERSION=$(grep '^go:' /tmp/go-version.yaml | sed 's/^go: *"\?\([^"]*\)"\?/\1/')
-          CI_IMAGE=$(grep '^ci-operator-image:' /tmp/go-version.yaml | sed 's/^ci-operator-image: *"\?\([^"]*\)"\?/\1/')
+          # Extract configuration values using the pre-installed yq
+          GO_VERSION=$(yq '.go' /tmp/go-version.yaml)
+          CI_IMAGE=$(yq '.ci-operator-image' /tmp/go-version.yaml)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/update-go-version.yaml around lines 45 - 48, Update the
YAML parsing in the workflow to use the pre-installed yq tool instead of the
grep/sed commands for GO_VERSION and CI_IMAGE, and remove the inaccurate
comment. Reuse yq consistently for the later nested .ci-operator.yaml parsing
and preserve the existing extracted values and workflow behavior.

Source: MCP tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/update-go-version.yaml:
- Around line 75-83: Update the CURRENT_IMAGE assignment in the
.ci-operator.yaml comparison block to use the pre-installed yq tool and extract
only the builder image tag, rather than grepping every tag entry. Preserve the
existing equality check and ci-update outputs once CURRENT_IMAGE contains the
single intended value.
- Around line 119-121: Replace the sed-based update in the workflow step with a
yq expression that targets the exact build_root.tag field in .ci-operator.yaml,
assigning TARGET_CI_IMAGE while leaving unrelated tag fields such as those under
base_images unchanged.

---

Nitpick comments:
In @.github/workflows/update-go-version.yaml:
- Around line 28-31: Update the “Checkout operator repo” actions/checkout step
to disable credential persistence by setting persist-credentials to false, while
preserving the existing full-fetch configuration.
- Around line 124-131: Replace the git diff --quiet check in the workflow’s
change-detection step with git status --porcelain so both tracked modifications
and untracked files are detected. Preserve the existing has-changes outputs and
status summary behavior for clean and changed working trees.
- Around line 102-113: Move the `sed -i '/^toolchain /d' go.mod` command from
before the “Update dependencies” step to after `go mod tidy` completes, so any
automatically added toolchain directive is removed. Keep the existing
conditional `go mod vendor` flow unchanged.
- Around line 153-156: Update the create-pull-request step using the
github.token input so it authenticates with the repository’s configured PAT or
GitHub App token instead, while preserving the existing dry-run and has-changes
condition. Use the appropriate existing secret or token configuration rather
than introducing an unrelated credential.
- Around line 45-48: Update the YAML parsing in the workflow to use the
pre-installed yq tool instead of the grep/sed commands for GO_VERSION and
CI_IMAGE, and remove the inaccurate comment. Reuse yq consistently for the later
nested .ci-operator.yaml parsing and preserve the existing extracted values and
workflow behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 42c5025f-4718-4524-934b-9ac38f2f70c6

📥 Commits

Reviewing files that changed from the base of the PR and between 9b21474 and 75f05da.

📒 Files selected for processing (6)
  • .github/workflows/update-go-version.yaml
  • go-versions/README.md
  • go-versions/ocp-4.19.yaml
  • go-versions/ocp-4.20.yaml
  • go-versions/ocp-4.21.yaml
  • go-versions/ocp-4.22.yaml

Comment on lines +75 to +83
if [ -f .ci-operator.yaml ]; then
CURRENT_IMAGE=$(grep 'tag:' .ci-operator.yaml | sed 's/.*tag: *"\?\([^"]*\)"\?/\1/')
if [ "${CURRENT_IMAGE}" = "${TARGET_CI_IMAGE}" ]; then
echo "CI image already at ${TARGET_CI_IMAGE}"
echo "ci-update=false" >> "${GITHUB_OUTPUT}"
else
echo "CI image update needed: ${CURRENT_IMAGE} -> ${TARGET_CI_IMAGE}"
echo "ci-update=true" >> "${GITHUB_OUTPUT}"
fi

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win

grep will capture multiple tags, breaking the evaluation.

Using grep 'tag:' captures all occurrences of tag: in .ci-operator.yaml (e.g., tags often found under base_images configurations). This produces a multiline string in CURRENT_IMAGE, which causes the equality check [ "${CURRENT_IMAGE}" = "${TARGET_CI_IMAGE}" ] to silently fail, forcing an unnecessary update attempt.

Use the pre-installed yq tool to precisely extract the builder image tag.

🐛 Proposed fix
           if [ -f .ci-operator.yaml ]; then
-            CURRENT_IMAGE=$(grep 'tag:' .ci-operator.yaml | sed 's/.*tag: *"\?\([^"]*\)"\?/\1/')
+            CURRENT_IMAGE=$(yq '.build_root.image_stream_tag.tag' .ci-operator.yaml)
             if [ "${CURRENT_IMAGE}" = "${TARGET_CI_IMAGE}" ]; then
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if [ -f .ci-operator.yaml ]; then
CURRENT_IMAGE=$(grep 'tag:' .ci-operator.yaml | sed 's/.*tag: *"\?\([^"]*\)"\?/\1/')
if [ "${CURRENT_IMAGE}" = "${TARGET_CI_IMAGE}" ]; then
echo "CI image already at ${TARGET_CI_IMAGE}"
echo "ci-update=false" >> "${GITHUB_OUTPUT}"
else
echo "CI image update needed: ${CURRENT_IMAGE} -> ${TARGET_CI_IMAGE}"
echo "ci-update=true" >> "${GITHUB_OUTPUT}"
fi
if [ -f .ci-operator.yaml ]; then
CURRENT_IMAGE=$(yq '.build_root.image_stream_tag.tag' .ci-operator.yaml)
if [ "${CURRENT_IMAGE}" = "${TARGET_CI_IMAGE}" ]; then
echo "CI image already at ${TARGET_CI_IMAGE}"
echo "ci-update=false" >> "${GITHUB_OUTPUT}"
else
echo "CI image update needed: ${CURRENT_IMAGE} -> ${TARGET_CI_IMAGE}"
echo "ci-update=true" >> "${GITHUB_OUTPUT}"
fi
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/update-go-version.yaml around lines 75 - 83, Update the
CURRENT_IMAGE assignment in the .ci-operator.yaml comparison block to use the
pre-installed yq tool and extract only the builder image tag, rather than
grepping every tag entry. Preserve the existing equality check and ci-update
outputs once CURRENT_IMAGE contains the single intended value.

Comment on lines +119 to +121
run: |
sed -i "s|^\( tag: \).*|\1${TARGET_CI_IMAGE}|" .ci-operator.yaml

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win

Incorrect indentation assumption in sed replacement.

The regex ^\( tag: \) strictly expects two spaces of indentation. In OpenShift .ci-operator.yaml files, the tag field under build_root is typically indented with four spaces ( tag:). Consequently, this sed command will silently fail to update the file, submitting a PR without the expected CI image change. Additionally, if other configuration blocks (like base_images) happen to use two-space indentation for their tags, they will be incorrectly corrupted.

Use yq to safely update the exact field.

🐛 Proposed fix
         env:
           TARGET_CI_IMAGE: ${{ steps.config.outputs.ci-image }}
         run: |
-          sed -i "s|^\(  tag: \).*|\1${TARGET_CI_IMAGE}|" .ci-operator.yaml
+          yq -i '.build_root.image_stream_tag.tag = env(TARGET_CI_IMAGE)' .ci-operator.yaml
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
run: |
sed -i "s|^\( tag: \).*|\1${TARGET_CI_IMAGE}|" .ci-operator.yaml
run: |
yq -i '.build_root.image_stream_tag.tag = env(TARGET_CI_IMAGE)' .ci-operator.yaml
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/update-go-version.yaml around lines 119 - 121, Replace the
sed-based update in the workflow step with a yq expression that targets the
exact build_root.tag field in .ci-operator.yaml, assigning TARGET_CI_IMAGE while
leaving unrelated tag fields such as those under base_images unchanged.

@razo7 razo7 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Very good intention but I am not sure I like the per repo changes and using cron, see my suggestion at the end.

Reviewed against recent merged Go bump PRs across all 6 operators: NHC #421, SNR #324, FAR #201, MDR #186, NMO #155, SBR #77. See inline threads for details.

All 6 repos keep the toolchain directive (e.g., go 1.26.0 / toolchain go1.26.5) — removing it lets go mod tidy and go build silently download a different Go patch version, breaking build reproducibility across contributors and CI.

Consider a centralized approach: a single workflow_dispatch workflow that reads a config file (target repos, Go version, API packages to bump in go.mod), runs the update across all repos, and creates PRs — with a dry-run option to preview changes before PR creation. One trigger replaces per-repo cron jobs and eliminates the need for any changes in operator repos.

This workflow may fit better in medik8s/tools rather than .githubtools already hosts shared dev tooling (dev.mk, setup.sh), while .github is for org-wide defaults (profile, shared workflow templates). A config-driven multi-repo dispatch workflow aligns with the tools mandate. The version schema YAML files could live alongside it.

Comment thread .github/workflows/update-go-version.yaml
Comment thread .github/workflows/update-go-version.yaml Outdated
Comment on lines +100 to +103
go mod edit -go="${TARGET_GO}"

# Remove toolchain directive — patch versions are handled by the builder
sed -i '/^toolchain /d' go.mod

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This contradicts how every operator actually manages Go versions. All 6 repos use patch versions with toolchain:

Repo go.mod
SNR, NHC, MDR, NMO, SBR go 1.26.0 / toolchain go1.26.5
FAR go 1.25.0 / toolchain go1.25.9

The sed removal deletes what every repo intentionally keeps, and go mod tidy (next step) will likely re-add it anyway since the installed Go patch version (e.g., 1.25.3 via setup-go) is newer than go 1.25 (equivalent to 1.25.0).

Recommendation: keep toolchain and update the schema to include the patch version:

# go-versions/latest.yaml
go: "1.26.5"          # full patch version
ci-operator-image: "rhel-9-release-golang-1.26-openshift-5.0"

Then replace these lines with:

go mod edit -go="${TARGET_GO}" -toolchain="go${TARGET_GO}"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Acknowledged, will address in a follow-up — need to update the schema to include patch versions first.

Comment on lines +107 to +113
# Always run tidy + vendor to pick up dependency security patches,
# even when the Go version itself hasn't changed
go mod tidy

if [ -d vendor ]; then
go mod vendor
fi

@razo7 razo7 Aug 17, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Two issues here:

1. go mod tidy doesn't update dependency versions — it adds missing and removes unused modules, but won't pull in security patches. Every actual Go bump PR (NHC #421, SNR #324, etc.) includes explicit dependency bumps like golang.org/x/net v0.53.0 → v0.57.0.

It's fine to keep this PR focused on Go + go.sum only, but as a follow-up consider extending the version schema to cover packages, tools, and test framework alignment:

# go-versions/latest.yaml
go: "1.26.5"
ci-operator-image: "rhel-9-release-golang-1.26-openshift-5.0"
packages:
  - golang.org/x/net@latest
  - golang.org/x/sys@latest
  # K8s packages follow release branches matching OCP version
  - k8s.io/api@release-0.32
  - k8s.io/client-go@release-0.32
tools:
  kustomize: latest           # auto-resolve from GitHub releases
  controller-gen: latest
  ginkgo: "2.23.4"            # must match go.mod
  gomega: "1.37.1"            # must match go.mod

Key design points:

  • Auto-discovery: a helper workflow that queries GitHub releases API and Go module proxy to generate/update this config — so you don't have to look up versions manually
  • Release branch targeting: K8s packages (k8s.io/api, client-go) need @release-0.XX matching the OCP version, not @latest
  • Ginkgo/gomega alignment: Makefile GINKGO_VERSION and go.mod github.com/onsi/ginkgo/v2 must stay in sync — a centralized config that bumps both in one pass prevents drift

2. All 6 operators (excluding CUR) have go-verify or equivalent Makefile targets that run go mod tidy + go mod vendor + go mod verify. Consider calling make go-verify instead of raw tidy/vendor — 5/6 repos use go-verify; NHC uses vendor (can be aligned separately).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good suggestions for follow-up — keeping this PR focused on Go version + go.sum for now.

Comment thread .github/workflows/update-go-version.yaml Outdated
Comment thread .github/workflows/update-go-version.yaml Outdated
Comment thread go-versions/ocp-4.21.yaml Outdated
- Validate GO_VERSION and CI_IMAGE after parsing, fail early if empty
- Anchor grep for tag: in .ci-operator.yaml to avoid matching multiple
  tag fields, use head -1 as safety net
- Use git status --porcelain instead of git diff --quiet to detect
  untracked files (e.g. new vendor/ dependencies)
- SHA-pin peter-evans/create-pull-request to v7.0.11 for supply chain
  security (action receives contents:write + pull-requests:write)
- Fix ocp-4.21.yaml comment: used by release branches, not main

Signed-off-by: Michal Pryc <mpryc@redhat.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@razo7 razo7 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ready for merge. My two suggestions will be done in a follow up.
Holding for now in case someone else has more suggestions (feel free to unhold)
/hold

@openshift-ci

openshift-ci Bot commented Aug 25, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mpryc, razo7

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

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