mirror of
https://github.com/actions/runner-images.git
synced 2025-12-20 06:35:47 +00:00
fix nitpicks
This commit is contained in:
@@ -84,7 +84,7 @@ function Invoke-RestMethodWithRetry {
|
|||||||
Invoke-RestMethod $Url -MaximumRetryCount 10 -RetryIntervalSec 30
|
Invoke-RestMethod $Url -MaximumRetryCount 10 -RetryIntervalSec 30
|
||||||
}
|
}
|
||||||
|
|
||||||
function Invoke-ExpressionWithValidation {
|
function Invoke-ValidateCommand {
|
||||||
param(
|
param(
|
||||||
[Parameter(Mandatory)]
|
[Parameter(Mandatory)]
|
||||||
[string]$Command
|
[string]$Command
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ function Invoke-DownloadXcodeArchive {
|
|||||||
|
|
||||||
# TO-DO: Consider replacing of xcversion with own implementation
|
# TO-DO: Consider replacing of xcversion with own implementation
|
||||||
Write-Host "Downloading Xcode $resolvedVersion"
|
Write-Host "Downloading Xcode $resolvedVersion"
|
||||||
Invoke-ExpressionWithValidation "xcversion install '$resolvedVersion' --no-install"
|
Invoke-ValidateCommand "xcversion install '$resolvedVersion' --no-install"
|
||||||
}
|
}
|
||||||
|
|
||||||
function Resolve-ExactXcodeVersion {
|
function Resolve-ExactXcodeVersion {
|
||||||
@@ -85,7 +85,7 @@ function Expand-XcodeXipArchive {
|
|||||||
|
|
||||||
Write-Host "Extracting Xcode from '$xcodeXipPath'"
|
Write-Host "Extracting Xcode from '$xcodeXipPath'"
|
||||||
Push-Location $DownloadDirectory
|
Push-Location $DownloadDirectory
|
||||||
Invoke-ExpressionWithValidation "xip -x $xcodeXipPath"
|
Invoke-ValidateCommand "xip -x $xcodeXipPath"
|
||||||
Pop-Location
|
Pop-Location
|
||||||
|
|
||||||
if (Test-Path "$DownloadDirectory/Xcode-beta.app") {
|
if (Test-Path "$DownloadDirectory/Xcode-beta.app") {
|
||||||
@@ -110,7 +110,7 @@ function Confirm-XcodeIntegrity {
|
|||||||
$XcodeRootPath = Get-XcodeRootPath -Version $Version
|
$XcodeRootPath = Get-XcodeRootPath -Version $Version
|
||||||
if (Test-XcodeStableRelease -XcodeRootPath $XcodeRootPath) {
|
if (Test-XcodeStableRelease -XcodeRootPath $XcodeRootPath) {
|
||||||
Write-Host "Validating Xcode integrity for '$XcodeRootPath'..."
|
Write-Host "Validating Xcode integrity for '$XcodeRootPath'..."
|
||||||
Invoke-ExpressionWithValidation "spctl --assess --raw $XcodeRootPath"
|
Invoke-ValidateCommand "spctl --assess --raw $XcodeRootPath"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,7 +123,7 @@ function Approve-XcodeLicense {
|
|||||||
$XcodeRootPath = Get-XcodeRootPath -Version $Version
|
$XcodeRootPath = Get-XcodeRootPath -Version $Version
|
||||||
Write-Host "Approving Xcode license for '$XcodeRootPath'..."
|
Write-Host "Approving Xcode license for '$XcodeRootPath'..."
|
||||||
$xcodeBuildPath = Get-XcodeToolPath -XcodeRootPath $XcodeRootPath -ToolName "xcodebuild"
|
$xcodeBuildPath = Get-XcodeToolPath -XcodeRootPath $XcodeRootPath -ToolName "xcodebuild"
|
||||||
Invoke-ExpressionWithValidation "sudo $xcodeBuildPath -license accept"
|
Invoke-ValidateCommand "sudo $xcodeBuildPath -license accept"
|
||||||
}
|
}
|
||||||
|
|
||||||
function Install-XcodeAdditionalPackages {
|
function Install-XcodeAdditionalPackages {
|
||||||
@@ -136,7 +136,7 @@ function Install-XcodeAdditionalPackages {
|
|||||||
$xcodeRootPath = Get-XcodeRootPath -Version $Version
|
$xcodeRootPath = Get-XcodeRootPath -Version $Version
|
||||||
$packages = Get-ChildItem -Path "$xcodeRootPath/Contents/Resources/Packages" -Filter "*.pkg" -File
|
$packages = Get-ChildItem -Path "$xcodeRootPath/Contents/Resources/Packages" -Filter "*.pkg" -File
|
||||||
$packages | ForEach-Object {
|
$packages | ForEach-Object {
|
||||||
Invoke-ExpressionWithValidation "sudo installer -pkg $($_.FullName) -target / -allowUntrusted"
|
Invoke-ValidateCommand "sudo installer -pkg $($_.FullName) -target / -allowUntrusted"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,7 +152,7 @@ function Invoke-XcodeRunFirstLaunch {
|
|||||||
|
|
||||||
Write-Host "Running 'runFirstLaunch' for Xcode $Version..."
|
Write-Host "Running 'runFirstLaunch' for Xcode $Version..."
|
||||||
$xcodeRootPath = Get-XcodeToolPath -Version $Version -ToolName "xcodebuild"
|
$xcodeRootPath = Get-XcodeToolPath -Version $Version -ToolName "xcodebuild"
|
||||||
Invoke-ExpressionWithValidation "sudo $xcodeRootPath -runFirstLaunch"
|
Invoke-ValidateCommand "sudo $xcodeRootPath -runFirstLaunch"
|
||||||
}
|
}
|
||||||
|
|
||||||
function Build-XcodeSymlinks {
|
function Build-XcodeSymlinks {
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
# The script currently requires 2 external variables to be set: XCODE_INSTALL_USER
|
# The script currently requires 2 external variables to be set: XCODE_INSTALL_USER
|
||||||
# and XCODE_INSTALL_PASSWORD, in order to access the Apple Developer Center
|
# and XCODE_INSTALL_PASSWORD, in order to access the Apple Developer Center
|
||||||
|
|
||||||
Write-Host "Script begin"
|
|
||||||
|
|
||||||
$ErrorActionPreference = "Stop"
|
$ErrorActionPreference = "Stop"
|
||||||
|
|
||||||
Import-Module "$env:HOME/image-generation/helpers/Common.Helpers.psm1"
|
Import-Module "$env:HOME/image-generation/helpers/Common.Helpers.psm1"
|
||||||
|
|||||||
Reference in New Issue
Block a user