Skip to content

Cleanup: Use get-agent-version for semverCompare - #2885

Open
agagniere wants to merge 3 commits into
mainfrom
agagniere/cleanup
Open

Cleanup: Use get-agent-version for semverCompare#2885
agagniere wants to merge 3 commits into
mainfrom
agagniere/cleanup

Conversation

@agagniere

@agagniere agagniere commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

#2876 removed an incorrect use of get-agent-version, as a container image tag.

This present PR does the inverse: make sure get-agent-version is used when doing semver comparison.

Why ? valid tags include:

  • 7.82.3, easy to semverCompare ✅
  • 7, that will compare as below 7.67.0 even though it actually is more recent ❌
  • latest, that will fail the comparison ❌
  • 7.83.0-full, that will be considered a "beta", so below 7.83.0

This complexity is exactly the reason why get-agent-version was created, to takes the tag as input and gives us a simple x.yy.z version as output, ready to be compared.

Most semverCompare checks use it, but I found a few that remained. They had brittle ad-hoc checks and transforms to handle some cases, but using get-agent-version centralizes this logic and solves it in a robust way once and for all.

Checklist

[Place an '[x]' (no spaces) in all applicable fields. Please remove unrelated fields.]

  • All commits are signed and show as "Verified" on GitHub (see: signing commits)
  • Chart Version semver bump label has been added (use <chartName>/minor-version, <chartName>/patch-version, or <chartName>/no-version-bump)
  • For datadog or datadog-operator chart or value changes, update the test baselines (run: make update-test-baselines)
  • For datadog chart changes, received ✅ from a member of your team

GitHub CI takes care of the below, but are still required:

  • Documentation has been updated with helm-docs (run: .github/helm-docs.sh)
  • CHANGELOG.md has been updated
  • Variables are documented in the README.md

@agagniere agagniere self-assigned this Aug 28, 2026
@agagniere agagniere added chart/datadog This issue or pull request is related to the datadog chart datadog/patch-version Patch version bump for datadog chart team/opentelemetry-agent labels Aug 28, 2026
@agagniere
agagniere marked this pull request as ready for review August 28, 2026 19:56
@agagniere
agagniere requested review from a team as code owners August 28, 2026 19:56
@agagniere
agagniere requested review from swang392 and removed request for a team August 28, 2026 19:56

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cdb7047399

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread charts/datadog/CHANGELOG.md

Copilot AI 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.

Pull request overview

This PR standardizes Datadog chart version gating by using the existing get-agent-version helper whenever semverCompare is used, so floating/variant tags (e.g. 7, latest, *-full, *-fips) are normalized to a clean x.y.z for comparisons.

Changes:

  • Updated a few templates to use include "get-agent-version" . instead of ad-hoc tag parsing before semverCompare.
  • Expanded get-agent-version to strip common build-variant suffixes prior to resolving/normalizing versions.
  • Bumped chart version and added a changelog entry.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
charts/datadog/templates/system-probe-configmap.yaml Switches network monitoring version gate to use get-agent-version.
charts/datadog/templates/datadog-yaml-configmap.yaml Uses get-agent-version for the JMX container support version gate.
charts/datadog/templates/_helpers.tpl Enhances get-agent-version and refactors remaining semver guards to use it.
charts/datadog/README.md Updates chart version badge.
charts/datadog/Chart.yaml Bumps chart version to 3.240.6.
charts/datadog/CHANGELOG.md Adds 3.240.6 entry describing this cleanup.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +7 to +11
{{- $version := .Values.agents.image.tag | toString -}}
{{/* Strip build-variant suffixes (any combination/order) so version guards compare on a clean version. */}}
{{- range until 3 -}}
{{- $version = $version | trimSuffix "-jmx" | trimSuffix "-full" | trimSuffix "-fips" | trimSuffix "-servercore" -}}
{{- end -}}

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.

no real published image has more than 3 suffixes

Comment thread charts/datadog/templates/datadog-yaml-configmap.yaml Outdated
- bump version for datadog to 3.241.1 (patch-version)
- update changelog for datadog with version 3.241.1
- update readme for datadog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chart/datadog This issue or pull request is related to the datadog chart datadog/patch-version Patch version bump for datadog chart team/opentelemetry-agent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants