Skip to content

Commit 39bca02

Browse files
committed
ci(windows): parameterize release version and source commit
Build the Windows packages for a given windows-branch commit and release version from two workflow settings instead of hardcoded values. Dry run for 0.1.9 against windows 28de567. Signed-off-by: Rahool Paliwal <rpaliwal@nvidia.com>
1 parent 59ad0ec commit 39bca02

9 files changed

Lines changed: 30 additions & 25 deletions

File tree

‎.github/workflows/windows-packages.yml‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@ name: Windows signing candidates
22

33
on:
44
push:
5-
branches: [shailendra-nv/windows-security-handoff]
5+
branches: [windows-release-dryrun/nv-rahool]
66
paths: ['.github/workflows/windows-packages.yml', 'packaging/windows/**']
77
workflow_dispatch:
88

99
permissions:
1010
contents: read
1111

1212
env:
13-
SOURCE_SHA: e39791be4f47ed6fb6357885ef42ca1339320679
14-
SETUPTOOLS_SCM_PRETEND_VERSION_FOR_OPENSHELL: 0.1.8
13+
SOURCE_SHA: 28de5674feb1702290f746a70c3e6aba884a6f85
14+
RELEASE_VERSION: 0.1.9
15+
SETUPTOOLS_SCM_PRETEND_VERSION_FOR_OPENSHELL: 0.1.9
1516

1617
jobs:
1718
native:
1819
name: Native build (${{ matrix.arch }})
19-
if: github.repository == 'NVIDIA/OpenShell'
2020
strategy:
2121
fail-fast: false
2222
matrix:
@@ -105,9 +105,9 @@ jobs:
105105
mise run --skip-tools sdk:ts:ci
106106
mise run --skip-tools test:python
107107
mkdir sdk-artifacts
108-
cp target/wheels/openshell-0.1.8-py3-none-any.whl sdk-artifacts/
108+
cp target/wheels/openshell-${{ env.RELEASE_VERSION }}-py3-none-any.whl sdk-artifacts/
109109
cd sdk/typescript
110-
npm version 0.1.8 --no-git-tag-version --ignore-scripts
110+
npm version ${{ env.RELEASE_VERSION }} --no-git-tag-version --ignore-scripts
111111
npm pack --ignore-scripts --pack-destination ../../sdk-artifacts
112112
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
113113
with:
@@ -161,7 +161,7 @@ jobs:
161161
BUNDLE_PATH: ${{ steps.attest.outputs.bundle-path }}
162162
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
163163
with:
164-
name: OpenShell-Windows-0.1.8-signing-candidates
164+
name: OpenShell-Windows-${{ env.RELEASE_VERSION }}-signing-candidates
165165
path: dist/
166166
if-no-files-found: error
167167
retention-days: 30

‎packaging/windows/build.ps1‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ $source = (Get-Location).Path
55
$env:CARGO_TARGET_DIR = Join-Path $source 'target'
66
$env:CARGO_INCREMENTAL = '0'
77
$env:OPENSHELL_WINDOWS_BUILD_JOBS = '4'
8-
$env:OPENSHELL_IMAGE_TAG = '0.1.8'
8+
$releaseVersion = $env:RELEASE_VERSION
9+
if ($releaseVersion -notmatch '^\d+\.\d+\.\d+$') { throw 'RELEASE_VERSION must be MAJOR.MINOR.PATCH' }
10+
$env:OPENSHELL_IMAGE_TAG = $releaseVersion
911
$env:MISE_TRUSTED_CONFIG_PATHS = $source
1012
$env:CARGO_HOME = Join-Path $env:USERPROFILE '.cargo'
1113
$pairs = @(
@@ -36,7 +38,7 @@ $env:AWS_LC_SYS_CFLAGS = if ($Architecture -eq 'arm64') {
3638
# Match the existing release version-stamping convention without inventing a tag.
3739
$cargo = Get-Content -Raw Cargo.toml
3840
if ($cargo -notmatch '(?m)^version = "0\.0\.0"\r?$') { throw 'Unexpected workspace version' }
39-
[IO.File]::WriteAllText((Join-Path $source 'Cargo.toml'), ($cargo -replace '(?m)^version = "0\.0\.0"\r?$', 'version = "0.1.8"'))
41+
[IO.File]::WriteAllText((Join-Path $source 'Cargo.toml'), ($cargo -replace '(?m)^version = "0\.0\.0"\r?$', "version = `"$releaseVersion`""))
4042
# Git-derived development versions must not override the stamped package version.
4143
$env:GIT_DIR = Join-Path $env:RUNNER_TEMP 'absent-release-git'
4244
& mise run --skip-tools "windows:build:$Architecture"
@@ -63,12 +65,12 @@ foreach ($name in @('openshell.exe','openshell-gateway.exe','openshell-superviso
6365
Copy-Item $path $out
6466
if ($name.EndsWith('.exe')) {
6567
$version = & $path --version
66-
if ($LASTEXITCODE -ne 0 -or "$version" -notmatch '0\.1\.8') { throw "Executable version/launch failed: $name" }
68+
if ($LASTEXITCODE -ne 0 -or "$version" -notmatch [regex]::Escape($releaseVersion)) { throw "Executable version/launch failed: $name" }
6769
}
6870
$signature = Get-AuthenticodeSignature $path
6971
$files += @{ file=$name; sha256=(Get-FileHash $path -Algorithm SHA256).Hash.ToLowerInvariant(); signature=$signature.Status.ToString() }
7072
}
71-
@{architecture=$Architecture; source=$env:SOURCE_SHA; rust=(& rustc --version); runner=$env:RUNNER_ARCH; version='0.1.8'; launchChecks='passed'; files=$files} | ConvertTo-Json -Depth 5 | Set-Content (Join-Path $out 'build-record.json')
73+
@{architecture=$Architecture; source=$env:SOURCE_SHA; rust=(& rustc --version); runner=$env:RUNNER_ARCH; version=$releaseVersion; launchChecks='passed'; files=$files} | ConvertTo-Json -Depth 5 | Set-Content (Join-Path $out 'build-record.json')
7274
$validation = Join-Path $env:GITHUB_WORKSPACE "validation-$Architecture"
7375
New-Item -ItemType Directory -Force $validation | Out-Null
7476
$fixture = Join-Path $env:CARGO_TARGET_DIR "$target/release/examples/mxc-forwarding-agent.exe"

‎packaging/windows/package.py‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
ROOT = Path(os.environ['GITHUB_WORKSPACE'])
1313
SOURCE = os.environ['SOURCE_SHA']
14-
VERSION = '0.1.8'
14+
VERSION = os.environ['RELEASE_VERSION']
1515
RUN = f"https://github.com/{os.environ['GITHUB_REPOSITORY']}/actions/runs/{os.environ['GITHUB_RUN_ID']}"
1616
TEMPLATES = Path(__file__).parent / 'templates'
1717
PE_FILES = ('openshell.exe', 'openshell-gateway.exe', 'openshell-supervisor.exe', 'openshell-windows-sandbox.exe', 'libz3.dll')
@@ -63,6 +63,9 @@ def check(name, data):
6363
for arch, machine in (('arm64', 0xAA64), ('x64', 0x8664)):
6464
kit = ROOT / 'kits' / f'OpenShell-Windows-{VERSION}-{arch}'
6565
shutil.copytree(TEMPLATES, kit)
66+
for text in kit.rglob('*'):
67+
if text.is_file() and text.suffix in ('.md', '.ps1', '.mjs', '.py', '.template', '.yaml'):
68+
text.write_bytes(text.read_bytes().replace(b'@VERSION@', VERSION.encode()))
6669
sboms = list((ROOT / 'source/deploy/sbom/output').glob('*.cdx.json'))
6770
assert len(sboms) == 1, 'Expected freshly generated source SBOM'
6871
sbom = json.loads(sboms[0].read_text())
@@ -94,11 +97,11 @@ def check(name, data):
9497
shutil.copy2(binary, kit / 'bin' / name)
9598
inventory.append({'architecture': arch, 'file': f'{kit.name}/bin/{name}', 'sha256': digest(binary), 'authenticode': 'pending'})
9699
shutil.copytree(ROOT / 'inputs/sdk', kit / 'sdk')
97-
assert sorted(p.name for p in (kit / 'sdk').iterdir()) == ['nvidia-openshell-sdk-0.1.8.tgz', 'openshell-0.1.8-py3-none-any.whl']
100+
assert sorted(p.name for p in (kit / 'sdk').iterdir()) == [f'nvidia-openshell-sdk-{VERSION}.tgz', f'openshell-{VERSION}-py3-none-any.whl']
98101
(kit / 'BUILD.md').write_text(f'''# Build record
99102
100103
Product source: NVIDIA/OpenShell windows branch, commit `{SOURCE}`.
101-
Version: {VERSION}, stamped in the workspace manifest. This is different from the main-branch v0.1.8 tag.
104+
Version: {VERSION}, stamped in the workspace manifest. This is different from the main-branch v{VERSION} tag.
102105
Workflow: {RUN}
103106
Automation commit: `{os.environ['GITHUB_SHA']}`.
104107
@@ -131,7 +134,7 @@ def check(name, data):
131134
'packageStatus': 'unsigned-candidate-not-release-ready',
132135
'source': {'repository': 'https://github.com/NVIDIA/OpenShell', 'branch': 'windows', 'commit': SOURCE, 'versionStamp': VERSION},
133136
'build': {'workflowRun': RUN, 'automationCommit': os.environ['GITHUB_SHA'], 'builtByThisWorkflow': True},
134-
'intendedRelease': {'repository': 'NVIDIA/OpenShell', 'tag': 'v0.1.8', 'matchesReleaseTagSource': False},
137+
'intendedRelease': {'repository': 'NVIDIA/OpenShell', 'tag': f'v{VERSION}', 'matchesReleaseTagSource': False},
135138
'signing': {'authenticode': 'pending', 'githubArchiveAttestation': 'detached-verify-after-download'},
136139
'validation': {'nativeLaunchChecks': 'passed', 'runtimeReport': 'external-bound-to-sha256', 'finalSignedBytesValidated': False},
137140
'files': [{'path': p.relative_to(kit).as_posix(), 'size': p.stat().st_size, 'sha256': digest(p)} for p in sorted(kit.rglob('*')) if p.is_file()],

‎packaging/windows/templates/README.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# OpenShell Windows 0.1.8 (arm64)
1+
# OpenShell Windows @VERSION@ (arm64)
22

33
**Unsigned candidate, not ready for release.** See VALIDATION.md for passed checks and remaining limitations.
44

5-
This portable kit is built from [NVIDIA/OpenShell's windows branch](https://github.com/NVIDIA/OpenShell/tree/@SOURCE_SHA@), commit `@SOURCE_SHA@`. The Rust binaries and SDKs are versioned `0.1.8`. These Windows sources differ from the main-branch `v0.1.8` tag.
5+
This portable kit is built from [NVIDIA/OpenShell's windows branch](https://github.com/NVIDIA/OpenShell/tree/@SOURCE_SHA@), commit `@SOURCE_SHA@`. The Rust binaries and SDKs are versioned `@VERSION@`. These Windows sources differ from the main-branch `v@VERSION@` tag.
66

77
Read KNOWN-LIMITATIONS.md before running workloads. The Windows runtime is under development and is not a production-qualified isolation boundary. Consult release-manifest.json and VALIDATION.md for this kit's actual signing and validation status.
88

@@ -27,7 +27,7 @@ Verify the downloaded ZIP using its GitHub attestation and checksum as described
2727
.\scripts\Start-OpenShell.ps1
2828
```
2929

30-
Initialization creates private per-installation keys and state under `%LOCALAPPDATA%\OpenShell\Windows-0.1.8`. Existing initialization is not overwritten. Use `-StateDirectory` consistently for another installation, and `-Port` during initialization if 17670 is occupied.
30+
Initialization creates private per-installation keys and state under `%LOCALAPPDATA%\OpenShell\Windows-@VERSION@`. Existing initialization is not overwritten. Use `-StateDirectory` consistently for another installation, and `-Port` during initialization if 17670 is occupied.
3131

3232
The foreground gateway listens on `http://127.0.0.1:17670` without user authentication. Any local process can call it. Use only on a trusted development host and do not expose it on a network. Internal supervisor authentication uses the generated keys. The gateway database is in memory; delete sandboxes before stopping the gateway and recreate them after restart.
3333

@@ -43,7 +43,7 @@ For TypeScript:
4343

4444
```powershell
4545
Push-Location .\examples\typescript
46-
npm install ..\..\sdk\nvidia-openshell-sdk-0.1.8.tgz
46+
npm install ..\..\sdk\nvidia-openshell-sdk-@VERSION@.tgz
4747
node .\harness.mjs
4848
Pop-Location
4949
```
@@ -54,7 +54,7 @@ For the Python health check, select an interpreter supported by grpcio:
5454

5555
```powershell
5656
uv venv .venv
57-
uv pip install --python .venv\Scripts\python.exe .\sdk\openshell-0.1.8-py3-none-any.whl
57+
uv pip install --python .venv\Scripts\python.exe .\sdk\openshell-@VERSION@-py3-none-any.whl
5858
uv run --no-project --python .venv\Scripts\python.exe .\examples\python\health.py
5959
```
6060

‎packaging/windows/templates/examples/powershell/harness.ps1‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#Requires -Version 7.3
22
[CmdletBinding()]
3-
param([string]$StateDirectory = (Join-Path $env:LOCALAPPDATA 'OpenShell\Windows-0.1.8'))
3+
param([string]$StateDirectory = (Join-Path $env:LOCALAPPDATA 'OpenShell\Windows-@VERSION@'))
44
$ErrorActionPreference = 'Stop'
55
$PSNativeCommandArgumentPassing = 'Standard'
66
$root = Split-Path (Split-Path $PSScriptRoot -Parent) -Parent

‎packaging/windows/templates/examples/python/health.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
from openshell.sandbox import SandboxClient
88

9-
state = Path(os.environ['LOCALAPPDATA']) / 'OpenShell' / 'Windows-0.1.8'
9+
state = Path(os.environ['LOCALAPPDATA']) / 'OpenShell' / 'Windows-@VERSION@'
1010
settings = json.loads((state / 'settings.json').read_text(encoding='utf-8'))
1111
endpoint = urlsplit(settings['endpoint'])
1212
with SandboxClient(f'{endpoint.hostname}:{endpoint.port}') as client:

‎packaging/windows/templates/examples/typescript/harness.mjs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { mkdir, readFile, rm } from 'node:fs/promises';
33
import { join } from 'node:path';
44
import { randomUUID } from 'node:crypto';
55

6-
const state = process.argv[2] ?? join(process.env.LOCALAPPDATA, 'OpenShell', 'Windows-0.1.8');
6+
const state = process.argv[2] ?? join(process.env.LOCALAPPDATA, 'OpenShell', 'Windows-@VERSION@');
77
const settings = JSON.parse(await readFile(join(state, 'settings.json'), 'utf8'));
88
const workspace = join(state, 'workspace');
99
await mkdir(workspace, { recursive: true });

‎packaging/windows/templates/scripts/Initialize-OpenShell.ps1‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[CmdletBinding()]
22
param([switch]$AllowUnsigned,
33
[Parameter(Mandatory)][string]$WxcExecPath,
4-
[string]$StateDirectory = (Join-Path $env:LOCALAPPDATA 'OpenShell\Windows-0.1.8'),
4+
[string]$StateDirectory = (Join-Path $env:LOCALAPPDATA 'OpenShell\Windows-@VERSION@'),
55
[ValidateRange(1024,65535)][int]$Port = 17670
66
)
77
$ErrorActionPreference = 'Stop'

‎packaging/windows/templates/scripts/Start-OpenShell.ps1‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[CmdletBinding()]
2-
param([switch]$AllowUnsigned, [string]$StateDirectory = (Join-Path $env:LOCALAPPDATA 'OpenShell\Windows-0.1.8'))
2+
param([switch]$AllowUnsigned, [string]$StateDirectory = (Join-Path $env:LOCALAPPDATA 'OpenShell\Windows-@VERSION@'))
33
$ErrorActionPreference = 'Stop'
44
$root = Split-Path $PSScriptRoot -Parent
55
$state = (Resolve-Path -LiteralPath $StateDirectory).Path

0 commit comments

Comments
 (0)