mirror of
https://github.com/actions/runner-images-sangeeth.git
synced 2025-12-31 14:07:39 +08:00
[macOS] Switch image generation to faster datastores (#1801)
* select datastore script * add debug message * add move-vm and helpers * add error action * formatting the script * nits * add missing quotes * add synopsis
This commit is contained in:
26
images.CI/macos/helpers.psm1
Normal file
26
images.CI/macos/helpers.psm1
Normal file
@@ -0,0 +1,26 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
|
||||
Helper functions to use in images.CI scripts
|
||||
#>
|
||||
|
||||
Function Connect-VCServer
|
||||
{
|
||||
try
|
||||
{
|
||||
# Preference
|
||||
$global:ProgressPreference = 'SilentlyContinue'
|
||||
$global:WarningPreference = 'SilentlyContinue'
|
||||
# Ignore SSL
|
||||
$null = Set-PowerCLIConfiguration -Scope Session -InvalidCertificateAction Ignore -ParticipateInCEIP $false -Confirm:$false -WebOperationTimeoutSeconds 600
|
||||
$securePassword = ConvertTo-SecureString -String $VIPassword -AsPlainText -Force
|
||||
$cred = New-Object System.Management.Automation.PSCredential($VIUserName, $securePassword)
|
||||
$null = Connect-VIServer -Server $VIServer -Credential $cred -ErrorAction Stop
|
||||
Write-Host "Connection to the vSphere server has been established"
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-Host "##vso[task.LogIssue type=error;]Failed to connect to the vSphere server"
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user