feat(script): add UseGitClone and GuestRepoUrl parameters for in-VM cloning

This commit is contained in:
Simone
2026-05-11 18:50:05 +02:00
parent 1c39701534
commit 039fcdb9c9
+22 -1
View File
@@ -36,6 +36,16 @@
.PARAMETER SshKeyPath
SSH private key for the ci_build user in the guest. Default: F:\CI\keys\ci_linux
.PARAMETER UseGitClone
If set, skips host-side git clone and delegates cloning to the guest VM.
Uses -GuestRepoUrl (HTTP) instead of the SSH alias URL.
Mirrors the -UseGitClone mode of Invoke-CIJob.ps1 (same as §3.3 for Windows).
.PARAMETER GuestRepoUrl
HTTP(S) URL used for in-VM clone when -UseGitClone is set.
Must be reachable from inside the Linux guest VM.
Default: https://gitea.emulab.it/Simone/nsis-plugin-ns7zip.git
.PARAMETER VerifyArtifact
If set, expands artifacts.zip (or scans the dir) and checks that at least one DLL is present.
Default: $true
@@ -44,6 +54,9 @@
.\Test-Ns7zipBuild-Linux.ps1
.\Test-Ns7zipBuild-Linux.ps1 -Config x86-unicode -ZipVersion 26.00
# Guest-side clone (no host clone, guest fetches via HTTPS):
.\Test-Ns7zipBuild-Linux.ps1 -UseGitClone
#>
[CmdletBinding()]
param(
@@ -60,6 +73,8 @@ param(
),
[string] $SnapshotName = 'BaseClean-Linux',
[string] $SshKeyPath = 'F:\CI\keys\ci_linux',
[switch] $UseGitClone,
[string] $GuestRepoUrl = 'https://gitea.emulab.it/Simone/nsis-plugin-ns7zip.git',
[switch] $VerifyArtifact = $true
)
@@ -80,15 +95,20 @@ Write-Host " 7-Zip ver : $ZipVersion"
Write-Host " Template : $TemplatePath"
Write-Host " Snapshot : $SnapshotName"
Write-Host " Artifacts : $artifactDir"
Write-Host " Clone mode : $(if ($UseGitClone) { 'in-VM git clone (-UseGitClone)' } else { 'host clone + tar/scp' })"
Write-Host "============================================================"
Write-Host ""
# ns7zip Linux build copies built DLLs under plugins/<config>/nsis7z.dll
$buildCmd = "python3 build_plugin.py --host linux --7zip-version $ZipVersion --configs $Config --verbose"
# Without -UseGitClone: host clones via SSH alias, transfers source via tar+scp.
# With -UseGitClone: host clone is skipped; guest clones via HTTPS URL.
$repoUrl = if ($UseGitClone) { $GuestRepoUrl } else { 'ssh://gitea-ci/Simone/nsis-plugin-ns7zip.git' }
$params = @{
JobId = $JobId
RepoUrl = 'ssh://gitea-ci/Simone/nsis-plugin-ns7zip.git'
RepoUrl = $repoUrl
Branch = $Branch
TemplatePath = $TemplatePath
SnapshotName = $SnapshotName
@@ -99,6 +119,7 @@ $params = @{
SshKeyPath = $SshKeyPath
SshUser = 'ci_build'
}
if ($UseGitClone) { $params['UseGitClone'] = $true }
if ($Commit -ne '') { $params['Commit'] = $Commit }
$startTime = Get-Date