Skip to content

Commit fbb5c01

Browse files
fix(installer): pin phase 3 CLI release
Let Harness sources declare the CLI release tag used by remote installs. Pin Phase 3 to harness-cli-v0.1.4 so branch installs fetch a CLI built from the Phase 3 code instead of the latest main release.
1 parent b05d4b4 commit fbb5c01

3 files changed

Lines changed: 41 additions & 3 deletions

File tree

scripts/README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,11 @@ payload.
113113

114114
By default the installer also downloads the prebuilt Rust Harness CLI for the
115115
current platform into `scripts/bin/harness-cli` and verifies its `.sha256`
116-
checksum before making it executable. Set `HARNESS_CLI_BASE_URL` to point at an
117-
alternate release artifact directory, such as a local `file:///.../dist`
116+
checksum before making it executable. A source branch can pin the release used
117+
by the installer through `scripts/harness-cli-release-tag`; Phase 3 pins
118+
`harness-cli-v0.1.4` so branch installs receive a Phase 3-built CLI. Set
119+
`HARNESS_CLI_RELEASE_TAG` to override that tag, or set `HARNESS_CLI_BASE_URL` to
120+
point at an alternate artifact directory, such as a local `file:///.../dist`
118121
directory created by `scripts/build-harness-cli-release.sh`.
119122

120123
## Schema Migrations

scripts/harness-cli-release-tag

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
harness-cli-v0.1.4

scripts/install-harness.sh

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,40 @@ download_file() {
364364
curl -fsSL "$url" -o "$target" || fail "Could not download $url"
365365
}
366366

367+
read_cli_release_tag() {
368+
local tag_file="scripts/harness-cli-release-tag"
369+
local tag=""
370+
371+
if [ "$SOURCE_MODE" = "local" ]; then
372+
if [ -f "$SOURCE_ROOT/$tag_file" ]; then
373+
tag="$(awk 'NF && $1 !~ /^#/ { print $1; exit }' "$SOURCE_ROOT/$tag_file")"
374+
fi
375+
else
376+
local tmp_file
377+
tmp_file="$(mktemp)"
378+
if curl -fsSL "$SOURCE_BASE_URL/$tag_file" -o "$tmp_file" 2>/dev/null; then
379+
tag="$(awk 'NF && $1 !~ /^#/ { print $1; exit }' "$tmp_file")"
380+
fi
381+
rm -f "$tmp_file"
382+
fi
383+
384+
printf '%s\n' "$tag"
385+
}
386+
387+
default_cli_base_url() {
388+
local release_tag="${HARNESS_CLI_RELEASE_TAG:-}"
389+
390+
if [ -z "$release_tag" ]; then
391+
release_tag="$(read_cli_release_tag)"
392+
fi
393+
394+
if [ -n "$release_tag" ] && [ "$release_tag" != "latest" ]; then
395+
printf 'https://github.com/hoangnb24/harness-experimental/releases/download/%s\n' "$release_tag"
396+
else
397+
printf 'https://github.com/hoangnb24/harness-experimental/releases/latest/download\n'
398+
fi
399+
}
400+
367401
install_harness_cli_binary() {
368402
[ "$INSTALL_RUST_CLI" -eq 1 ] || return 0
369403

@@ -598,7 +632,7 @@ if [ -n "$SCRIPT_DIR" ] && [ -f "$SCRIPT_DIR/../AGENTS.md" ] && [ -f "$SCRIPT_DI
598632
fi
599633

600634
if [ -z "$CLI_BASE_URL" ]; then
601-
CLI_BASE_URL="https://github.com/hoangnb24/harness-experimental/releases/latest/download"
635+
CLI_BASE_URL="$(default_cli_base_url)"
602636
fi
603637

604638
if [ "$YES" -eq 0 ] && can_prompt; then

0 commit comments

Comments
 (0)