feat(job): wire use-git-clone + submodules; default in-guest clone
The job command previously discarded --use-git-clone and --submodules
(`del`) and always in-guest cloned with submodules off — making both
action inputs dead no-ops (submodule repos silently broken).
- job.py: --use-git-clone/--host-clone and --submodules/--no-submodules
are real booleans defaulting to ON. Default = in-guest clone with
submodules. --host-clone clones on the host into a temp dir
(_host_clone) and transfers a zip; temp dir cleaned in finally.
clone_submodules now honoured (was hardcoded False).
- action.yml: use-git-clone / submodules default 'true'; forward the
explicit positive/negative flag so the Python default is overridden
deterministically.
- self-test.yml: add smoke-{windows,linux}-hostclone jobs covering the
host-side transport (default jobs already cover in-guest).
- tests: default-transport, host-clone, and --no-submodules coverage.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -48,9 +48,10 @@ inputs:
|
||||
|
||||
submodules:
|
||||
description: >
|
||||
Set to "true" to clone the repository with --recurse-submodules.
|
||||
Recurse submodules when cloning. Default "true". Set to "false"
|
||||
to skip submodule init/update.
|
||||
required: false
|
||||
default: 'false'
|
||||
default: 'true'
|
||||
|
||||
guest-os:
|
||||
description: >
|
||||
@@ -61,12 +62,14 @@ inputs:
|
||||
|
||||
use-git-clone:
|
||||
description: >
|
||||
Set to "true" to clone the repository inside the VM rather than
|
||||
transferring a zip from the host. Requires Git in the template (see
|
||||
Install-CIToolchain-WinBuild2025.ps1 Step 12 / Install-CIToolchain-Linux2404.sh).
|
||||
Preferred for repositories larger than ~200 MB.
|
||||
Transport for the repo source. Default "true": clone inside the
|
||||
build VM (requires Git in the template — see
|
||||
Install-CIToolchain-WinBuild2025.ps1 Step 12 /
|
||||
Install-CIToolchain-Linux2404.sh). Set to "false" for the
|
||||
host-side variant: the host clones the repo and transfers a zip
|
||||
to the guest (useful when the guest cannot reach Gitea).
|
||||
required: false
|
||||
default: 'false'
|
||||
default: 'true'
|
||||
|
||||
configuration:
|
||||
description: >
|
||||
@@ -269,8 +272,13 @@ runs:
|
||||
'--snapshot-name', $resolvedSnapshotName
|
||||
)
|
||||
|
||||
if ($env:INPUT_SUBMODULES -eq 'true') { $pyArgs += '--submodules' }
|
||||
if ($env:INPUT_USE_GIT_CLONE -eq 'true') { $pyArgs += '--use-git-clone' }
|
||||
# Submodules and transport default to ON; pass the explicit
|
||||
# negative flag when the caller opted out so the Python default
|
||||
# (also ON) is overridden deterministically.
|
||||
if ($env:INPUT_SUBMODULES -eq 'false') { $pyArgs += '--no-submodules' }
|
||||
else { $pyArgs += '--submodules' }
|
||||
if ($env:INPUT_USE_GIT_CLONE -eq 'false') { $pyArgs += '--host-clone' }
|
||||
else { $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 '{}') {
|
||||
|
||||
@@ -4,7 +4,9 @@
|
||||
# VM clone -> start -> IP detect -> trivial build -> artifact collect -> destroy
|
||||
#
|
||||
# Trigger: workflow_dispatch only (never runs on push/tag).
|
||||
# Both jobs are independent — a failure in one does not cancel the other.
|
||||
# Jobs are independent — a failure in one does not cancel the others.
|
||||
# Covers both source transports: in-guest git clone (default) and the
|
||||
# host-side clone + zip transfer variant (use-git-clone: 'false').
|
||||
#
|
||||
# Prerequisites (must be in place before running):
|
||||
# - Runner labels: windows-build:host and linux-build:host active
|
||||
@@ -43,4 +45,29 @@ jobs:
|
||||
artifact-source: '/opt/ci/output'
|
||||
guest-os: 'Linux'
|
||||
job-id-suffix: 'smoke-linux'
|
||||
artifact-name: 'smoke-linux-${{ github.run_id }}'
|
||||
artifact-name: 'smoke-linux-${{ github.run_id }}'
|
||||
|
||||
# ── Host-side clone + zip transfer variant (use-git-clone: 'false') ───────
|
||||
smoke-windows-hostclone:
|
||||
runs-on: windows-build
|
||||
steps:
|
||||
- uses: https://gitea.emulab.it/Simone/local-ci-cd-system/.gitea/actions/local-ci-build@main
|
||||
with:
|
||||
build-command: 'New-Item -ItemType Directory -Path C:\CI\output -Force | Out-Null; Set-Content C:\CI\output\smoke.txt "smoke-ok"'
|
||||
artifact-source: 'C:\CI\output'
|
||||
guest-os: 'Windows'
|
||||
use-git-clone: 'false'
|
||||
job-id-suffix: 'smoke-win-hostclone'
|
||||
artifact-name: 'smoke-windows-hostclone-${{ github.run_id }}'
|
||||
|
||||
smoke-linux-hostclone:
|
||||
runs-on: linux-build
|
||||
steps:
|
||||
- uses: https://gitea.emulab.it/Simone/local-ci-cd-system/.gitea/actions/local-ci-build@main
|
||||
with:
|
||||
build-command: 'mkdir -p /opt/ci/output && echo smoke-ok > /opt/ci/output/smoke.txt'
|
||||
artifact-source: '/opt/ci/output'
|
||||
guest-os: 'Linux'
|
||||
use-git-clone: 'false'
|
||||
job-id-suffix: 'smoke-linux-hostclone'
|
||||
artifact-name: 'smoke-linux-hostclone-${{ github.run_id }}'
|
||||
Reference in New Issue
Block a user