Skip to content

fix: fall back to tag_name when release name is empty in set-replaces-directive#314

Open
thomasmaas wants to merge 2 commits into
mainfrom
fix-replaces-empty-name
Open

fix: fall back to tag_name when release name is empty in set-replaces-directive#314
thomasmaas wants to merge 2 commits into
mainfrom
fix-replaces-empty-name

Conversation

@thomasmaas

@thomasmaas thomasmaas commented May 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes the prepare-release failure in the v0.25.0 release workflow (run #26561992452).

Problem

The set-replaces-directive Makefile target fetches the latest GitHub release name to build the OLM spec.replaces value. When a release has an empty name field (v0.23.2 was created without --title), jq -r '.name' returns an empty string, producing authorino-operator. which fails OLM bundle validation:

spec.replaces "authorino-operator." is invalid: a lowercase RFC 1123 subdomain must consist of...

Fix

Use jq's alternative operator (//) to fall back to tag_name when name is empty or null.

Also fixed: gh release edit v0.23.2 --title v0.23.2 to set the missing release name.

Known limitation

This target uses /releases/latest which returns the most recently published release globally, not per-branch. When releasing on multiple minor branches (e.g. v0.23.x and v0.25.x), the replaces directive could point to the wrong version. A follow-up should make REPLACES_VERSION an explicit workflow input.

Test plan

  • Verified gh api repos/Kuadrant/authorino-operator/releases/latest --jq '.name // .tag_name' now returns v0.23.2
  • Re-run the v0.25.0 release workflow after merging

Summary by CodeRabbit

  • Style

    • Reformatted build configuration syntax for improved readability.
  • Chores

    • Improved robustness of release-version detection to handle missing or empty fields, reducing failures during release processing and making automated updates more reliable.

Review Change Stack

…-directive

The set-replaces-directive target fetches the latest release name to
build the OLM replaces directive. When a release has an empty name
field (e.g. created without --title), jq returns an empty string,
producing an invalid replaces value "authorino-operator." that fails
bundle validation.

Use jq's alternative operator (//) to fall back to tag_name when
name is empty or null.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Thomas Maas <thomas@webtypes.com>
@coderabbitai

coderabbitai Bot commented May 28, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: cdf4eceb-4aa6-4822-a9d1-c54cfd9a38b3

📥 Commits

Reviewing files that changed from the base of the PR and between 6b6cfa5 and 69346e4.

📒 Files selected for processing (1)
  • Makefile

📝 Walkthrough

Walkthrough

The Makefile's set-replaces-directive now computes REPLACES_VERSION using jq -r '.name // .tag_name' (uses .name when non-empty, otherwise .tag_name); the curl→jq pipeline formatting/indentation was also adjusted.

Changes

Makefile change

Layer / File(s) Summary
jq name/tag fallback and pipeline formatting
Makefile
The jq -r filter in the curljq pipeline now emits .name when non-empty, otherwise falls back to .tag_name. Surrounding pipeline indentation/line-wrapping was adjusted accordingly.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • guicassolato

Poem

🐰 I hopped through lines of Makefile text,
Found the name that sometimes hides,
Now if .name is shy or vexed,
.tag_name steps in as guide,
A tidy fallback—version allied.

🚥 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 accurately describes the main change: fixing the set-replaces-directive target to handle empty release names by falling back to tag_name, which directly addresses the v0.25.0 release workflow failure documented in the PR objectives.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-replaces-empty-name

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 and usage tips.

@codecov-commenter

codecov-commenter commented May 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 57.20%. Comparing base (f4df274) to head (69346e4).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #314   +/-   ##
=======================================
  Coverage   57.20%   57.20%           
=======================================
  Files          13       13           
  Lines        1458     1458           
=======================================
  Hits          834      834           
  Misses        529      529           
  Partials       95       95           
Flag Coverage Δ
unit 57.20% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@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: 1

🤖 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 `@Makefile`:
- Around line 367-369: The current REPLACES_VERSION assignment uses jq '.name //
.tag_name' which falls back only for null/false and yields an empty string when
"name": ""; update the jq expression used in the REPLACES_VERSION shell command
so it explicitly checks for null or empty name (e.g., use a conditional that
prefers .tag_name when .name is null or ""), ensuring REPLACES_VERSION is never
set to an empty string; modify the jq part referenced in the REPLACES_VERSION
assignment accordingly.
🪄 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: 3fa44db6-402d-4f35-93fb-0dec273436be

📥 Commits

Reviewing files that changed from the base of the PR and between f4df274 and 6b6cfa5.

📒 Files selected for processing (1)
  • Makefile

Comment thread Makefile Outdated
guicassolato
guicassolato previously approved these changes May 28, 2026
jq's // operator only catches null/false, not empty string "".
The original bug was an empty name (""), so the previous fix didn't
actually cover the failing case. Use an explicit length check instead.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Thomas Maas <thomas@webtypes.com>
@coderabbitai

coderabbitai Bot commented May 28, 2026

Copy link
Copy Markdown

Actionable comments posted: 0

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

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

4 participants