Skip to content

Conversation

@Caesarsage
Copy link

Fixes #21970

The get_version.go tool was using FindSubmatch which returns only the
first match. When go.mod contains multiple versions of the same
dependency (e.g., v74 and v79 for go-github), it would always return
the first (older) version.

This caused automated update PRs to show incorrect titles like:
'CI: update go-github from v74.0.0 to v74.0.0'

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Caesarsage
Once this PR has been reviewed and has the lgtm label, please assign comradeprogrammer for approval. For more information see the Code Review Process.

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

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

@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Nov 22, 2025
@minikube-bot
Copy link
Collaborator

Can one of the admins verify this patch?

@k8s-ci-robot
Copy link
Contributor

@Caesarsage: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
integration-kvm-containerd-linux-x86-64 f16e986 link true /test integration-kvm-containerd-linux-x86-64
integration-kvm-crio-linux-x86-64 f16e986 link true /test integration-kvm-crio-linux-x86-64
integration-none-docker-linux-x86-64 f16e986 link true /test integration-none-docker-linux-x86-64
integration-docker-containerd-linux-x86-64 f16e986 link true /test integration-docker-containerd-linux-x86-64
integration-docker-crio-linux-x86-64 f16e986 link true /test integration-docker-crio-linux-x86-64

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Copy link
Member

@medyagh medyagh left a comment

Choose a reason for hiding this comment

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

@Caesarsage can you plz post an example of running the code with getting version of something with multiple

@Caesarsage
Copy link
Author

@Caesarsage can you plz post an example of running the code with getting version of something with multiple

Hello @medyagh

Here's the exampl showing the fix working with multiple versions:

Test Scenario

Using the current go.mod with multiple go-github entries:

github.com/google/go-github/v74 v74.0.0
github.com/google/go-github/v79 v79.0.0  // new as a result of `make update-go-github-version`:

Before Fix (using FindSubmatch)

The original code uses FindSubmatch() which returns only the first match (even after the automation runs make update-go-github-version):

$ DEP=go-github make get-dependency-version
v74.0.0  # Returns the FIRST/OLD version

After Fix (using FindAllSubmatch)

The fixed code uses FindAllSubmatch() and takes the last match, which is what is needed after the automation runs make update-go-github-version:

$ DEP=go-github make get-dependency-version
v79.0.0  # Returns the LAST/CURRENT version

When the automated workflow runs for futture reference on new versions:

  1. OLD_VERSION captures the current version → v79.0.0
  2. make update-go-github-version runs and updates to new version → v80.0.0
  3. NEW_VERSION captures the updated version → v80.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update Automation PR:The "after" version is wrong in PR title

4 participants