-
-
Notifications
You must be signed in to change notification settings - Fork 28
Fixed Lagoon CLI download in scripts. #1843
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThe default Lagoon CLI version was updated from "latest" to "v0.32.0" across documentation and deployment scripts. The scripts for deploying and running custom tasks were refactored to simplify and standardize the download logic for the Lagoon CLI binary, removing dynamic version detection and JSON parsing in favor of direct URL construction. Changes
Sequence Diagram(s)sequenceDiagram
participant Script as Deploy/Task Script
participant GitHub as GitHub Releases
participant System as Local System
Script->>System: Detect platform and architecture
Script->>Script: Construct Lagoon CLI download URL with version v0.32.0
Script->>GitHub: Download Lagoon CLI binary
GitHub-->>Script: Serve binary file
Script->>System: Make binary executable and update PATH
Estimated code review effort🎯 2 (Simple) | ⏱️ ~7 minutes Poem
✨ Finishing Touches
🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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 (
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #1843 +/- ##
===========================================
+ Coverage 75.01% 75.05% +0.04%
===========================================
Files 84 84
Lines 4839 4835 -4
Branches 35 35
===========================================
- Hits 3630 3629 -1
+ Misses 1209 1206 -3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
15a76c7 to
6e76309
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
♻️ Duplicate comments (1)
scripts/vortex/task-custom-lagoon.sh (1)
50-52: Same version-pin concern as in deploy scriptKeep an eye on manual version bumps here as well; the two scripts must stay aligned.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (3)
.vortex/docs/content/workflows/variables.mdx(1 hunks)scripts/vortex/deploy-lagoon.sh(2 hunks)scripts/vortex/task-custom-lagoon.sh(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (13)
- GitHub Check: build (1)
- GitHub Check: build (0)
- GitHub Check: vortex-test-deployment (1)
- GitHub Check: vortex-test-workflow (1)
- GitHub Check: vortex-test-workflow (2)
- GitHub Check: vortex-test-workflow (3)
- GitHub Check: vortex-test-workflow (0)
- GitHub Check: vortex-test-deployment (0)
- GitHub Check: vortex-test-common
- GitHub Check: vortex-test-installer (8.3)
- GitHub Check: vortex-test-installer (8.2)
- GitHub Check: vortex-test-installer (8.4)
- GitHub Check: vortex-test-docs
🔇 Additional comments (2)
.vortex/docs/content/workflows/variables.mdx (1)
1192-1198: Pinning the default Lagoon CLI version means manual bumps in the futureMoving from
latestto a hard-coded tag (v0.32.0) stabilises builds, but remember the trade-off: every CLI release now requires a coordinated commit to keep scripts & docs in sync.
Consider adding a short note here (or in the README) telling maintainers how/when to update this value to avoid silent drift.scripts/vortex/deploy-lagoon.sh (1)
68-70: Hard-coding the CLI version may break consumers that rely on “latest”If a downstream environment still sets
VORTEX_LAGOONCLI_VERSION=latest, the new default will silently override it tov0.32.0.
Double-check that no CI jobs / local setups depend on auto-upgrading to the newest CLI.
| platform=$(uname -s | tr '[:upper:]' '[:lower:]') | ||
| arch_suffix=$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/') | ||
|
|
||
| download_url="https://github.com/uselagoon/lagoon-cli/releases/latest/download/lagoon-cli-${platform}-${arch_suffix}" | ||
| if [ "${VORTEX_LAGOONCLI_VERSION}" != "latest" ]; then | ||
| download_url="https://github.com/uselagoon/lagoon-cli/releases/download/${VORTEX_LAGOONCLI_VERSION}/lagoon-cli-${platform}-${arch_suffix}" | ||
| fi | ||
| download_url="https://github.com/uselagoon/lagoon-cli/releases/download/${VORTEX_LAGOONCLI_VERSION}/lagoon-cli-${VORTEX_LAGOONCLI_VERSION}-${platform}-${arch_suffix}" | ||
|
|
||
| note "Downloading Lagoon CLI from ${download_url}." | ||
| curl -L -o "${VORTEX_LAGOONCLI_PATH}/lagoon" "${download_url}" | ||
| curl -fSLs -o "${VORTEX_LAGOONCLI_PATH}/lagoon" "${download_url}" | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Download URL construction assumes the binary is shipped plain, not .tar.gz
The asset pattern is:
https://github.com/uselagoon/lagoon-cli/releases/download/${ver}/lagoon-cli-${ver}-${os}-${arch}
For some older/newer releases GitHub publishes ….tar.gz archives instead of raw binaries. If that happens the curl will fetch a gzipped file, mark it executable, and execve will fail with “Exec format error”.
Recommend adding a quick mime/extension check & fallback to *.tar.gz extraction:
- download_url="https://github.com/uselagoon/lagoon-cli/releases/download/${VORTEX_LAGOONCLI_VERSION}/lagoon-cli-${VORTEX_LAGOONCLI_VERSION}-${platform}-${arch_suffix}"
+base="https://github.com/uselagoon/lagoon-cli/releases/download/${VORTEX_LAGOONCLI_VERSION}"
+for candidate in \
+ "lagoon-cli-${VORTEX_LAGOONCLI_VERSION}-${platform}-${arch_suffix}" \
+ "lagoon-cli-${VORTEX_LAGOONCLI_VERSION}-${platform}-${arch_suffix}.tar.gz"; do
+ if curl --head -fsSL "${base}/${candidate}" >/dev/null; then
+ download_url="${base}/${candidate}"
+ break
+ fi
+done
+
+[[ -z "${download_url:-}" ]] && fail "Unable to locate Lagoon CLI asset" && exit 1Committable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In scripts/vortex/deploy-lagoon.sh around lines 107 to 113, the download URL
assumes the Lagoon CLI binary is a plain executable, but some releases provide a
.tar.gz archive instead. To fix this, after downloading, check if the file is a
gzip archive by inspecting its mime type or file extension. If it is a .tar.gz,
extract the binary from the archive to the target path instead of using the
downloaded file directly. This ensures the executable is valid and prevents exec
format errors.
| platform=$(uname -s | tr '[:upper:]' '[:lower:]') | ||
| arch_suffix=$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/') | ||
| download_url="https://github.com/uselagoon/lagoon-cli/releases/download/${VORTEX_LAGOONCLI_VERSION}/lagoon-cli-${VORTEX_LAGOONCLI_VERSION}-${platform}-${arch_suffix}" | ||
|
|
||
| curl -sL "${lagooncli_download_url}" | | ||
| grep "browser_download_url" | | ||
| grep -i "$(uname -s)-amd64\"$" | | ||
| cut -d '"' -f 4 | | ||
| xargs curl -L -o "${VORTEX_LAGOONCLI_PATH}/lagoon" | ||
| note "Downloading Lagoon CLI from ${download_url}." | ||
| curl -fSLs -o "${VORTEX_LAGOONCLI_PATH}/lagoon" "${download_url}" | ||
|
|
||
| note "Installing Lagoon CLI to ${VORTEX_LAGOONCLI_PATH}/lagoon." | ||
| chmod +x "${VORTEX_LAGOONCLI_PATH}/lagoon" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick (assertive)
Duplicated installer logic – consider extracting into a helper
deploy-lagoon.sh and task-custom-lagoon.sh now carry identical 20-line blocks for platform detection, URL building, download & chmod. Moving this into scripts/vortex/_install-lagoon-cli.sh (or similar) would DRY the code and ensure future fixes are applied once.
No functional blocker, just a maintainability win.
🤖 Prompt for AI Agents
In scripts/vortex/task-custom-lagoon.sh around lines 76 to 84, the code for
platform detection, URL construction, downloading, and setting permissions for
the Lagoon CLI is duplicated from deploy-lagoon.sh. To improve maintainability,
extract this repeated installer logic into a new helper script, such as
scripts/vortex/_install-lagoon-cli.sh, and replace the duplicated block in both
scripts with a call to this helper. This will centralize the installation logic
and simplify future updates.
Summary by CodeRabbit