Skip to content

[ci] Fix escaping for gen_versions_map.sh script - #836

Merged
klinch0 merged 1 commit into
mainfrom
fix-escaping-ver-gen
Apr 22, 2025
Merged

klinch0 merged 1 commit into
mainfrom
fix-escaping-ver-gen

Conversation

@kvaps

@kvaps Andrei Kvapil (kvaps) commented Apr 22, 2025 •

Copy link
Copy Markdown
Member

fixes errors like this:

Summary by CodeRabbit

  • Bug Fixes
    • Improved reliability of version generation by handling empty or special values safely in the process.

Backported to v0.30 in #852

@coderabbitai

coderabbitai Bot commented Apr 22, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

The update makes a minor but important change to a shell script. It modifies a conditional statement to prefix both sides of a string comparison with "x" to safely handle cases where the variable may be empty or unset. No other logic or exported entities are affected by this change.

Changes

File(s) Change Summary
hack/gen_versions_map.sh Modified string comparison in a conditional by prefixing both sides with "x" to prevent errors

Suggested reviewers

  • lllamnyp

Poem

A hop, a skip, a quoted check,
In scripts we rabbits must not neglect.
For empty vars and spaces wide,
With quotes our code can safely glide.
So let us cheer this tiny fix—
A shell script now less prone to tricks!
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f268d34 and 2def9f4.

📒 Files selected for processing (1)
  • hack/gen_versions_map.sh (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • hack/gen_versions_map.sh

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@kvaps Andrei Kvapil (kvaps) changed the title fix escaping ver gen [ci] Fix escaping for gen_versions_map.sh script Apr 22, 2025
@kvaps Andrei Kvapil (kvaps) added the kind/backport Categorizes issue or PR as requiring a backport to the current release line label Apr 22, 2025
Comment thread hack/gen_versions_map.sh Outdated

# if commit is not HEAD, check if it's valid
if [ $commit != "HEAD" ]; then
if [ "$commit" != "HEAD" ]; then

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is a common pattern:

Suggested change
if [ "$commit" != "HEAD" ]; then
if [ "x$commit" != "xHEAD" ]; then

@klinch0
klinch0 force-pushed the fix-escaping-ver-gen branch from f268d34 to 2def9f4 Compare April 22, 2025 13:33
@klinch0
klinch0 merged commit 7a9a1fc into main Apr 22, 2025
@klinch0
klinch0 deleted the fix-escaping-ver-gen branch April 22, 2025 13:35
Andrei Kvapil (kvaps) added a commit that referenced this pull request Apr 22, 2025
second attept of #836

fixes errors like this:

-
https://github.com/cozystack/cozystack/actions/runs/14591720553/job/40928276862?pr=835

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **Bug Fixes**
- Improved reliability of version generation by handling empty or
special values safely in the process.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Andrei Kvapil (kvaps) added a commit that referenced this pull request Apr 22, 2025
)

Third attempt to fix #842 and
#836

tested in
https://github.com/cozystack/cozystack/actions/runs/14599981710/job/40955508728?pr=808

Signed-off-by: Andrei Kvapil <[email protected]>


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Chores**
- Improved GitHub Actions workflow to fetch full git history and tags
during pre-commit checks.
- **Refactor**
- Updated script behavior to display error messages when version
extraction from git fails, making troubleshooting easier.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Nick Volynkin (NickVolynkin) pushed a commit that referenced this pull request Apr 23, 2025
Backport of #836

fixes errors like this:

-
https://github.com/cozystack/cozystack/actions/runs/14591720553/job/40928276862?pr=835

Improved reliability of version generation by handling empty or
special values safely in the process.

(cherry picked from commit 7a9a1fc)

Signed-off-by: kklinch0 <[email protected]>
Nick Volynkin (NickVolynkin) pushed a commit that referenced this pull request Apr 23, 2025
Backport of #836

fixes errors like this:

-
https://github.com/cozystack/cozystack/actions/runs/14591720553/job/40928276862?pr=835

Improved reliability of version generation by handling empty or
special values safely in the process.

(cherry picked from commit 7a9a1fc)

Signed-off-by: kklinch0 <[email protected]>
Signed-off-by: Nick Volynkin <[email protected]>
Nick Volynkin (NickVolynkin) pushed a commit that referenced this pull request Apr 23, 2025
Backport of #836

fixes errors like this:

```
make: Entering directory '/home/runner/work/cozystack/cozystack/packages/apps'
find . -maxdepth 2 -name Chart.yaml  | awk -F/ '{print $2}' | while read i; do sed -i "s/^name: .*/name: $i/" "$i/Chart.yaml"; done
../../hack/gen_versions_map.sh
../../hack/gen_versions_map.sh: 34: [: !=: unexpected operator
fatal: Needed a single revision
make: *** [Makefile:17: gen-versions-map] Error 128
make: Leaving directory '/home/runner/work/cozystack/cozystack/packages/apps'
```
https://github.com/cozystack/cozystack/actions/runs/14591720553/job/40928276862?pr=835

Improved reliability of version generation by handling empty or
special values safely in the process.

(cherry picked from commit 7a9a1fc)

Signed-off-by: Nick Volynkin <[email protected]>
Nick Volynkin (NickVolynkin) pushed a commit that referenced this pull request Apr 23, 2025
second attept of #836

- Improved reliability of version generation by handling empty or
special values safely in the process.

(cherry picked from commit e505857)
Signed-off-by: Nick Volynkin <[email protected]>
Nick Volynkin (NickVolynkin) pushed a commit that referenced this pull request Apr 23, 2025
)

Third attempt to fix #842 and
#836

tested in
https://github.com/cozystack/cozystack/actions/runs/14599981710/job/40955508728?pr=808

Signed-off-by: Andrei Kvapil <[email protected]>

**Chores**
- Improved GitHub Actions workflow to fetch full git history and tags
during pre-commit checks.

**Refactor**
- Updated script behavior to display error messages when version
extraction from git fails, making troubleshooting easier.

(cherry picked from commit a6b02bf)
Signed-off-by: Nick Volynkin <[email protected]>
Nick Volynkin (NickVolynkin) pushed a commit that referenced this pull request Apr 23, 2025
Backport of #842 to release-v0.30

second attept of #836

- Improved reliability of version generation by handling empty or
special values safely in the process.

(cherry picked from commit e505857)
Signed-off-by: Nick Volynkin <[email protected]>
Nick Volynkin (NickVolynkin) pushed a commit that referenced this pull request Apr 23, 2025
)

Backport of #845 to release-v0.30

Third attempt to fix #842 and
#836

tested in
https://github.com/cozystack/cozystack/actions/runs/14599981710/job/40955508728?pr=808

Signed-off-by: Andrei Kvapil <[email protected]>

**Chores**
- Improved GitHub Actions workflow to fetch full git history and tags
during pre-commit checks.

**Refactor**
- Updated script behavior to display error messages when version
extraction from git fails, making troubleshooting easier.

(cherry picked from commit a6b02bf)
Signed-off-by: Nick Volynkin <[email protected]>
Nick Volynkin (NickVolynkin) pushed a commit that referenced this pull request Apr 23, 2025
Backport of #836

fixes errors like this:

```
make: Entering directory '/home/runner/work/cozystack/cozystack/packages/apps'
find . -maxdepth 2 -name Chart.yaml  | awk -F/ '{print $2}' | while read i; do sed -i "s/^name: .*/name: $i/" "$i/Chart.yaml"; done
../../hack/gen_versions_map.sh
../../hack/gen_versions_map.sh: 34: [: !=: unexpected operator
fatal: Needed a single revision
make: *** [Makefile:17: gen-versions-map] Error 128
make: Leaving directory '/home/runner/work/cozystack/cozystack/packages/apps'
```
https://github.com/cozystack/cozystack/actions/runs/14591720553/job/40928276862?pr=835

Improved reliability of version generation by handling empty or
special values safely in the process.

(cherry picked from commit 7a9a1fc)

Signed-off-by: Nick Volynkin <[email protected]>
Nick Volynkin (NickVolynkin) pushed a commit that referenced this pull request Apr 23, 2025
Backport of #842 to release-v0.30

second attept of #836

- Improved reliability of version generation by handling empty or
special values safely in the process.

(cherry picked from commit e505857)
Signed-off-by: Nick Volynkin <[email protected]>
Nick Volynkin (NickVolynkin) pushed a commit that referenced this pull request Apr 23, 2025
)

Backport of #845 to release-v0.30

Third attempt to fix #842 and
#836

tested in
https://github.com/cozystack/cozystack/actions/runs/14599981710/job/40955508728?pr=808

Signed-off-by: Andrei Kvapil <[email protected]>

**Chores**
- Improved GitHub Actions workflow to fetch full git history and tags
during pre-commit checks.

**Refactor**
- Updated script behavior to display error messages when version
extraction from git fails, making troubleshooting easier.

(cherry picked from commit a6b02bf)
Signed-off-by: Nick Volynkin <[email protected]>
Nick Volynkin (NickVolynkin) pushed a commit that referenced this pull request Apr 23, 2025
Backport of #836

fixes errors like this:

```
make: Entering directory '/home/runner/work/cozystack/cozystack/packages/apps'
find . -maxdepth 2 -name Chart.yaml  | awk -F/ '{print $2}' | while read i; do sed -i "s/^name: .*/name: $i/" "$i/Chart.yaml"; done
../../hack/gen_versions_map.sh
../../hack/gen_versions_map.sh: 34: [: !=: unexpected operator
fatal: Needed a single revision
make: *** [Makefile:17: gen-versions-map] Error 128
make: Leaving directory '/home/runner/work/cozystack/cozystack/packages/apps'
```
https://github.com/cozystack/cozystack/actions/runs/14591720553/job/40928276862?pr=835

Improved reliability of version generation by handling empty or
special values safely in the process.

(cherry picked from commit 7a9a1fc)

Signed-off-by: Nick Volynkin <[email protected]>
Nick Volynkin (NickVolynkin) pushed a commit that referenced this pull request Apr 23, 2025
Backport of #842 to release-v0.30

second attept of #836

- Improved reliability of version generation by handling empty or
special values safely in the process.

(cherry picked from commit e505857)
Signed-off-by: Nick Volynkin <[email protected]>
Nick Volynkin (NickVolynkin) pushed a commit that referenced this pull request Apr 23, 2025
)

Backport of #845 to release-v0.30

Third attempt to fix #842 and
#836

tested in
https://github.com/cozystack/cozystack/actions/runs/14599981710/job/40955508728?pr=808

Signed-off-by: Andrei Kvapil <[email protected]>

**Chores**
- Improved GitHub Actions workflow to fetch full git history and tags
during pre-commit checks.

**Refactor**
- Updated script behavior to display error messages when version
extraction from git fails, making troubleshooting easier.

(cherry picked from commit a6b02bf)
Signed-off-by: Nick Volynkin <[email protected]>
Nick Volynkin (NickVolynkin) pushed a commit that referenced this pull request Apr 23, 2025
Backport of #836

fixes errors like this:

```
make: Entering directory '/home/runner/work/cozystack/cozystack/packages/apps'
find . -maxdepth 2 -name Chart.yaml  | awk -F/ '{print $2}' | while read i; do sed -i "s/^name: .*/name: $i/" "$i/Chart.yaml"; done
../../hack/gen_versions_map.sh
../../hack/gen_versions_map.sh: 34: [: !=: unexpected operator
fatal: Needed a single revision
make: *** [Makefile:17: gen-versions-map] Error 128
make: Leaving directory '/home/runner/work/cozystack/cozystack/packages/apps'
```
https://github.com/cozystack/cozystack/actions/runs/14591720553/job/40928276862?pr=835

Improved reliability of version generation by handling empty or
special values safely in the process.

(cherry picked from commit 7a9a1fc)

Signed-off-by: Nick Volynkin <[email protected]>
Nick Volynkin (NickVolynkin) pushed a commit that referenced this pull request Apr 23, 2025
Backport of #842 to release-v0.30

second attept of #836

- Improved reliability of version generation by handling empty or
special values safely in the process.

(cherry picked from commit e505857)
Signed-off-by: Nick Volynkin <[email protected]>
Nick Volynkin (NickVolynkin) pushed a commit that referenced this pull request Apr 23, 2025
)

Backport of #845 to release-v0.30

Third attempt to fix #842 and
#836

tested in
https://github.com/cozystack/cozystack/actions/runs/14599981710/job/40955508728?pr=808

Signed-off-by: Andrei Kvapil <[email protected]>

**Chores**
- Improved GitHub Actions workflow to fetch full git history and tags
during pre-commit checks.

**Refactor**
- Updated script behavior to display error messages when version
extraction from git fails, making troubleshooting easier.

(cherry picked from commit a6b02bf)
Signed-off-by: Nick Volynkin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/backport Categorizes issue or PR as requiring a backport to the current release line

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants