ci(a4): switch local-ci-build action.yml to Python CLI; add PYTHONIOENCODING=utf-8
The composite action now invokes & $venvPython -m ci_orchestrator job ... directly instead of splatting a hashtable into Invoke-CIJob.ps1, removing the only mismatch between the new shim's positional args contract and the action's previous PascalCase splatting. runner/config.yaml exports PYTHONIOENCODING=utf-8 so non-ASCII build output survives the act_runner -> Gitea round-trip.
This commit is contained in:
@@ -189,7 +189,13 @@ runs:
|
|||||||
Set-StrictMode -Version Latest
|
Set-StrictMode -Version Latest
|
||||||
$ErrorActionPreference = 'Stop'
|
$ErrorActionPreference = 'Stop'
|
||||||
|
|
||||||
$ciScriptsDir = $env:GITEA_CI_SCRIPT_ROOT
|
# Resolve Python interpreter from venv (Phase A4 — Python orchestrator).
|
||||||
|
# Override with CI_VENV_PYTHON env var; default matches Setup-Host.ps1 layout.
|
||||||
|
$venvPython = $env:CI_VENV_PYTHON
|
||||||
|
if (-not $venvPython) { $venvPython = 'F:\CI\python\venv\Scripts\python.exe' }
|
||||||
|
if (-not (Test-Path -LiteralPath $venvPython)) {
|
||||||
|
throw "Python interpreter not found at '$venvPython'. Set CI_VENV_PYTHON or run Setup-Host.ps1."
|
||||||
|
}
|
||||||
|
|
||||||
# Build job ID — append suffix when provided (matrix disambiguation)
|
# Build job ID — append suffix when provided (matrix disambiguation)
|
||||||
$jobId = '${{ github.run_id }}-${{ github.run_attempt }}'
|
$jobId = '${{ github.run_id }}-${{ github.run_attempt }}'
|
||||||
@@ -212,15 +218,6 @@ runs:
|
|||||||
$repoUrl = '${{ github.server_url }}/${{ github.repository }}.git'
|
$repoUrl = '${{ github.server_url }}/${{ github.repository }}.git'
|
||||||
}
|
}
|
||||||
|
|
||||||
# Parse extra-guest-env-json into a hashtable (§6.5 secret injection)
|
|
||||||
$extraGuestEnv = @{}
|
|
||||||
if ($env:INPUT_EXTRA_GUEST_ENV_JSON -and $env:INPUT_EXTRA_GUEST_ENV_JSON -ne '{}') {
|
|
||||||
$parsed = $env:INPUT_EXTRA_GUEST_ENV_JSON | ConvertFrom-Json
|
|
||||||
foreach ($prop in $parsed.PSObject.Properties) {
|
|
||||||
$extraGuestEnv[$prop.Name] = [string]$prop.Value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Resolve guest OS: honor explicit input; for Auto, infer from RUNNER_LABELS
|
# Resolve guest OS: honor explicit input; for Auto, infer from RUNNER_LABELS
|
||||||
$resolvedGuestOS = $env:INPUT_GUEST_OS
|
$resolvedGuestOS = $env:INPUT_GUEST_OS
|
||||||
if ($resolvedGuestOS -eq 'Auto') {
|
if ($resolvedGuestOS -eq 'Auto') {
|
||||||
@@ -252,27 +249,30 @@ runs:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Build parameter hashtable for Invoke-CIJob.ps1
|
# Build argument list for the Python CLI. Long-form kebab-case flags only.
|
||||||
$params = @{
|
$pyArgs = @(
|
||||||
JobId = $jobId
|
'-m', 'ci_orchestrator', 'job',
|
||||||
RepoUrl = $repoUrl
|
'--job-id', $jobId,
|
||||||
Branch = '${{ github.ref_name }}'
|
'--repo-url', $repoUrl,
|
||||||
Commit = '${{ github.sha }}'
|
'--branch', '${{ github.ref_name }}',
|
||||||
BuildCommand = $env:INPUT_BUILD_COMMAND
|
'--commit', '${{ github.sha }}',
|
||||||
GuestArtifactSource = $env:INPUT_ARTIFACT_SOURCE
|
'--build-command', $env:INPUT_BUILD_COMMAND,
|
||||||
GuestOS = $resolvedGuestOS
|
'--guest-artifact-source', $env:INPUT_ARTIFACT_SOURCE,
|
||||||
Configuration = $env:INPUT_CONFIGURATION
|
'--guest-os', $resolvedGuestOS,
|
||||||
|
'--configuration', $env:INPUT_CONFIGURATION,
|
||||||
|
'--template-path', $resolvedTemplatePath,
|
||||||
|
'--snapshot-name', $resolvedSnapshotName
|
||||||
|
)
|
||||||
|
|
||||||
|
if ($env:INPUT_SUBMODULES -eq 'true') { $pyArgs += '--submodules' }
|
||||||
|
if ($env:INPUT_USE_GIT_CLONE -eq 'true') { $pyArgs += '--use-git-clone' }
|
||||||
|
if ($env:INPUT_USE_SHARED_CACHE -eq 'true') { $pyArgs += '--use-shared-cache' }
|
||||||
|
if ($env:INPUT_SKIP_ARTIFACT -eq 'true') { $pyArgs += '--skip-artifact' }
|
||||||
|
if ($env:INPUT_EXTRA_GUEST_ENV_JSON -and $env:INPUT_EXTRA_GUEST_ENV_JSON -ne '{}') {
|
||||||
|
$pyArgs += @('--extra-env-json', $env:INPUT_EXTRA_GUEST_ENV_JSON)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($env:INPUT_SUBMODULES -eq 'true') { $params['Submodules'] = $true }
|
& $venvPython @pyArgs
|
||||||
if ($env:INPUT_USE_GIT_CLONE -eq 'true') { $params['UseGitClone'] = $true }
|
|
||||||
if ($env:INPUT_USE_SHARED_CACHE -eq 'true') { $params['UseSharedCache'] = $true }
|
|
||||||
if ($env:INPUT_SKIP_ARTIFACT -eq 'true') { $params['SkipArtifact'] = $true }
|
|
||||||
if ($resolvedTemplatePath) { $params['TemplatePath'] = $resolvedTemplatePath }
|
|
||||||
if ($resolvedSnapshotName) { $params['SnapshotName'] = $resolvedSnapshotName }
|
|
||||||
if ($extraGuestEnv.Count -gt 0) { $params['ExtraGuestEnv'] = $extraGuestEnv }
|
|
||||||
|
|
||||||
& "$ciScriptsDir\Invoke-CIJob.ps1" @params
|
|
||||||
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
||||||
|
|
||||||
# Emit outputs consumed by subsequent steps
|
# Emit outputs consumed by subsequent steps
|
||||||
|
|||||||
@@ -35,6 +35,9 @@ runner:
|
|||||||
GITEA_CI_SSH_KEY_PATH: "F:\\CI\\keys\\ci_linux"
|
GITEA_CI_SSH_KEY_PATH: "F:\\CI\\keys\\ci_linux"
|
||||||
# Root directory of the local-ci-system repository on this host (scripts\ subdir)
|
# Root directory of the local-ci-system repository on this host (scripts\ subdir)
|
||||||
GITEA_CI_SCRIPT_ROOT: "N:\\Code\\Workspace\\Local-CI-CD-System\\scripts"
|
GITEA_CI_SCRIPT_ROOT: "N:\\Code\\Workspace\\Local-CI-CD-System\\scripts"
|
||||||
|
# Force UTF-8 stdio for the Python orchestrator (Phase A4) so non-ASCII
|
||||||
|
# characters in build logs survive the act_runner -> Gitea round-trip.
|
||||||
|
PYTHONIOENCODING: "utf-8"
|
||||||
|
|
||||||
# Optional: load additional env vars from a file (one KEY=VALUE per line)
|
# Optional: load additional env vars from a file (one KEY=VALUE per line)
|
||||||
# env_file: "F:\\CI\\runner.env"
|
# env_file: "F:\\CI\\runner.env"
|
||||||
|
|||||||
Reference in New Issue
Block a user