From 73553c3e59eed35a60a2c8830f757e1b90d1ddc9 Mon Sep 17 00:00:00 2001 From: Eliran Cohen Date: Tue, 7 Jul 2026 08:34:27 +0300 Subject: [PATCH 1/2] Banners show the release version via git describe Instead of removing versions outright, derive them: banners display the latest git tag (e.g. v5.2.0, or v5.2.0-3-gabc123 when ahead of the tag) resolved at runtime, and stay silent for ZIP copies without .git. One source of truth - the tag - so banners can never drift again the way the hardcoded 4.3 / 4.3.3 / 4.4.0 / 1.0 set did. Co-Authored-By: Claude Opus 4.8 (1M context) --- AGENTS.md | 2 +- windows/stage0-winget.ps1 | 10 +++++++++- windows/stage1-windows.ps1 | 10 +++++++++- windows/stage3-vscode.ps1 | 10 +++++++++- windows/wsl-tools.ps1 | 10 +++++++++- wsl/stage2-ubuntu.sh | 6 +++++- 6 files changed, 42 insertions(+), 6 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 8b790a4..a0e5248 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -22,7 +22,7 @@ Provisioning kit for Windows 10/11 + WSL2 Ubuntu dev machines. Bash + PowerShell - **Supply chain**: pinned version + in-repo SHA256 where upstream artifacts are stable (Go, nvm installer — use these as the model). Checksum mismatch = hard fail; network failure = `log_warn` and continue. - **Windows stays clean**: never install dev runtimes on the Windows host. - **verify-setup.sh is read-only** and its check count (52) is quoted in README + docs — update all three together if you add checks. -- Version numbers live in `CHANGELOG.md` only — no version strings in script headers or banners. +- Version numbers live in `CHANGELOG.md` and git tags only — never hardcode a version in a script header or banner. Banners show the runtime `git describe --tags` result (empty for ZIP copies), so they can't drift. ## Conventions diff --git a/windows/stage0-winget.ps1 b/windows/stage0-winget.ps1 index 5043c91..cf6a414 100644 --- a/windows/stage0-winget.ps1 +++ b/windows/stage0-winget.ps1 @@ -88,10 +88,18 @@ function Install-NerdFont { } } +# Release version = latest git tag when run from a clone; empty for ZIP +# downloads (no .git) or when git is missing. History: CHANGELOG.md / tags. +$DevkitVersion = "" +try { + $tag = git -C $PSScriptRoot describe --tags 2>$null + if ($LASTEXITCODE -eq 0 -and $tag) { $DevkitVersion = " $tag" } +} catch { } + try { Clear-Host Write-Host "==========================================" -ForegroundColor Cyan - Write-Host " Windows App Bootstrap (winget)" -ForegroundColor Cyan + Write-Host " Windows App Bootstrap (winget)$DevkitVersion" -ForegroundColor Cyan Write-Host "==========================================" -ForegroundColor Cyan # ----- winget must exist AND actually run ----- diff --git a/windows/stage1-windows.ps1 b/windows/stage1-windows.ps1 index adc85b6..aea2a0a 100644 --- a/windows/stage1-windows.ps1 +++ b/windows/stage1-windows.ps1 @@ -59,6 +59,14 @@ function Write-Err { Write-Host " [X] $Message" -ForegroundColor Red } +# Release version = latest git tag when run from a clone; empty for ZIP +# downloads (no .git) or when git is missing. History: CHANGELOG.md / tags. +$DevkitVersion = "" +try { + $tag = git -C $PSScriptRoot describe --tags 2>$null + if ($LASTEXITCODE -eq 0 -and $tag) { $DevkitVersion = " $tag" } +} catch { } + try { # =========================================== @@ -67,7 +75,7 @@ try { Clear-Host Write-Host "" Write-Host "==========================================" -ForegroundColor Cyan -Write-Host " WSL2 Development Environment" -ForegroundColor Cyan +Write-Host " WSL2 Development Environment$DevkitVersion" -ForegroundColor Cyan Write-Host " Stage 1: Windows Configuration" -ForegroundColor Cyan Write-Host " Supports: Windows 10 (2004+) & Windows 11" -ForegroundColor Cyan Write-Host "==========================================" -ForegroundColor Cyan diff --git a/windows/stage3-vscode.ps1 b/windows/stage3-vscode.ps1 index 83ce215..a4ace4f 100644 --- a/windows/stage3-vscode.ps1 +++ b/windows/stage3-vscode.ps1 @@ -14,13 +14,21 @@ function Write-Success { param([string]$Message); Write-Host " [OK] $Message" function Write-Warn { param([string]$Message); Write-Host " [!] $Message" -ForegroundColor Yellow } function Write-Err { param([string]$Message); Write-Host " [X] $Message" -ForegroundColor Red } +# Release version = latest git tag when run from a clone; empty for ZIP +# downloads (no .git) or when git is missing. History: CHANGELOG.md / tags. +$DevkitVersion = "" +try { + $tag = git -C $PSScriptRoot describe --tags 2>$null + if ($LASTEXITCODE -eq 0 -and $tag) { $DevkitVersion = " $tag" } +} catch { } + # =========================================== # Header # =========================================== Clear-Host Write-Host "" Write-Host "==========================================" -ForegroundColor Cyan -Write-Host " VSCode/Cursor Configuration" -ForegroundColor Cyan +Write-Host " VSCode/Cursor Configuration$DevkitVersion" -ForegroundColor Cyan Write-Host " Stage 3: Extensions & Settings" -ForegroundColor Cyan Write-Host "==========================================" -ForegroundColor Cyan diff --git a/windows/wsl-tools.ps1 b/windows/wsl-tools.ps1 index ad0624d..2f10fbc 100644 --- a/windows/wsl-tools.ps1 +++ b/windows/wsl-tools.ps1 @@ -10,6 +10,14 @@ param( $ErrorActionPreference = "Stop" +# Release version = latest git tag when run from a clone; empty for ZIP +# downloads (no .git) or when git is missing. History: CHANGELOG.md / tags. +$DevkitVersion = "" +try { + $tag = git -C $PSScriptRoot describe --tags 2>$null + if ($LASTEXITCODE -eq 0 -and $tag) { $DevkitVersion = " $tag" } +} catch { } + # wsl.exe's OWN subcommands (--list/--version/--status) emit UTF-16 (LE) with # embedded nulls. Do NOT force [Console]::OutputEncoding globally: that would also # mangle the UTF-8 passthrough from 'wsl -- ' (e.g. apt output, which @@ -84,7 +92,7 @@ function Show-Header { Clear-Host Write-Host "" Write-Host "==========================================" -ForegroundColor Cyan - Write-Host " WSL Management Tools" -ForegroundColor Cyan + Write-Host " WSL Management Tools$DevkitVersion" -ForegroundColor Cyan Write-Host "==========================================" -ForegroundColor Cyan } diff --git a/wsl/stage2-ubuntu.sh b/wsl/stage2-ubuntu.sh index ed27456..b602d29 100755 --- a/wsl/stage2-ubuntu.sh +++ b/wsl/stage2-ubuntu.sh @@ -76,10 +76,14 @@ pause_enter() { $NONINTERACTIVE || read -r -p "$1" _ || true; } # =========================================== # Header # =========================================== +# Release version = latest git tag when run from a clone; empty when the +# script was copied standalone. History: CHANGELOG.md / release tags. +DEVKIT_VERSION=$(git -C "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" describe --tags 2>/dev/null || true) + clear || true # don't let a missing TTY (piped/CI run) abort under 'set -e' echo "" echo -e "${CYAN}==========================================${NC}" -echo -e "${CYAN} Ubuntu Development Environment${NC}" +echo -e "${CYAN} Ubuntu Development Environment${DEVKIT_VERSION:+ $DEVKIT_VERSION}${NC}" echo -e "${CYAN}==========================================${NC}" echo "" From d6393641aef18e6e0fbdcd54e85ffedbd3a1c72f Mon Sep 17 00:00:00 2001 From: Eliran Cohen Date: Tue, 7 Jul 2026 08:41:48 +0300 Subject: [PATCH 2/2] Reset LASTEXITCODE after the version probe git describe exits 128 in tagless/shallow checkouts (and ZIP copies); the try/catch handles the error but the exit code leaked - CI's powershell wrapper ends with `exit $LASTEXITCODE`, failing the step even though the script succeeded. Caught by the Windows 5.1 CI job. Co-Authored-By: Claude Opus 4.8 (1M context) --- windows/stage0-winget.ps1 | 3 +++ windows/stage1-windows.ps1 | 3 +++ windows/stage3-vscode.ps1 | 3 +++ windows/wsl-tools.ps1 | 3 +++ 4 files changed, 12 insertions(+) diff --git a/windows/stage0-winget.ps1 b/windows/stage0-winget.ps1 index cf6a414..24d9152 100644 --- a/windows/stage0-winget.ps1 +++ b/windows/stage0-winget.ps1 @@ -95,6 +95,9 @@ try { $tag = git -C $PSScriptRoot describe --tags 2>$null if ($LASTEXITCODE -eq 0 -and $tag) { $DevkitVersion = " $tag" } } catch { } +# git exits 128 when there's no repo/tags; don't let that leak as the script's +# exit code (CI's shell wrapper ends with `exit $LASTEXITCODE`) +$global:LASTEXITCODE = 0 try { Clear-Host diff --git a/windows/stage1-windows.ps1 b/windows/stage1-windows.ps1 index aea2a0a..69b84e6 100644 --- a/windows/stage1-windows.ps1 +++ b/windows/stage1-windows.ps1 @@ -66,6 +66,9 @@ try { $tag = git -C $PSScriptRoot describe --tags 2>$null if ($LASTEXITCODE -eq 0 -and $tag) { $DevkitVersion = " $tag" } } catch { } +# git exits 128 when there's no repo/tags; don't let that leak as the script's +# exit code (CI's shell wrapper ends with `exit $LASTEXITCODE`) +$global:LASTEXITCODE = 0 try { diff --git a/windows/stage3-vscode.ps1 b/windows/stage3-vscode.ps1 index a4ace4f..f74a0a4 100644 --- a/windows/stage3-vscode.ps1 +++ b/windows/stage3-vscode.ps1 @@ -21,6 +21,9 @@ try { $tag = git -C $PSScriptRoot describe --tags 2>$null if ($LASTEXITCODE -eq 0 -and $tag) { $DevkitVersion = " $tag" } } catch { } +# git exits 128 when there's no repo/tags; don't let that leak as the script's +# exit code (CI's shell wrapper ends with `exit $LASTEXITCODE`) +$global:LASTEXITCODE = 0 # =========================================== # Header diff --git a/windows/wsl-tools.ps1 b/windows/wsl-tools.ps1 index 2f10fbc..2779185 100644 --- a/windows/wsl-tools.ps1 +++ b/windows/wsl-tools.ps1 @@ -17,6 +17,9 @@ try { $tag = git -C $PSScriptRoot describe --tags 2>$null if ($LASTEXITCODE -eq 0 -and $tag) { $DevkitVersion = " $tag" } } catch { } +# git exits 128 when there's no repo/tags; don't let that leak as the script's +# exit code (CI's shell wrapper ends with `exit $LASTEXITCODE`) +$global:LASTEXITCODE = 0 # wsl.exe's OWN subcommands (--list/--version/--status) emit UTF-16 (LE) with # embedded nulls. Do NOT force [Console]::OutputEncoding globally: that would also