From 796948d38453b27fd73ce3f2ae75cdeea65bbb1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=9B=9B=E5=AE=8F?= Date: Sat, 14 Nov 2026 22:26:21 +0800 Subject: [PATCH 1/2] [cli-release-discovery][iter-1] fix(install): select stable CLI releases and verify platform assets --- .gitea/workflows/installer-tests.yml | 31 +++++++ install | 123 ++++++++++++++++++++++++++- install.ps1 | 67 +++++++-------- tests/README.md | 23 +++++ tests/release-discovery.ps1 | 69 +++++++++++++++ tests/test.ps1 | 4 +- tests/test_cli_release_discovery.py | 120 ++++++++++++++++++++++++++ 7 files changed, 396 insertions(+), 41 deletions(-) create mode 100644 .gitea/workflows/installer-tests.yml create mode 100644 tests/README.md create mode 100644 tests/release-discovery.ps1 create mode 100644 tests/test_cli_release_discovery.py diff --git a/.gitea/workflows/installer-tests.yml b/.gitea/workflows/installer-tests.yml new file mode 100644 index 0000000..19c52e9 --- /dev/null +++ b/.gitea/workflows/installer-tests.yml @@ -0,0 +1,31 @@ +name: Installer Tests +on: + pull_request: + branches: [main] + types: [opened, synchronize, reopened] + push: + branches: [main] +permissions: + contents: read +jobs: + bash-discovery: + runs-on: docker-linux-2026-08-29 + timeout-minutes: 10 + steps: + - uses: Octopus/checkout@039ede8ebea5a92a9b189261f0336f69e59c9ecd + - name: Bash syntax and release-discovery regressions + run: | + bash -n install + python3 -m unittest discover -s tests -p 'test_cli_release_discovery.py' -v + powershell-discovery: + runs-on: windows-amd64 + timeout-minutes: 10 + steps: + - uses: Octopus/checkout@039ede8ebea5a92a9b189261f0336f69e59c9ecd + - name: PowerShell discovery and existing host-safety regressions + shell: powershell + run: | + & ./tests/release-discovery.ps1 + if ($LASTEXITCODE -and $LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + & ./tests/test.ps1 + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } diff --git a/install b/install index 8ae9846..b755cce 100755 --- a/install +++ b/install @@ -28,6 +28,125 @@ Examples: EOF } +# Parse release JSON without adding a jq/python/node dependency to curl | bash. +# Return the first public stable CLI release in API order, never a desktop tag. +# Exit 3 means this page contains no eligible release; an empty page ends paging. +select_cli_release() { + LC_ALL=C awk -v asset="$1" ' + function fail() { invalid = 1; exit 2 } + function ws() { while (substr(json, pos, 1) ~ /[ \t\r\n]/ && pos <= length(json)) pos++ } + function string( out,c,e,h,n,i,d) { + if (substr(json,pos++,1) != "\"") fail() + out = "" + while (pos <= length(json)) { + c = substr(json,pos++,1) + if (c == "\"") return out + if (c ~ /[[:cntrl:]]/) fail() + if (c == "\\") { + e = substr(json,pos++,1) + if (e == "\"" || e == "\\" || e == "/") c = e + else if (e == "b") c = sprintf("%c",8) + else if (e == "f") c = sprintf("%c",12) + else if (e == "n") c = "\n" + else if (e == "r") c = "\r" + else if (e == "t") c = "\t" + else if (e == "u") { + h = substr(json,pos,4) + if (length(h) != 4 || h ~ /[^0-9a-fA-F]/) fail() + pos += 4; n = 0 + for (i=1;i<=4;i++) { d=index("0123456789abcdef",tolower(substr(h,i,1)))-1; n=n*16+d } + # Selection fields are ASCII; non-ASCII never match CLI names. + c = n > 0 && n < 128 ? sprintf("%c",n) : "?" + } else fail() + } + out = out c + } + fail() + } + function parse(path,depth, c,key,child,n,token) { + if (depth > 64) fail() + ws(); c=substr(json,pos,1) + if (c == "{" || c == "[") { + kind[path] = c == "{" ? "object" : "array" + pos++; ws(); n=0 + if (substr(json,pos,1) == (c == "{" ? "}" : "]")) { pos++; count[path]=0; return } + while (1) { + if (c == "{") { + ws(); key=string(); ws() + if (substr(json,pos++,1) != ":") fail() + gsub(/%/,"%25",key); gsub(/\//,"%2F",key) + } else key=n + child=path "/" key + if (child in kind) fail() + parse(child,depth+1); n++; ws() + token=substr(json,pos++,1) + if (token == (c == "{" ? "}" : "]")) break + if (token != ",") fail() + } + count[path]=n + } else if (c == "\"") { kind[path]="string"; value[path]=string() } + else { + token=substr(json,pos) + if (match(token,/^(true|false|null)/)) { + value[path]=substr(token,1,RLENGTH); kind[path]="literal"; pos+=RLENGTH + } else if (match(token,/^-?(0|[1-9][0-9]*)(\.[0-9]+)?([eE][+-]?[0-9]+)?/)) { + value[path]=substr(token,1,RLENGTH); kind[path]="number"; pos+=RLENGTH + } else fail() + } + } + { json = json $0 "\n" } + END { + if (invalid) exit 2 + pos=1; parse("",0); ws() + if (pos <= length(json) || kind[""] != "array") exit 2 + if (count[""] == 0) { print "END"; exit 0 } + for (i=0;i&2 + return 1 + fi + if result=$(printf '%s' "$releases" | select_cli_release "$1"); then + if [ "$result" = "END" ]; then break; fi + printf '%s\n' "$result" + return 0 + else + status=$? + if [ "$status" = 3 ]; then continue; fi + if [ "$status" = 4 ]; then + echo "Error: Latest stable CLI release is missing platform asset $1." >&2 + else + echo "Error: Invalid CLI release metadata." >&2 + fi + return 1 + fi + done + echo "Error: No public stable CLI release found within 100 pages." >&2 + return 1 +} + requested_version=${VERSION:-} no_modify_path=false binary_path="" @@ -183,9 +302,7 @@ else fi if [ -z "$requested_version" ]; then - specific_version=$(curl -s "${GITEA_API_URL:-https://eightarms.net/api/v1}/repos/Octopus/octopus-release/releases?limit=1" | sed -n 's/.*"tag_name": *"v\([^"]*\)".*/\1/p') - - if [[ $? -ne 0 || -z "$specific_version" ]]; then + if ! specific_version=$(get_latest_cli_version "$filename"); then echo -e "${RED}Failed to fetch version information${NC}" exit 1 fi diff --git a/install.ps1 b/install.ps1 index 2391276..737922b 100644 --- a/install.ps1 +++ b/install.ps1 @@ -57,37 +57,38 @@ function Test-Avx2Support { } } -function Get-LatestVersion { - # Resolve the latest version by following the /releases/latest redirect to - # /releases/tag/vX.Y.Z. This avoids the API, which is - # rate-limited to 60 requests/hour per IP. - $latestUrl = "$baseUrl/$REPO/releases/latest" - $location = $null - $request = [System.Net.HttpWebRequest]::Create($latestUrl) - $request.Method = "HEAD" - $request.AllowAutoRedirect = $false - $request.UserAgent = "octopus-installer" - try { - $response = $request.GetResponse() - $location = $response.Headers["Location"] - $response.Close() - } catch [System.Net.WebException] { - $resp = $_.Exception.Response - if ($null -ne $resp) { - $location = $resp.Headers["Location"] - $resp.Close() +function Get-LatestVersion([string]$Filename) { + # Desktop archives share this repository. /releases/latest and limit=1 + # are not CLI selectors. Follow API order, paging past non-CLI releases. + $apiUrl = if ($env:GITEA_API_URL) { $env:GITEA_API_URL.TrimEnd('/') } else { "https://eightarms.net/api/v1" } + for ($page = 1; $page -le 100; $page++) { + $releases = @(Invoke-RestMethod -Uri "$apiUrl/repos/$REPO/releases?limit=50&page=$page" -UseBasicParsing -TimeoutSec 30 -ErrorAction Stop) + if ($releases.Count -eq 0) { return "" } + foreach ($release in $releases) { + if ($release.tag_name -cnotmatch '^v[0-9]+\.[0-9]+\.[0-9]+\z') { continue } + if ($release.draft -isnot [bool] -or $release.draft -ne $false) { continue } + if ($release.prerelease -isnot [bool] -or $release.prerelease -ne $false) { continue } + $assets = @($release.assets | Where-Object { $_.name -ceq $Filename }) + if ($assets.Count -eq 0) { + throw "Latest stable CLI release $($release.tag_name) is missing platform asset $Filename." + } + return $release.tag_name.Substring(1) } } - if (-not $location) { return "" } - if ($location -match '/tag/v?([^/]+)/?$') { - return $Matches[1] -replace '^v', '' - } - return "" + throw "No public stable CLI release found within 100 pages." } function Install-Octopus { $arch = Get-Arch + # Resolve the platform asset before discovery, so an incomplete release + # cannot be selected and a missing baseline/ARM64 archive fails clearly. + $target = "$APP-windows-$arch" + if ($arch -eq "x64" -and -not (Test-Avx2Support)) { + $target = "$APP-windows-$arch-baseline" + } + $filename = "$target.zip" + # Resolve version if ($Version -ne "") { $specificVersion = $Version -replace '^v', '' @@ -98,14 +99,14 @@ function Install-Octopus { } catch { Write-Color "Error: Release v$specificVersion not found." "Red" Write-Color "Available releases: $baseUrl/$REPO/releases" "DarkGray" - exit 1 + throw "Release resolution failed." } } else { Write-Color "Fetching latest version..." "DarkGray" - $specificVersion = Get-LatestVersion + $specificVersion = Get-LatestVersion -Filename $filename if (-not $specificVersion) { Write-Color "Error: Failed to fetch latest version." "Red" - exit 1 + throw "Failed to fetch latest CLI version." } } @@ -116,19 +117,13 @@ function Install-Octopus { $installedVersion = & $existing --version 2>$null if ($installedVersion -eq $specificVersion) { Write-Color "Version $specificVersion already installed." "DarkGray" - exit 0 + return } else { Write-Color "Installed version: $installedVersion" "DarkGray" } } catch { } } - # Build filename - $target = "$APP-windows-$arch" - if ($arch -eq "x64" -and -not (Test-Avx2Support)) { - $target = "$APP-windows-$arch-baseline" - } - $filename = "$target.zip" $downloadUrl = "$baseUrl/$REPO/releases/download/v$specificVersion/$filename" Write-Color "" @@ -147,7 +142,7 @@ function Install-Octopus { Write-Color "Error: Failed to download $downloadUrl" "Red" Write-Color $_.Exception.Message "Red" Remove-Item -Recurse -Force $tmpDir -ErrorAction SilentlyContinue - exit 1 + throw "CLI installation failed." } # Extract @@ -159,7 +154,7 @@ function Install-Octopus { if (-not (Test-Path $exeSrc)) { Write-Color "Error: $APP.exe not found in archive." "Red" Remove-Item -Recurse -Force $tmpDir -ErrorAction SilentlyContinue - exit 1 + throw "CLI installation failed." } Copy-Item -Path $exeSrc -Destination (Join-Path $INSTALL_DIR "$APP.exe") -Force Remove-Item -Recurse -Force $tmpDir -ErrorAction SilentlyContinue diff --git a/tests/README.md b/tests/README.md new file mode 100644 index 0000000..25333a9 --- /dev/null +++ b/tests/README.md @@ -0,0 +1,23 @@ +# Installer regression tests + +Offline tests; no installation or public API calls are made. + +```sh +bash -n install +python3 -m unittest discover -s tests -p 'test_cli_release_discovery.py' -v +pwsh -NoProfile -File tests/release-discovery.ps1 +pwsh -NoProfile -File tests/test.ps1 +``` + +On Windows PowerShell 5.1, replace `pwsh` with `powershell`. The Gitea workflow +runs Bash on the existing Linux pool and PowerShell on the Windows pool. + +Discovery follows Gitea release order and paginates past desktop archives, +drafts and prereleases. Only exact `vMAJOR.MINOR.PATCH` CLI tags qualify. +The first eligible release must list the detected platform archive; an +incomplete newest CLI release is an error, not a silent downgrade. + +The Bash installer uses POSIX awk (no new jq/Python/Node runtime dependency). +Tests execute its actual discovery functions with offline fixture responses. +PowerShell tests load only the discovery function via the language AST, so they +do not execute the installer. Existing host-safety tests also remain enabled. diff --git a/tests/release-discovery.ps1 b/tests/release-discovery.ps1 new file mode 100644 index 0000000..bf371e9 --- /dev/null +++ b/tests/release-discovery.ps1 @@ -0,0 +1,69 @@ +#Requires -Version 5.1 +# Offline tests: pwsh -NoProfile -File tests/release-discovery.ps1 +Set-StrictMode -Version Latest +$ErrorActionPreference = 'Stop' +$repoRoot = Split-Path -Parent $PSScriptRoot +$content = Get-Content (Join-Path $repoRoot 'install.ps1') -Raw +$tokens = $null; $errors = $null +$ast = [System.Management.Automation.Language.Parser]::ParseInput($content, [ref]$tokens, [ref]$errors) +if ($errors.Count) { throw ($errors | Out-String) } +$definition = $ast.Find({ param($node) $node -is [System.Management.Automation.Language.FunctionDefinitionAst] -and $node.Name -eq 'Get-LatestVersion' }, $true) +. ([scriptblock]::Create($definition.Extent.Text)) +$REPO = 'Octopus/octopus-release' +$env:GITEA_API_URL = 'https://fixture.invalid/api/v1' +$script:pages = @{} +$script:requests = @() +$script:failHttp = $false +function Invoke-RestMethod { + param($Uri, [switch]$UseBasicParsing, $TimeoutSec, $ErrorAction) + $script:requests += $Uri + if ($script:failHttp) { throw 'HTTP 503' } + $page = [int]([regex]::Match($Uri, 'page=([0-9]+)$').Groups[1].Value) + if ($script:pages.ContainsKey($page)) { return $script:pages[$page] } + return @() +} +function New-Release([string]$Tag = 'v1.3.1', [string]$Asset = 'octopus-windows-x64.zip') { + [pscustomobject]@{ tag_name=$Tag; draft=$false; prerelease=$false; assets=@([pscustomobject]@{name=$Asset}) } +} +$script:passed = 0 +function Assert-Equal($Actual, $Expected, [string]$Message) { + if ($Actual -cne $Expected) { throw "$Message : expected [$Expected], got [$Actual]" } + $script:passed++ +} +$script:pages = @{1=@((New-Release 'desktop-v1.3.1'), (New-Release))} +Assert-Equal (Get-LatestVersion 'octopus-windows-x64.zip') '1.3.1' 'desktop-first must select CLI' +foreach ($tag in @('desktop-beta-v1.3.1', 'cli-v1.3.1', 'V1.3.1', 'v1.4.0-rc.1', 'v1.4.0+build', 'v1.4', "v1.4.0`n")) { + $script:pages = @{1=@((New-Release $tag), (New-Release))} + Assert-Equal (Get-LatestVersion 'octopus-windows-x64.zip') '1.3.1' "reject $tag" +} +foreach ($field in @('draft', 'prerelease')) { + foreach ($flag in @($true, 'false', $null)) { + $bad = New-Release 'v2.0.0'; $bad.$field = $flag + $script:pages = @{1=@($bad, (New-Release))} + Assert-Equal (Get-LatestVersion 'octopus-windows-x64.zip') '1.3.1' "reject non-false $field" + } +} +foreach ($asset in @('octopus-windows-x64.zip', 'octopus-windows-x64-baseline.zip', 'octopus-windows-arm64.zip')) { + $script:pages = @{1=@((New-Release 'desktop-v1.3.1'), (New-Release 'v1.3.1' $asset))} + Assert-Equal (Get-LatestVersion $asset) '1.3.1' "asset $asset" +} +$script:pages = @{1=@((New-Release 'desktop-v1.3.1')); 2=@((New-Release))} +$script:requests = @() +Assert-Equal (Get-LatestVersion 'octopus-windows-x64.zip') '1.3.1' 'pagination' +Assert-Equal $script:requests.Count 2 'must fetch next page' +$script:pages = @{1=@((New-Release 'desktop-v1.3.1'))} +Assert-Equal (Get-LatestVersion 'octopus-windows-x64.zip') '' 'empty end' +$script:pages = @{1=@((New-Release 'v1.3.1' 'wrong.zip'), (New-Release 'v1.3.0'))} +$caught = $false +try { Get-LatestVersion 'octopus-windows-x64.zip' | Out-Null } catch { $caught = $_.Exception.Message -like '*missing platform asset*' } +Assert-Equal $caught $true 'missing asset fails, no silent downgrade' +$script:pages = @{1=@((New-Release 'v1.3.1' 'OCTOPUS-WINDOWS-X64.ZIP'))} +$caught = $false +try { Get-LatestVersion 'octopus-windows-x64.zip' | Out-Null } catch { $caught = $true } +Assert-Equal $caught $true 'asset name is case-sensitive' +$script:failHttp = $true +$caught = $false +try { Get-LatestVersion 'octopus-windows-x64.zip' | Out-Null } catch { $caught = $_.Exception.Message -eq 'HTTP 503' } +Assert-Equal $caught $true 'HTTP error fails closed' +if ($content -notmatch 'Get-LatestVersion -Filename \$filename') { throw 'detected platform asset must be passed into discovery' } +Write-Host "PASS: $script:passed discovery assertions; full installer parses cleanly." diff --git a/tests/test.ps1 b/tests/test.ps1 index e8865ef..5d798c2 100644 --- a/tests/test.ps1 +++ b/tests/test.ps1 @@ -56,10 +56,10 @@ try { Write-Output ("RESULT=$r") '@.Replace("__INSTALL__", $installScript) -$tmp = Join-Path $env:TEMP ("octopus_iex_test_" + $PID + ".ps1") +$tmp = Join-Path ([System.IO.Path]::GetTempPath()) ("octopus_iex_test_" + $PID + ".ps1") Set-Content -Path $tmp -Value $inner -Encoding UTF8 try { - $childOut = (& powershell -NoProfile -File $tmp 2>&1 | Out-String) + $childOut = (& (Get-Process -Id $PID).Path -NoProfile -File $tmp 2>&1 | Out-String) } finally { Remove-Item $tmp -ErrorAction SilentlyContinue } diff --git a/tests/test_cli_release_discovery.py b/tests/test_cli_release_discovery.py new file mode 100644 index 0000000..6e58901 --- /dev/null +++ b/tests/test_cli_release_discovery.py @@ -0,0 +1,120 @@ +#!/usr/bin/env python3 +# Offline behavioral tests of the actual Bash installer discovery functions. +# python3 -m unittest discover -s tests -p 'test_cli_release_discovery.py' -v +import json +import os +from pathlib import Path +import subprocess +import tempfile +import unittest + +ROOT = Path(__file__).resolve().parents[1] +SOURCE = (ROOT / "install").read_text() +FUNCTIONS = SOURCE[SOURCE.index("select_cli_release() {"):SOURCE.index("requested_version=${VERSION:-}")] +ASSET = "octopus-linux-x64.tar.gz" + + +def release(tag="v1.3.1"): + return dict(tag_name=tag, draft=False, prerelease=False, assets=[dict(name=ASSET)]) + + +class DiscoveryTests(unittest.TestCase): + def select(self, releases, asset=ASSET, raw=False): + data = releases if raw else json.dumps(releases, ensure_ascii=True, indent=2) + return subprocess.run(["bash", "-c", FUNCTIONS + '\nselect_cli_release "$1"', "test", asset], + input=data, text=True, capture_output=True) + + def test_desktop_archive_first(self): + desktop = release("desktop-v1.3.1") + desktop["body"] = 'Notes with braces { [ ], escaped "tag_name": "v99.0.0" and unicode δΈ­ζ–‡' + result = self.select([desktop, release()]) + self.assertEqual((result.returncode, result.stdout.strip()), (0, "1.3.1")) + + def test_raw_utf8_release_notes(self): + item = release("desktop-v1.3.1") + item["body"] = "δΈ­ζ–‡ notes with emoji πŸš€ and punctuation β€”" + data = json.dumps([item, release()], ensure_ascii=False) + result = self.select(data, raw=True) + self.assertEqual((result.returncode, result.stdout.strip()), (0, "1.3.1")) + + def test_only_exact_stable_cli_tags(self): + bad = [release(tag) for tag in ["desktop-beta-v1.3.1", "cli-v1.3.1", "V1.3.1", "v1.4.0-rc.1", "v1.4.0+build", "v1.4", "v1.4.0\n"]] + for field, value in [("draft", True), ("prerelease", True), ("draft", "false"), ("prerelease", None)]: + item = release("v2.0.0"); item[field] = value; bad.append(item) + result = self.select(bad + [release()]) + self.assertEqual((result.returncode, result.stdout.strip()), (0, "1.3.1")) + + def test_missing_platform_asset_is_not_silent_downgrade(self): + latest = release(); latest["assets"] = [dict(name="octopus-desktop-linux-x86_64.AppImage")] + self.assertEqual(self.select([latest, release("v1.3.0")]).returncode, 4) + + def test_each_supported_archive_name(self): + for asset in ["octopus-darwin-arm64.zip", "octopus-darwin-x64-baseline.zip", "octopus-linux-x64-musl.tar.gz", "octopus-windows-arm64.zip", "octopus-windows-x64-baseline.zip"]: + with self.subTest(asset=asset): + item = release(); item["assets"] = [dict(name=asset)] + result = self.select([release("desktop-v1.3.1"), item], asset) + self.assertEqual(result.stdout.strip(), "1.3.1") + self.assertEqual(result.returncode, 0) + + def test_asset_match_is_exact(self): + self.assertEqual(self.select([release()], ASSET.upper()).returncode, 4) + + def test_no_candidate_and_empty_page_have_distinct_results(self): + self.assertEqual(self.select([release("desktop-v1.3.1")]).returncode, 3) + result = self.select([]) + self.assertEqual((result.returncode, result.stdout.strip()), (0, "END")) + + def test_reject_malformed_or_non_array_json(self): + for raw in ['{"message":"rate limited"}', '[', '[{}] garbage', '[{"tag_name":"v1.3.1",}]', 'null', '[1]', '[{"a":1,"a":2}]']: + with self.subTest(raw=raw): + self.assertEqual(self.select(raw, raw=True).returncode, 2) + + def test_unicode_escaped_ascii_fields(self): + data = json.dumps([release()]).replace('v1.3.1', r'v1\u002e3.1') + self.assertEqual(self.select(data, raw=True).stdout.strip(), "1.3.1") + + def fetch(self, pages, fail=False): + with tempfile.TemporaryDirectory() as directory: + for i, page in enumerate(pages, 1): + Path(directory, f"{i}.json").write_text(json.dumps(page)) + script = FUNCTIONS + r''' +curl() { + local url="${@: -1}" page + printf '%s\n' "$url" >> "$FIXTURES/requests" + if [ "$CURL_FAIL" = 1 ]; then return 22; fi + page="${url##*page=}" + if [ -f "$FIXTURES/$page.json" ]; then + while IFS= read -r line || [ -n "$line" ]; do printf '%s\n' "$line"; done < "$FIXTURES/$page.json" + else printf '[]'; fi +} +get_latest_cli_version "$1" +''' + env = dict(os.environ, FIXTURES=directory, CURL_FAIL="1" if fail else "0", GITEA_API_URL="https://fixture.invalid/api/v1") + result = subprocess.run(["bash", "-c", script, "test", ASSET], text=True, capture_output=True, env=env) + requests = Path(directory, "requests").read_text().splitlines() + return result, requests + + def test_paginates_past_desktop_only_page(self): + result, requests = self.fetch([[release("desktop-v1.3.1")], [release()]]) + self.assertEqual((result.returncode, result.stdout.strip()), (0, "1.3.1")) + self.assertEqual(len(requests), 2) + self.assertTrue(requests[1].endswith("limit=50&page=2")) + + def test_empty_end_fails_without_downloading(self): + result, requests = self.fetch([[release("desktop-v1.3.1")], []]) + self.assertNotEqual(result.returncode, 0) + self.assertIn("No public stable CLI release", result.stderr) + self.assertEqual(len(requests), 2) + + def test_http_error_fails_closed(self): + result, requests = self.fetch([[release()]], fail=True) + self.assertNotEqual(result.returncode, 0) + self.assertEqual(len(requests), 1) + + def test_installer_passes_detected_asset_to_discovery(self): + self.assertIn('specific_version=$(get_latest_cli_version "$filename")', SOURCE) + self.assertNotIn('releases?limit=1"', SOURCE) + + +if __name__ == "__main__": + unittest.main() From 9b792f5378db68086fcf72b96ec85d972c0d7a60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=9B=9B=E5=AE=8F?= Date: Sat, 14 Nov 2026 22:27:26 +0800 Subject: [PATCH 2/2] [cli-release-discovery][iter-2] test(install): keep host-safety regression offline --- tests/test.ps1 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/test.ps1 b/tests/test.ps1 index 5d798c2..90507b9 100644 --- a/tests/test.ps1 +++ b/tests/test.ps1 @@ -46,6 +46,9 @@ Assert-True $parseOk "install.ps1 must parse without syntax errors." $inner = @' $ErrorActionPreference = "Stop" $env:OCTOPUS_DOWNLOAD_BASE = "http://127.0.0.1:1" +$env:GITEA_API_URL = "http://127.0.0.1:1/api/v1" +$env:PROCESSOR_ARCHITECTURE = "AMD64" +$env:USERPROFILE = [System.IO.Path]::GetTempPath() $r = "nothing" try { Invoke-Expression (Get-Content -Raw "__INSTALL__")