Fix: versions_map, use awk instead of grep - #780
Conversation
|
Warning Rate limit exceededAndrei Kvapil (@kvaps) has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 0 minutes and 24 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (1)
WalkthroughThe script Changes
Sequence Diagram(s)sequenceDiagram
participant S as gen_versions_map.sh
participant C as Chart.yaml
participant AW as awk
S->>C: Read version string
S->>AW: Execute awk with regex (vX.X.X)
AW-->>S: Return extracted version
S->>S: Compare version against expected value
Possibly related PRs
Suggested reviewers
Poem
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (4)
hack/gen_versions_map.sh (4)
22-22: Enhancement: Refine version matching regex in tag search.
The updated use ofawkto filter tags is a good move for precision. However, the regular expression/v[0-9]+.[0-9]+.[0-9]+/matches any character in place of the literal dot. Consider escaping the dot characters (i.e. use/v[0-9]+\.[0-9]+\.[0-9]+/) to ensure that only properly formatted semantic version strings (e.g.,v1.2.3) are matched.-awk -F/ '$3 ~ /v[0-9]+.[0-9]+.[0-9]+/ {print}' +awk -F/ '$3 ~ /v[0-9]+\.[0-9]+\.[0-9]+/ {print}'
29-29: Bug Risk: Unquoted command substitution may lead to word splitting.
The condition on line 29 uses command substitution without quotes, which can introduce issues if the file content contains spaces or unexpected characters. Quoting the substitution will safeguard against splitting problems.- if [ $(awk '$1 == "version:" {print $2}' ./${chart}/Chart.yaml) = "${version}" ]; then + if [ "$(awk '$1 == "version:" {print $2}' "./${chart}/Chart.yaml")" = "${version}" ]; then🧰 Tools
🪛 Shellcheck (0.10.0)
[warning] 29-29: Quote this to prevent word splitting.
(SC2046)
36-36: Bug Risk: Unquoted command substitution in version check.
Line 36’s command substitution for extracting the version from the commit’sChart.yamlshould be quoted. This prevents potential word splitting issues when comparing against the expected version value.- if [ $(git show "${commit}:./${chart}/Chart.yaml" 2>/dev/null | awk '$1 == "version:" {print $2}') != "${version}" ]; then + if [ "$(git show "${commit}:./${chart}/Chart.yaml" 2>/dev/null | awk '$1 == "version:" {print $2}')" != "${version}" ]; then🧰 Tools
🪛 Shellcheck (0.10.0)
[warning] 36-36: Quote this to prevent word splitting.
(SC2046)
49-49: Bug Risk: Protect command substitution output with quotes.
Similarly, on line 49, the command substitution output fromgit showshould be quoted to ensure a reliable and safe comparison against the version string.- if [ $(git show "${tag}:./${chart}/Chart.yaml" 2>/dev/null | awk '$1 == "version:" {print $2}') = "${version}" ]; then + if [ "$(git show "${tag}:./${chart}/Chart.yaml" 2>/dev/null | awk '$1 == "version:" {print $2}')" = "${version}" ]; then🧰 Tools
🪛 Shellcheck (0.10.0)
[warning] 49-49: Quote this to prevent word splitting.
(SC2046)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
hack/gen_versions_map.sh(2 hunks)
🧰 Additional context used
🪛 Shellcheck (0.10.0)
hack/gen_versions_map.sh
[warning] 29-29: Quote this to prevent word splitting.
(SC2046)
[warning] 36-36: Quote this to prevent word splitting.
(SC2046)
[warning] 49-49: Quote this to prevent word splitting.
(SC2046)
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
d2f66a7 to
559eb8d
Compare
Signed-off-by: Andrei Kvapil kvapss@gmail.com
Summary by CodeRabbit