feat: support release tag names in JBANG_DOWNLOAD_VERSION (early-access)#2480
Conversation
Numeric values (e.g. 0.120.0) continue to be resolved to the matching
vX.Y.Z GitHub release. Non-numeric values are now used as a release tag
name as-is, which makes the perpetual early-access build reachable via:
export JBANG_DOWNLOAD_VERSION=early-access
resolving to https://github.com/jbangdev/jbang/releases/download/early-access/
Applied consistently in jbang (bash) and jbang.ps1; jbang.cmd delegates
downloads to jbang.ps1 so needs no change. Docs updated in
installation.adoc. New WireMock-backed script tests verify the URL
construction for both numeric and tag-named values on bash and pwsh.
|
Important Review skippedAuto reviews are limited based on label configuration. 🏷️ Required labels (at least one) (1)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThis PR implements conditional version-to-tag mapping for ChangesJBang version tag selection
Possibly related PRs
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
src/test/java/dev/jbang/cli/TestScriptDownloadVersion.java (1)
168-202: ⚡ Quick winAdd a regression case for digit-prefixed non-numeric tags (e.g.,
1.0.0-rc1).Current tests only cover pure numeric and pure alpha tags, so the boundary where tags start with digits is untested.
Also applies to: 257-299
🤖 Prompt for 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. In `@src/test/java/dev/jbang/cli/TestScriptDownloadVersion.java` around lines 168 - 202, Add a new JUnit test in TestScriptDownloadVersion mirroring the existing tests (numericVersionGetsVPrefix and earlyAccessTagIsUsedAsIs) that verifies digit-prefixed non-numeric tags are used as-is: stub a WireMock GET for "/download/1.0.0-rc1/jbang.tar" returning createJbangTar(), invoke the bash script via runProcess(cmd, bashEnv("1.0.0-rc1")), verify WireMock received a request for "/download/1.0.0-rc1/jbang.tar", and assert stderr does not contain "Error downloading JBang".
🤖 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 `@src/main/scripts/jbang`:
- Around line 292-295: The case pattern [0-9]* treats any string starting with a
digit as numeric (so "1.0.0-rc1" becomes "v1.0.0-rc1"); update the case to
detect only wholly-numeric values and leave anything with non-digit chars
unchanged: change the branches around JBANG_DOWNLOAD_VERSION so that strings
matching "*[!0-9]*" (contain any non-digit) set jbtag="$JBANG_DOWNLOAD_VERSION"
and the fallback (all digits) prefixes with "v$JBANG_DOWNLOAD_VERSION"; update
the case that assigns jbtag accordingly.
In `@src/main/scripts/jbang.ps1`:
- Around line 162-166: The current check using -match '^[0-9]' prepends "v" for
any tag starting with a digit (e.g., "1.0.0-rc1"); change the conditional around
JBANG_DOWNLOAD_VERSION so it only treats pure numeric/semver-like versions as
numeric (e.g., use a stricter regex like '^\d+(\.\d+){0,2}$') before setting
jbtag="v$env:JBANG_DOWNLOAD_VERSION", leaving the else branch to keep
non-numeric or prerelease tags verbatim; update the if that references
$env:JBANG_DOWNLOAD_VERSION and the jbtag assignment accordingly.
In `@src/test/java/dev/jbang/cli/TestScriptDownloadVersion.java`:
- Around line 45-61: The test class TestScriptDownloadVersion currently creates
its own WireMockServer (wm) and lifecycle methods startWireMock/stopWireMock;
change the class to extend the repository BaseTest so it uses the shared
WireMock harness instead of custom setup: remove the wm field and the
startWireMock/stopWireMock methods, rely on the BaseTest-provided WireMock
instance (use the harness accessor name used by BaseTest, e.g., the shared
wireMockServer/wm field or getWireMockServer()), and update any references to wm
to use that shared instance; keep the `@TempDir` tempDir as-is.
---
Nitpick comments:
In `@src/test/java/dev/jbang/cli/TestScriptDownloadVersion.java`:
- Around line 168-202: Add a new JUnit test in TestScriptDownloadVersion
mirroring the existing tests (numericVersionGetsVPrefix and
earlyAccessTagIsUsedAsIs) that verifies digit-prefixed non-numeric tags are used
as-is: stub a WireMock GET for "/download/1.0.0-rc1/jbang.tar" returning
createJbangTar(), invoke the bash script via runProcess(cmd,
bashEnv("1.0.0-rc1")), verify WireMock received a request for
"/download/1.0.0-rc1/jbang.tar", and assert stderr does not contain "Error
downloading JBang".
🪄 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 Plus
Run ID: db9be6b6-87bc-4936-b5e7-5c88b755db00
📒 Files selected for processing (4)
docs/modules/ROOT/pages/installation.adocsrc/main/scripts/jbangsrc/main/scripts/jbang.ps1src/test/java/dev/jbang/cli/TestScriptDownloadVersion.java
…access install
- Only prefix 'v' when JBANG_DOWNLOAD_VERSION is purely dotted-numeric;
values like '1.0.0-rc1' or 'early-access' are now passed through as-is
in both bash and PowerShell startup scripts.
- Align bash glob ('*[!0-9.]*') and PowerShell regex ('^[0-9]+(\.[0-9]+)*$')
so both platforms classify the same inputs identically.
- Add TestScriptDownloadVersion regression cases for numeric, named-tag
(early-access) and digit-prefixed prerelease (1.0.0-rc1) values, run
against the real scripts via WireMock for bash and PowerShell.
- Add an early-access install snippet to the JReleaser changelog template
showing the bash and PowerShell one-liners.
- Document the version-vs-tag selection rule in installation.adoc.
|
i changed the expression sligthly so it will treat any 1.2.3-adsff as a tag with v but anything else should just be fetched directly.
|
Why
We now have a perpetual early-access release URL: https://github.com/jbangdev/jbang/releases/download/early-access/
This PR makes it reachable via the existing
JBANG_DOWNLOAD_*variables, so users can opt in with a one-liner instead of pinning a fullJBANG_DOWNLOAD_URL.What
Extend the existing
JBANG_DOWNLOAD_VERSIONsemantics rather than introduce a new variable:vprefix —0.120.0→.../download/v0.120.0/jbang.tar.early-access→.../download/early-access/jbang.tar.So this Just Works:
export JBANG_DOWNLOAD_VERSION=early-accessJBANG_DOWNLOAD_BASEURLandJBANG_DOWNLOAD_URLcontinue to behave as before for mirrors / air-gapped setups.Changes
src/main/scripts/jbang— bashcasedecides whether to prependv.src/main/scripts/jbang.ps1— same logic via-match '^[0-9]'.src/main/scripts/jbang.cmd— unchanged (delegates downloads tojbang.ps1per AGENTS.md).docs/modules/ROOT/pages/installation.adoc— new subsection "Downloading a specific version or the early-access build" and updated description in the env-var table.src/test/java/dev/jbang/cli/TestScriptDownloadVersion.java— new WireMock-backed tests running the real bash and pwsh scripts, asserting both/download/v0.120.0/jbang.{tar,zip}and/download/early-access/jbang.{tar,zip}are requested. UsesassumeTrueto skip when bash / pwsh aren't available, matching the existingTestScriptRetrystyle.Summary by CodeRabbit
New Features
JBANG_DOWNLOAD_VERSIONnow supports non-numeric release tags (e.g.,early-access) in addition to numeric versions. Numeric versions automatically receive avprefix in download URLs, while non-numeric tags are used as-is.Documentation
Tests