Skip to content

GHA-444 Keep trailing .0 of two-part versions in create-jira-version - #217

Merged
nils-werner-sonarsource merged 2 commits into
masterfrom
Tim/FixVersionNormalization
Oct 23, 2026
Merged

nils-werner-sonarsource merged 2 commits into
masterfrom
Tim/FixVersionNormalization

Conversation

@Tim-Pohlmann

Copy link
Copy Markdown
Contributor

What

normalize_version_name in create-jira-version now strips a trailing .0 only for versions with at least three parts (1.2.0 -> 1.2). Two-part versions such as 12.0 are left unchanged.

Why

The old regex ^(.+)\.0$ also matched two-part versions, so a requested next version of 12.0 was created in Jira as 12. That value is exposed as release-in-jira.outputs.new-version and reaches bump-version as 12. This was observed in the sonar-scanner-msbuild release. The new implementation splits on . instead of using a regex, which also avoids backtracking.

normalize_version_name stripped any trailing .0, so a requested next version of '12.0' was created in Jira as '12' and passed on as such to bump-version. Only strip the .0 patch when the version has at least three parts.
@hashicorp-vault-sonar-prod hashicorp-vault-sonar-prod Bot changed the title Keep trailing .0 of two-part versions in create-jira-version GHA-444 Keep trailing .0 of two-part versions in create-jira-version Oct 15, 2026
@hashicorp-vault-sonar-prod

hashicorp-vault-sonar-prod Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

GHA-444

Co-authored-by: Tim Pohlmann <20153123+Tim-Pohlmann@users.noreply.github.com>
@gitar-bot

gitar-bot Bot commented Oct 15, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 1 closed / 1 findings

🟡 Medium risk · Restricting .0 removal to three-part versions changes Jira release labels; an unexpected two-part format could now mismatch downstream version handling.

Keeps the trailing .0 for two-part versions in normalize_version_name, so 12.0 is no longer created in Jira as 12 and reaches bump-version correctly. The previously open finding that get-jira-version still stripped .0 from two-part versions has been addressed.

✅ 1 closed
✅ Edge Case: get-jira-version still strips .0 from two-part versions

📄 create-jira-version/create_jira_version.py:22-25
This PR changes how create-jira-version normalizes versions: a trailing .0 is now removed only when the version has at least three parts, so 12.0 stays 12.0. The sibling get-jira-version action still runs sed 's/\.0$//' on the release version after cutting it to major.minor.patch. Any release version with only two parts (for example 12.0 or 12.0+123) still becomes 12 there. When that happens, the version name get-jira-version looks up no longer matches the one create-jira-version creates, and this is the same 12.0 -> 12 problem the PR is fixing. To fix it, only strip the trailing .0 when there are three components, e.g. sed -E 's/^([^.]+\.[^.]+)\.0$/\1/'.

Verification Rules 1/1 met Repos 1 inspected · PRs 1 inspected

Functional validation No results

Rules 1 passed 2 not applicable

✅ Repository license compliance

Broader impact Repos 1 inspected PRs 1 inspected
Cross-repo 1 repository inspected 0 open impacts

SonarSource/sonar-scanner-msbuild Inspected

Cross-PR 1 PR inspected 0 open impacts

PR #211: CLP-1110 Rerun dependent test suites when shared code and fixtures change Inspected

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@sonarqubecloud

Copy link
Copy Markdown

@nils-werner-sonarsource nils-werner-sonarsource left a comment

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.

LGTM

@nils-werner-sonarsource
nils-werner-sonarsource merged commit 795b793 into master Oct 23, 2026
10 checks passed
@nils-werner-sonarsource
nils-werner-sonarsource deleted the Tim/FixVersionNormalization branch October 23, 2026 07:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants