mirror of
https://github.com/actions/runner-images.git
synced 2025-12-29 13:17:53 +08:00
Update structure
This commit is contained in:
@@ -26,7 +26,7 @@ jobs:
|
||||
displayName: 'Build VM'
|
||||
inputs:
|
||||
targetType: filePath
|
||||
filePath: ./images.CI/build-image.ps1
|
||||
filePath: ./images.CI/linux-and-win/build-image.ps1
|
||||
arguments: -ResourcesNamePrefix $(Build.BuildId) `
|
||||
-ClientId $(CLIENT_ID) `
|
||||
-ClientSecret $(CLIENT_SECRET) `
|
||||
@@ -45,7 +45,7 @@ jobs:
|
||||
displayName: 'Create release for VM deployment'
|
||||
inputs:
|
||||
targetType: filePath
|
||||
filePath: ./images.CI/create-release.ps1
|
||||
filePath: ./images.CI/linux-and-win/create-release.ps1
|
||||
arguments: -BuildId $(Build.BuildId) `
|
||||
-Organization $(RELEASE_TARGET_ORGANIZATION) `
|
||||
-DefinitionId $(RELEASE_TARGET_DEFINITION_ID) `
|
||||
@@ -66,7 +66,7 @@ jobs:
|
||||
condition: always()
|
||||
inputs:
|
||||
targetType: filePath
|
||||
filePath: ./images.CI/cleanup.ps1
|
||||
filePath: ./images.CI/linux-and-win/cleanup.ps1
|
||||
arguments: -ResourcesNamePrefix $(Build.BuildId) `
|
||||
-ClientId $(CLIENT_ID) `
|
||||
-ClientSecret $(CLIENT_SECRET) `
|
||||
|
||||
@@ -28,30 +28,30 @@ jobs:
|
||||
SourceFolder: 'images/macos/provision/log/'
|
||||
RemoveSourceFolder: true
|
||||
|
||||
- bash: |
|
||||
export PACKER_LOG=0
|
||||
packer build -on-error=abort \
|
||||
-var="vcenter_server=$(vcenter_server_v2)" \
|
||||
-var="vcenter_username=$(vcenter_username_v2)" \
|
||||
-var="vcenter_password=$(vcenter_password_v2)" \
|
||||
-var="vcenter_datacenter=$(vcenter_datacenter_v2)" \
|
||||
-var="cluster_or_esxi_host=$(esxi_cluster_v2)" \
|
||||
-var="esxi_datastore=${{ parameters.target_datastore }}" \
|
||||
-var="output_folder=mms-output" \
|
||||
-var="vm_username=$(vm_username)" \
|
||||
-var="vm_password=$(vm_password)" \
|
||||
-var="build_id=$(Build.BuildNumber)" \
|
||||
-var="baseimage_name=${{ parameters.base_image_name }}" \
|
||||
-var="azure_storage_sas=$(AZURE_STORAGE_SAS)" \
|
||||
-var="azure_storage_account=$(AZURE_STORAGE_ACCOUNT)" \
|
||||
-var="build_assets_url=$(appcenter_build_assets_url)" \
|
||||
-var="github_feed_token=$(GITHUB_FEED_TOKEN)" \
|
||||
-var="xcode_install_user=$(xcode-installation-user)" \
|
||||
-var="xcode_install_password=$(xcode-installation-password)" \
|
||||
-color=false \
|
||||
${{ parameters.template_path }}
|
||||
- task: PowerShell@2
|
||||
displayName: 'Build VM'
|
||||
inputs:
|
||||
targetType: filePath
|
||||
filePath: ./images.CI/macos/build-image.ps1
|
||||
arguments: -Image "${{ parameters.image_name }}" `
|
||||
-VcenterServer "$(vcenter_server_v2)" `
|
||||
-VcenterUsername "$(vcenter_username_v2)" `
|
||||
-VcenterPassword "$(vcenter_password_v2)" `
|
||||
-VcenterDatacenter "$(vcenter_datacenter_v2)" `
|
||||
-EsxiCluster "$(esxi_cluster_v2)" `
|
||||
-TargetDatastore "${{ parameters.target_datastore }}" `
|
||||
-OutputFolder "mms-output" `
|
||||
-VmUsername "$(vm_username)" `
|
||||
-VmPassword "$(vm_password)" `
|
||||
-BuildId "$(Build.BuildNumber)" `
|
||||
-BaseImageName "${{ parameters.base_image_name }}" `
|
||||
-AzureStorageSas "$(AZURE_STORAGE_SAS)" `
|
||||
-AzureStorageAccount "$(AZURE_STORAGE_ACCOUNT)" `
|
||||
-BuildAssetsUrl "$(appcenter_build_assets_url)" `
|
||||
-GithubFeedToken "$(GITHUB_FEED_TOKEN)" `
|
||||
-XcodeInstallationUser "$(xcode-installation-user)" `
|
||||
-XcodeInstallationPassword "$(xcode-installation-password)"
|
||||
workingDirectory: 'images/macos'
|
||||
displayName: Build image
|
||||
|
||||
- bash: |
|
||||
echo "Copy image output files"
|
||||
@@ -82,3 +82,11 @@ jobs:
|
||||
failTaskOnFailedTests: true
|
||||
displayName: Publish test results
|
||||
condition: always()
|
||||
|
||||
- task: Bash@3
|
||||
inputs:
|
||||
targetType: filePath
|
||||
filePath: ./images.CI/macos/destroy_vm.sh
|
||||
arguments: '"$(vcenter_server_v2)" "$(vcenter_username_v2)" "$(vcenter_password_v2)" "$(vcenter_datacenter_v2)/vm/mms-output/$(Build.BuildNumber)"'
|
||||
condition: eq(variables['Agent.JobStatus'], 'Canceled')
|
||||
displayName: Destroy VM (if build canceled only)
|
||||
@@ -18,6 +18,5 @@ jobs:
|
||||
parameters:
|
||||
image_label: 'macOS High Sierra'
|
||||
base_image_name: 'clean-macOS-10.13.6-380Gb-SIPoff_runner'
|
||||
template_path: 'templates/macOS-10.13.json'
|
||||
image_name: 'macOS-10.13'
|
||||
target_datastore: 'ds-image'
|
||||
stable: false
|
||||
|
||||
@@ -18,6 +18,5 @@ jobs:
|
||||
parameters:
|
||||
image_label: 'macOS Mojave'
|
||||
base_image_name: 'clean-macOS-10.14-380Gb_runner'
|
||||
template_path: 'templates/macOS-10.14.json'
|
||||
image_name: 'macOS-10.14'
|
||||
target_datastore: 'ds-image'
|
||||
stable: false
|
||||
|
||||
@@ -18,6 +18,5 @@ jobs:
|
||||
parameters:
|
||||
image_label: 'macOS Catalina'
|
||||
base_image_name: 'clean-macOS-10.15-380Gb-runner'
|
||||
template_path: 'templates/macOS-10.15.json'
|
||||
image_name: 'macOS-10.15'
|
||||
target_datastore: 'ds-image'
|
||||
stable: false
|
||||
|
||||
55
images.CI/macos/build-image.ps1
Normal file
55
images.CI/macos/build-image.ps1
Normal file
@@ -0,0 +1,55 @@
|
||||
param(
|
||||
[String] [Parameter (Mandatory=$true)] $Image,
|
||||
[String] [Parameter (Mandatory=$true)] $VcenterServer,
|
||||
[String] [Parameter (Mandatory=$true)] $VcenterUsername,
|
||||
[String] [Parameter (Mandatory=$true)] $VcenterPassword,
|
||||
[String] [Parameter (Mandatory=$true)] $VcenterDatacenter,
|
||||
[String] [Parameter (Mandatory=$true)] $EsxiCluster,
|
||||
[String] [Parameter (Mandatory=$true)] $TargetDatastore,
|
||||
[String] [Parameter (Mandatory=$true)] $OutputFolder,
|
||||
[String] [Parameter (Mandatory=$true)] $VmUsername,
|
||||
[String] [Parameter (Mandatory=$true)] $VmPassword,
|
||||
[String] [Parameter (Mandatory=$true)] $BuildId,
|
||||
[String] [Parameter (Mandatory=$true)] $BaseImageName,
|
||||
[String] [Parameter (Mandatory=$true)] $AzureStorageSas,
|
||||
[String] [Parameter (Mandatory=$true)] $AzureStorageAccount,
|
||||
[String] [Parameter (Mandatory=$true)] $BuildAssetsUrl,
|
||||
[String] [Parameter (Mandatory=$true)] $GithubFeedToken,
|
||||
[String] [Parameter (Mandatory=$true)] $XcodeInstallationUser,
|
||||
[String] [Parameter (Mandatory=$true)] $XcodeInstallationPassword
|
||||
)
|
||||
|
||||
$TemplatePath = (Get-ChildItem -Path "images" -Include "$Image.json" -Recurse -Depth 2).FullName
|
||||
if (-not $TemplatePath)
|
||||
{
|
||||
Write-Error "'-Image' parameter is not valid. You have to specify correct image type."
|
||||
exit 1
|
||||
}
|
||||
|
||||
$env:PACKER_LOG = 0
|
||||
|
||||
packer validate -syntax-only $TemplatePath
|
||||
|
||||
Write-Host "Show Packer Version"
|
||||
packer --version
|
||||
|
||||
Write-Host "Build $Image VM"
|
||||
packer build -on-error=abort -var="vcenter_server=$VcenterServer" `
|
||||
-var="vcenter_username=$VcenterUsername" `
|
||||
-var="vcenter_password=$VcenterPassword" `
|
||||
-var="vcenter_datacenter=$VcenterDatacenter" `
|
||||
-var="cluster_or_esxi_host=$EsxiCluster" `
|
||||
-var="esxi_datastore=$TargetDatastore" `
|
||||
-var="output_folder=$OutputFolder" `
|
||||
-var="vm_username=$VmUsername" `
|
||||
-var="vm_password=$VmPassword" `
|
||||
-var="build_id=$BuildId" `
|
||||
-var="baseimage_name=$BaseImageName" `
|
||||
-var="azure_storage_sas=$AzureStorageSas" `
|
||||
-var="azure_storage_account=$AzureStorageAccount" `
|
||||
-var="build_assets_url=$BuildAssetsUrl" `
|
||||
-var="github_feed_token=$GithubFeedToken" `
|
||||
-var="xcode_install_user=$XcodeInstallationUser" `
|
||||
-var="xcode_install_password=$XcodeInstallationPassword" `
|
||||
-color=false `
|
||||
$TemplatePath
|
||||
18
images.CI/macos/destroy_vm.sh
Normal file
18
images.CI/macos/destroy_vm.sh
Normal file
@@ -0,0 +1,18 @@
|
||||
VCENTER_SERVER=$1
|
||||
VCENTER_USERNAME=$2
|
||||
VCENTER_PASSWORD=$3
|
||||
VM_IPATH=$4
|
||||
|
||||
URLENCODE="image-generation/bootstrap/support/urlencode.sh"
|
||||
|
||||
govc vm.power -k=true \
|
||||
-off=true \
|
||||
-u "$VCENTER_USERNAME:`$URLENCODE "$VCENTER_PASSWORD"`@$VCENTER_SERVER" \
|
||||
-vm.ipath="$VM_IPATH"
|
||||
|
||||
#Time to VM's shutdown
|
||||
sleep 30
|
||||
|
||||
govc vm.destroy -k=true \
|
||||
-u "$VCENTER_USERNAME:`$URLENCODE "$VCENTER_PASSWORD"`@$VCENTER_SERVER" \
|
||||
-vm.ipath="$VM_IPATH"
|
||||
Reference in New Issue
Block a user