Install specific CLI versions - #2040
Conversation
📝 WalkthroughWalkthroughUpdated the GitHub Actions workflow to add a new "Install with bash (nightly)" step and adjusted quoting in Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
bee5400 to
f60f52e
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
.github/workflows/install.yml (1)
34-39: Consider adding a sanity check for the nightly install.The other install steps are followed by a
defang --versionsanity check. Adding one here would verify the nightly installation completed successfully.Suggested addition
- name: Install with bash (nightly) shell: bash run: bash <(curl -fsSL s.defang.io/install) nightly env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # alt name + + - name: Sanity check + run: defang --version🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/install.yml around lines 34 - 39, In the "Install with bash (nightly)" step where you run "bash <(curl -fsSL s.defang.io/install) nightly", add a follow-up sanity check that runs "defang --version" (or equivalent CLI health/version command) and fail the step if it does not return a valid exit code/output; ensure the new command is executed in the same step or as an immediately subsequent step so the workflow verifies the nightly installation completed successfully.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/bin/install`:
- Around line 36-44: The loop uses the temporary variable _arg which can leak
into the caller's environment when the script is sourced/eval'd; after the for
loop that parses arguments (where _arg is assigned and
DEFANG_INSTALL_VERSION/REPLY/CI are set) add an unset _arg (or include _arg in
the existing unset list) so the temporary variable is removed from the
environment to avoid pollution when the script is sourced.
- Around line 279-282: The FPATH presence check is using the wrong string
("site_functions" with underscore) so it never matches the actual added path
("site-functions" with hyphen); update the case pattern that tests FPATH (the
"*":$HOME/.local/share/zsh/site_functions:"*) to use the correct hyphenated
directory name ("*":$HOME/.local/share/zsh/site-functions:"*) so the conditional
around _prompt_and_append_to_file and the profile_file update behaves correctly.
---
Nitpick comments:
In @.github/workflows/install.yml:
- Around line 34-39: In the "Install with bash (nightly)" step where you run
"bash <(curl -fsSL s.defang.io/install) nightly", add a follow-up sanity check
that runs "defang --version" (or equivalent CLI health/version command) and fail
the step if it does not return a valid exit code/output; ensure the new command
is executed in the same step or as an immediately subsequent step so the
workflow verifies the nightly installation completed successfully.
🪄 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: b0288c4f-9d25-43ac-95de-a2297e5966dd
📒 Files selected for processing (2)
.github/workflows/install.ymlsrc/bin/install
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/bin/install (1)
262-262: Consider quoting shell variables for defensive scripting.While shell names (
bash,zsh) won't contain spaces, quoting variables is a POSIX best practice and prevents issues with unexpected values.Suggested changes
echo "Generating completion script at $target" mkdir -p "$(dirname "$target")" - defang completion $shell > "$target" + defang completion "$shell" > "$target" }-_install_completion_script $SHELL || true +_install_completion_script "$SHELL" || true CURRENT_SHELL=${0#-} -[ "$CURRENT_SHELL" != "$SHELL" ] && _install_completion_script $CURRENT_SHELL || true +[ "$CURRENT_SHELL" != "$SHELL" ] && _install_completion_script "$CURRENT_SHELL" || trueSimilarly for the
_generate_completion_scriptcalls inside_install_completion_script.Also applies to: 289-291
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/bin/install` at line 262, Quote shell variables in redirection and command arguments to follow POSIX defensive scripting: update the defang invocation so the $shell variable is quoted (e.g., use "$shell") and likewise quote any uses of $shell in calls to _generate_completion_script inside the _install_completion_script function; ensure all variable expansions used as arguments or in redirections (including target and shell) are wrapped in double quotes to avoid word-splitting or globbing issues.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/bin/install`:
- Around line 272-275: The check using BASH_COMPLETION_VERSINFO in the install
script is unreliable because that variable is only set in interactive shells;
replace it by testing for a bash-completion installation file instead (e.g.,
check existence/readability of /etc/bash_completion or
/usr/share/bash-completion/bash_completion) or remove the warning entirely to
avoid false positives; update the block that references BASH_COMPLETION_VERSINFO
to perform a filesystem check for bash-completion files (or skip the check) and
adjust the warning/return logic accordingly so the script only warns when those
files are absent.
---
Nitpick comments:
In `@src/bin/install`:
- Line 262: Quote shell variables in redirection and command arguments to follow
POSIX defensive scripting: update the defang invocation so the $shell variable
is quoted (e.g., use "$shell") and likewise quote any uses of $shell in calls to
_generate_completion_script inside the _install_completion_script function;
ensure all variable expansions used as arguments or in redirections (including
target and shell) are wrapped in double quotes to avoid word-splitting or
globbing issues.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
Description
ash(alpine) andshLinked Issues
Checklist
Summary by CodeRabbit
New Features
Improvements
Chores