Update structure
This commit is contained in:
@@ -26,7 +26,7 @@ jobs:
|
|||||||
displayName: 'Build VM'
|
displayName: 'Build VM'
|
||||||
inputs:
|
inputs:
|
||||||
targetType: filePath
|
targetType: filePath
|
||||||
filePath: ./images.CI/build-image.ps1
|
filePath: ./images.CI/linux-and-win/build-image.ps1
|
||||||
arguments: -ResourcesNamePrefix $(Build.BuildId) `
|
arguments: -ResourcesNamePrefix $(Build.BuildId) `
|
||||||
-ClientId $(CLIENT_ID) `
|
-ClientId $(CLIENT_ID) `
|
||||||
-ClientSecret $(CLIENT_SECRET) `
|
-ClientSecret $(CLIENT_SECRET) `
|
||||||
@@ -45,7 +45,7 @@ jobs:
|
|||||||
displayName: 'Create release for VM deployment'
|
displayName: 'Create release for VM deployment'
|
||||||
inputs:
|
inputs:
|
||||||
targetType: filePath
|
targetType: filePath
|
||||||
filePath: ./images.CI/create-release.ps1
|
filePath: ./images.CI/linux-and-win/create-release.ps1
|
||||||
arguments: -BuildId $(Build.BuildId) `
|
arguments: -BuildId $(Build.BuildId) `
|
||||||
-Organization $(RELEASE_TARGET_ORGANIZATION) `
|
-Organization $(RELEASE_TARGET_ORGANIZATION) `
|
||||||
-DefinitionId $(RELEASE_TARGET_DEFINITION_ID) `
|
-DefinitionId $(RELEASE_TARGET_DEFINITION_ID) `
|
||||||
@@ -66,7 +66,7 @@ jobs:
|
|||||||
condition: always()
|
condition: always()
|
||||||
inputs:
|
inputs:
|
||||||
targetType: filePath
|
targetType: filePath
|
||||||
filePath: ./images.CI/cleanup.ps1
|
filePath: ./images.CI/linux-and-win/cleanup.ps1
|
||||||
arguments: -ResourcesNamePrefix $(Build.BuildId) `
|
arguments: -ResourcesNamePrefix $(Build.BuildId) `
|
||||||
-ClientId $(CLIENT_ID) `
|
-ClientId $(CLIENT_ID) `
|
||||||
-ClientSecret $(CLIENT_SECRET) `
|
-ClientSecret $(CLIENT_SECRET) `
|
||||||
|
|||||||
@@ -28,30 +28,30 @@ jobs:
|
|||||||
SourceFolder: 'images/macos/provision/log/'
|
SourceFolder: 'images/macos/provision/log/'
|
||||||
RemoveSourceFolder: true
|
RemoveSourceFolder: true
|
||||||
|
|
||||||
- bash: |
|
- task: PowerShell@2
|
||||||
export PACKER_LOG=0
|
displayName: 'Build VM'
|
||||||
packer build -on-error=abort \
|
inputs:
|
||||||
-var="vcenter_server=$(vcenter_server_v2)" \
|
targetType: filePath
|
||||||
-var="vcenter_username=$(vcenter_username_v2)" \
|
filePath: ./images.CI/macos/build-image.ps1
|
||||||
-var="vcenter_password=$(vcenter_password_v2)" \
|
arguments: -Image "${{ parameters.image_name }}" `
|
||||||
-var="vcenter_datacenter=$(vcenter_datacenter_v2)" \
|
-VcenterServer "$(vcenter_server_v2)" `
|
||||||
-var="cluster_or_esxi_host=$(esxi_cluster_v2)" \
|
-VcenterUsername "$(vcenter_username_v2)" `
|
||||||
-var="esxi_datastore=${{ parameters.target_datastore }}" \
|
-VcenterPassword "$(vcenter_password_v2)" `
|
||||||
-var="output_folder=mms-output" \
|
-VcenterDatacenter "$(vcenter_datacenter_v2)" `
|
||||||
-var="vm_username=$(vm_username)" \
|
-EsxiCluster "$(esxi_cluster_v2)" `
|
||||||
-var="vm_password=$(vm_password)" \
|
-TargetDatastore "${{ parameters.target_datastore }}" `
|
||||||
-var="build_id=$(Build.BuildNumber)" \
|
-OutputFolder "mms-output" `
|
||||||
-var="baseimage_name=${{ parameters.base_image_name }}" \
|
-VmUsername "$(vm_username)" `
|
||||||
-var="azure_storage_sas=$(AZURE_STORAGE_SAS)" \
|
-VmPassword "$(vm_password)" `
|
||||||
-var="azure_storage_account=$(AZURE_STORAGE_ACCOUNT)" \
|
-BuildId "$(Build.BuildNumber)" `
|
||||||
-var="build_assets_url=$(appcenter_build_assets_url)" \
|
-BaseImageName "${{ parameters.base_image_name }}" `
|
||||||
-var="github_feed_token=$(GITHUB_FEED_TOKEN)" \
|
-AzureStorageSas "$(AZURE_STORAGE_SAS)" `
|
||||||
-var="xcode_install_user=$(xcode-installation-user)" \
|
-AzureStorageAccount "$(AZURE_STORAGE_ACCOUNT)" `
|
||||||
-var="xcode_install_password=$(xcode-installation-password)" \
|
-BuildAssetsUrl "$(appcenter_build_assets_url)" `
|
||||||
-color=false \
|
-GithubFeedToken "$(GITHUB_FEED_TOKEN)" `
|
||||||
${{ parameters.template_path }}
|
-XcodeInstallationUser "$(xcode-installation-user)" `
|
||||||
|
-XcodeInstallationPassword "$(xcode-installation-password)"
|
||||||
workingDirectory: 'images/macos'
|
workingDirectory: 'images/macos'
|
||||||
displayName: Build image
|
|
||||||
|
|
||||||
- bash: |
|
- bash: |
|
||||||
echo "Copy image output files"
|
echo "Copy image output files"
|
||||||
@@ -82,3 +82,11 @@ jobs:
|
|||||||
failTaskOnFailedTests: true
|
failTaskOnFailedTests: true
|
||||||
displayName: Publish test results
|
displayName: Publish test results
|
||||||
condition: always()
|
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:
|
parameters:
|
||||||
image_label: 'macOS High Sierra'
|
image_label: 'macOS High Sierra'
|
||||||
base_image_name: 'clean-macOS-10.13.6-380Gb-SIPoff_runner'
|
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'
|
target_datastore: 'ds-image'
|
||||||
stable: false
|
|
||||||
|
|||||||
@@ -18,6 +18,5 @@ jobs:
|
|||||||
parameters:
|
parameters:
|
||||||
image_label: 'macOS Mojave'
|
image_label: 'macOS Mojave'
|
||||||
base_image_name: 'clean-macOS-10.14-380Gb_runner'
|
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'
|
target_datastore: 'ds-image'
|
||||||
stable: false
|
|
||||||
|
|||||||
@@ -18,6 +18,5 @@ jobs:
|
|||||||
parameters:
|
parameters:
|
||||||
image_label: 'macOS Catalina'
|
image_label: 'macOS Catalina'
|
||||||
base_image_name: 'clean-macOS-10.15-380Gb-runner'
|
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'
|
target_datastore: 'ds-image'
|
||||||
stable: false
|
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -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