fix: OCI filter pre-release tags#15005
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the Helm UpdateChecker to ignore semver prerelease-style OCI tags when computing update candidates, preventing unstable/branch-build tags from being selected as the latest chart version.
Changes:
- Add prerelease-tag detection for Helm OCI tags and filter those tags out from candidate versions.
- Add a regression spec ensuring prerelease-style tags are ignored and a stable tag is selected instead.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| helm/lib/dependabot/helm/update_checker.rb | Filters out OCI tags matching a prerelease-style regex before version validation/selection. |
| helm/spec/dependabot/helm/update_checker_spec.rb | Adds a spec case asserting prerelease-like OCI tags don’t affect latest_version. |
| # Matches semver-like OCI tags that carry prerelease metadata after the | ||
| # patch version, including git-describe style builds and branch-based | ||
| # labels such as 2.0.4-main.146.sha.7ac1266. |
|
This may not be the right fix because some users may want to get these. What we implemented for gradle/maven is to detect what the current value is and suggest as needed. Can we try the same here? |
I updated it so that if the current version is a pre-release then it will suggest a pre-release. |
There was a problem hiding this comment.
Copilot's findings
Comments suppressed due to low confidence (1)
helm/lib/dependabot/helm/update_checker.rb:276
wants_oci_prerelease_tags?checks the current version string directly, but OCI tags may represent+build metadata as_. If the current dependency version is stored in OCI tag form (with_), prerelease detection could incorrectly return false and cause prerelease updates to be filtered out. Normalizingdependency.version(e.g.,tr('_', '+')) before callingoci_prerelease_tag?would make this robust.
sig { returns(T::Boolean) }
def wants_oci_prerelease_tags?
current_version = dependency.version
return false unless current_version
oci_prerelease_tag?(current_version)
end
- Files reviewed: 2/2 changed files
- Comments generated: 1
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
@yeikel are you able to review or do you know who reviews typically |
What are you trying to accomplish?
This is an issue preventing our organization from leveraging dependabot for helm version updates, so I am proposing this fix.
Exclude prerelease-style tags from update candidates, so Dependabot does not propose unstable chart versions as normal upgrades.
This fixes the issue where tags such as 3.44.1-1.g585bce1 (and similar prerelease formats) were being treated as valid latest versions for Helm OCI dependencies.
Reproduction reference:
https://github.com/jaredlueck/dependabot-helm-issue/pull/1/changes
Main changes:
How will you know you've accomplished your goal?
Checklist