Stage the native compiler under the agent execution policy

This commit is contained in:
2026-11-26 17:38:30 -06:00
parent 964d81f4e1
commit 6b333b6e93
4 changed files with 48 additions and 36 deletions

5
Jenkinsfile vendored
View File

@@ -21,6 +21,7 @@ pipeline {
script {
env.ARM_SOURCE_COMMIT = bat(returnStdout: true, script: '@git rev-parse HEAD').trim()
env.ARM_VERSION = readFile('VERSION.md').trim()
env.PYINSTALLER_CONFIG_DIR = "${env.WORKSPACE}\\.ci\\pyinstaller-cache"
if (!(env.ARM_SOURCE_COMMIT ==~ /[0-9a-f]{40}/) ||
!(env.ARM_VERSION ==~ /v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)_(alpha|beta|rc|stable)/)) {
error('Invalid Git commit or authoritative VERSION.md.')
@@ -35,7 +36,7 @@ pipeline {
bat 'py -3.12 -m venv .ci\\python'
bat '.ci\\python\\Scripts\\python.exe -m pip install -r requirements-build.txt'
bat '.ci\\python\\Scripts\\python.exe -m pip check'
bat 'powershell.exe -NoLogo -NoProfile -NonInteractive -File tools\\prepare_windows_compiler.ps1'
bat '.ci\\python\\Scripts\\python.exe tools\\prepare_windows_compiler.py'
}
}
stage('Regression and native Windows checks') {
@@ -71,7 +72,7 @@ pipeline {
post {
cleanup {
deleteDir()
echo 'Removed the ARM build workspace. Verified candidates are stored in Jenkins archival.'
echo 'Removed the ARM build workspace. Any successfully archived artifacts remain in Jenkins.'
}
}
}

View File

@@ -1,15 +0,0 @@
"""Extract the signed Inno compiler through its native portable installer."""
from pathlib import Path
import sys
from uuid import uuid4
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "tests"))
from windows_gui import start_isolated
if __name__ == "__main__":
installer, destination = (Path(value).resolve() for value in sys.argv[1:])
raise SystemExit(start_isolated(
[str(installer), "/PORTABLE=1", "/VERYSILENT", "/SUPPRESSMSGBOXES", "/NORESTART", f"/DIR={destination}"],
f"ARM_Compiler_{uuid4().hex[:10]}", timeout=90,
))

View File

@@ -1,19 +0,0 @@
$ErrorActionPreference = 'Stop'
$scratch = Join-Path $PWD '.ci'
$compiler = Join-Path $scratch 'inno'
$download = Join-Path $scratch 'innosetup-7.1.1-x64.exe'
$origin = 'https://github.com/jrsoftware/issrc/releases/download/is-7_1_1/innosetup-7.1.1-x64.exe'
$expected = '8a5a6711c3766a6e5fb74f280ba0e3551e719ce94538d901fdbd1f8f9920b3f0'
Invoke-WebRequest -UseBasicParsing -Uri $origin -OutFile $download
if ((Get-FileHash -LiteralPath $download -Algorithm SHA256).Hash -ine $expected) {
throw 'Inno Setup download SHA-256 mismatch'
}
$signature = Get-AuthenticodeSignature -LiteralPath $download
if ($signature.Status -ne 'Valid' -or $signature.SignerCertificate.Subject -notmatch 'CN=Pyrsys B\.V\.') {
throw 'Inno Setup publisher verification failed'
}
& '.ci\python\Scripts\python.exe' tools\install_ci_compiler.py $download $compiler
if ($LASTEXITCODE -ne 0 -or -not (Test-Path -LiteralPath (Join-Path $compiler 'ISCC.exe'))) {
throw 'Portable Inno Setup staging failed'
}
Write-Host 'Inno Setup 7.1.1 x64 hash, publisher and portable staging verified.'

View File

@@ -0,0 +1,45 @@
"""Stage the pinned Windows compiler without changing the agent's execution policy."""
from hashlib import file_digest
from pathlib import Path
import shutil
import subprocess
import sys
from urllib.request import urlopen
from uuid import uuid4
ROOT = Path(__file__).resolve().parents[1]
sys.path.insert(0, str(ROOT / "tests"))
from windows_gui import start_isolated
NAME = "innosetup-7.1.1-x64.exe"
ORIGIN = f"https://github.com/jrsoftware/issrc/releases/download/is-7_1_1/{NAME}"
SHA256 = "8a5a6711c3766a6e5fb74f280ba0e3551e719ce94538d901fdbd1f8f9920b3f0"
def main():
scratch = ROOT / ".ci"
installer = scratch / NAME
destination = scratch / "inno"
with urlopen(ORIGIN, timeout=60) as response, installer.open("xb") as output:
shutil.copyfileobj(response, output)
with installer.open("rb") as source:
if file_digest(source, "sha256").hexdigest() != SHA256:
raise RuntimeError("Inno Setup download SHA-256 mismatch")
signature = subprocess.check_output(
["powershell.exe", "-NoLogo", "-NoProfile", "-NonInteractive", "-Command",
f"(Get-AuthenticodeSignature -LiteralPath '{NAME}').Status.ToString()"],
cwd=scratch, text=True,
).strip()
if signature != "Valid":
raise RuntimeError(f"Inno Setup Authenticode verification failed: {signature}")
code = start_isolated(
[str(installer), "/PORTABLE=1", "/VERYSILENT", "/SUPPRESSMSGBOXES", "/NORESTART", f"/DIR={destination}"],
f"ARM_Compiler_{uuid4().hex[:10]}", timeout=90,
)
if code or not (destination / "ISCC.exe").is_file():
raise RuntimeError(f"Portable Inno Setup staging failed: exit {code}")
print("Inno Setup 7.1.1 x64 hash, Authenticode and native portable staging verified.")
if __name__ == "__main__":
main()