diff --git a/gitea/actions/local-ci-build/action.yml b/gitea/actions/local-ci-build/action.yml index 6f5f524..14693f3 100644 --- a/gitea/actions/local-ci-build/action.yml +++ b/gitea/actions/local-ci-build/action.yml @@ -189,7 +189,13 @@ runs: Set-StrictMode -Version Latest $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) $jobId = '${{ github.run_id }}-${{ github.run_attempt }}' @@ -212,15 +218,6 @@ runs: $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 $resolvedGuestOS = $env:INPUT_GUEST_OS if ($resolvedGuestOS -eq 'Auto') { @@ -252,27 +249,30 @@ runs: } } - # Build parameter hashtable for Invoke-CIJob.ps1 - $params = @{ - JobId = $jobId - RepoUrl = $repoUrl - Branch = '${{ github.ref_name }}' - Commit = '${{ github.sha }}' - BuildCommand = $env:INPUT_BUILD_COMMAND - GuestArtifactSource = $env:INPUT_ARTIFACT_SOURCE - GuestOS = $resolvedGuestOS - Configuration = $env:INPUT_CONFIGURATION + # Build argument list for the Python CLI. Long-form kebab-case flags only. + $pyArgs = @( + '-m', 'ci_orchestrator', 'job', + '--job-id', $jobId, + '--repo-url', $repoUrl, + '--branch', '${{ github.ref_name }}', + '--commit', '${{ github.sha }}', + '--build-command', $env:INPUT_BUILD_COMMAND, + '--guest-artifact-source', $env:INPUT_ARTIFACT_SOURCE, + '--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 } - 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 + & $venvPython @pyArgs if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } # Emit outputs consumed by subsequent steps diff --git a/runner/config.yaml b/runner/config.yaml index d5cd66e..c5a82ab 100644 --- a/runner/config.yaml +++ b/runner/config.yaml @@ -35,6 +35,9 @@ runner: GITEA_CI_SSH_KEY_PATH: "F:\\CI\\keys\\ci_linux" # 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" + # 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) # env_file: "F:\\CI\\runner.env"