From 039fcdb9c952c504cc36a72d48d765518d551650 Mon Sep 17 00:00:00 2001 From: Simone Date: Mon, 11 May 2026 18:50:05 +0200 Subject: [PATCH] feat(script): add UseGitClone and GuestRepoUrl parameters for in-VM cloning --- scripts/Test-Ns7zipBuild-Linux.ps1 | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/scripts/Test-Ns7zipBuild-Linux.ps1 b/scripts/Test-Ns7zipBuild-Linux.ps1 index 72991f5..d92e75e 100644 --- a/scripts/Test-Ns7zipBuild-Linux.ps1 +++ b/scripts/Test-Ns7zipBuild-Linux.ps1 @@ -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//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