Open andreacuozzo opened 2 years ago
You could always try to da a Invoke-Webrequest, if you are working in powershell.
@andreacuozzo could you share how you manage the import of base images in your Jenkins pipeline ?
Thanks FLeven: the Invoke-Expression code snippets is taken from the allfunctions.ps1, called by Update-OSMedia, I'll play with the Invoke-Webrequest, but it seems to me it would still require AllFunctions.ps1 to be changed, and it's probably not worthy for my corner case; as of now I'm just copying my modified version of AllFunctions.ps1 right before calling Update-OSMedia.
I'll soon post on github my attempt at using Jenkins to orchestrate a bunch of powershell scripts in order to generate a vsphere template of Windows 2019 with the latest updates, run some unit tests and a call to the qualys api to make sure the finished product is vulns free (4 and 5 severity, at least). I'll let you know as soon as it's done.
OSDBuilder version; 21.12.15.1
Command:
Scenario: I'm using Jenkins to run a powershell script on a remote host. The Update-OSMedia fails with the error below, because the Jenkins environment doesn't handle well the output generated by the curl.exe call in AllFunctions.ps1 starting on line
3054:
Error:
Workaround (there might be other ones better than this):
the code runs through the ($host.name -match 'ConsoleHost') path, and fails here:
Invoke-Expression "& curl.exe --insecure --location --output
"$DownloadFullPath" --url
"$SourceUrl""
the workaround is to force it to run through the other "ISE quiet" path that handles the curl.exe output:
$Quiet = Invoke-Expression "& curl.exe --insecure --location --output
"$DownloadFullPath" --url
"$SourceUrl" 2>&1"
It's been months since I've last used this script of mine, it was working fine on previous OSDBuilder versions: my scenario (Jenkins agent running a script remotely) might be a corner case unworhty of being investigated and fixed, just my 2 cents should anyone else have the same problem.
Andrea