diff --git a/.github/workflows/macos-generation.yml b/.github/workflows/macos-generation.yml index 156df7064..1bbb94223 100644 --- a/.github/workflows/macos-generation.yml +++ b/.github/workflows/macos-generation.yml @@ -192,6 +192,7 @@ jobs: -PrintTopNLongest 25 - name: Move vm to cold storage and clear datastore tag + if: ${{ always() }} run: | $cpuCount = 3 $coresPerSocketCount = 3 @@ -203,6 +204,7 @@ jobs: -VIServer "${{ secrets.VISERVER_V2 }}" ` -VIUserName "${{ env.VI_USER_NAME }}" ` -VIPassword "${{ env.VI_PASSWORD }}" ` + -JobStatus "${{ job.status }}" ` -CpuCount "$cpuCount" ` -CoresPerSocketCount "$coresPerSocketCount" ` -Memory "$memory" diff --git a/.github/workflows/macos11.yml b/.github/workflows/macos11.yml index b35480251..5cbcf266d 100644 --- a/.github/workflows/macos11.yml +++ b/.github/workflows/macos11.yml @@ -17,7 +17,7 @@ on: jobs: macOS_11: - if: ${{ (github.event.label.name == 'macos-all') || (github.event.label.name == 'macos-11') || (inputs.CUSTOM_REPOSITORY != '' && inputs.CUSTOM_REPOSITORY_COMMIT_HASH != '') || (github.event_name == 'schedule') }} + if: ${{ (github.event.label.name == 'macos-all') || (github.event.label.name == 'macos-11') || (github.event_name == 'workflow_dispatch') || (github.event_name == 'schedule') }} name: macOS-11_unstable.${{ github.run_id }}.${{ github.run_attempt }} uses: ./.github/workflows/macos-generation.yml with: diff --git a/.github/workflows/macos12.yml b/.github/workflows/macos12.yml index 0ece0eb87..6720975e8 100644 --- a/.github/workflows/macos12.yml +++ b/.github/workflows/macos12.yml @@ -17,7 +17,7 @@ on: jobs: macOS_12: - if: ${{ (github.event.label.name == 'macos-all') || (github.event.label.name == 'macos-12') || (inputs.CUSTOM_REPOSITORY != '' && inputs.CUSTOM_REPOSITORY_COMMIT_HASH != '') || (github.event_name == 'schedule') }} + if: ${{ (github.event.label.name == 'macos-all') || (github.event.label.name == 'macos-12') || (github.event_name == 'workflow_dispatch') || (github.event_name == 'schedule') }} name: macOS-12_unstable.${{ github.run_id }}.${{ github.run_attempt }} uses: ./.github/workflows/macos-generation.yml with: diff --git a/.github/workflows/ubuntu2004.yml b/.github/workflows/ubuntu2004.yml index 8476ab7d3..512a78373 100644 --- a/.github/workflows/ubuntu2004.yml +++ b/.github/workflows/ubuntu2004.yml @@ -17,7 +17,7 @@ on: jobs: Ubuntu_2004: - if: ${{ (github.event.label.name == 'ubuntu-all') || (github.event.label.name == 'ubuntu-2004') || (inputs.CUSTOM_REPOSITORY != '' && inputs.CUSTOM_REPOSITORY_COMMIT_HASH != '') || (github.event_name == 'schedule') }} + if: ${{ (github.event.label.name == 'ubuntu-all') || (github.event.label.name == 'ubuntu-2004') || (github.event_name == 'workflow_dispatch') || (github.event_name == 'schedule') }} uses: ./.github/workflows/ubuntu-win-generation.yml with: image_name: 'ubuntu2004' diff --git a/.github/workflows/ubuntu2204.yml b/.github/workflows/ubuntu2204.yml index 446427ada..da8a718a9 100644 --- a/.github/workflows/ubuntu2204.yml +++ b/.github/workflows/ubuntu2204.yml @@ -17,7 +17,7 @@ on: jobs: Ubuntu_2204: - if: ${{ (github.event.label.name == 'ubuntu-all') || (github.event.label.name == 'ubuntu-2204') || (inputs.CUSTOM_REPOSITORY != '' && inputs.CUSTOM_REPOSITORY_COMMIT_HASH != '') || (github.event_name == 'schedule') }} + if: ${{ (github.event.label.name == 'ubuntu-all') || (github.event.label.name == 'ubuntu-2204') || (github.event_name == 'workflow_dispatch') || (github.event_name == 'schedule') }} uses: ./.github/workflows/ubuntu-win-generation.yml with: image_name: 'ubuntu2204' diff --git a/.github/workflows/windows2019.yml b/.github/workflows/windows2019.yml index 2de6404c6..d1bec3ed2 100644 --- a/.github/workflows/windows2019.yml +++ b/.github/workflows/windows2019.yml @@ -17,7 +17,7 @@ on: jobs: Windows_2019: - if: ${{ (github.event.label.name == 'windows-all') || (github.event.label.name == 'windows-2019') || (inputs.CUSTOM_REPOSITORY != '' && inputs.CUSTOM_REPOSITORY_COMMIT_HASH != '') || (github.event_name == 'schedule') }} + if: ${{ (github.event.label.name == 'windows-all') || (github.event.label.name == 'windows-2019') || (github.event_name == 'workflow_dispatch') || (github.event_name == 'schedule') }} uses: ./.github/workflows/ubuntu-win-generation.yml with: image_name: 'windows2019' diff --git a/.github/workflows/windows2022.yml b/.github/workflows/windows2022.yml index ef5e5d3d5..1ad40f08f 100644 --- a/.github/workflows/windows2022.yml +++ b/.github/workflows/windows2022.yml @@ -17,7 +17,7 @@ on: jobs: Windows_2022: - if: ${{ (github.event.label.name == 'windows-all') || (github.event.label.name == 'windows-2022') || (inputs.CUSTOM_REPOSITORY != '' && inputs.CUSTOM_REPOSITORY_COMMIT_HASH != '') || (github.event_name == 'schedule') }} + if: ${{ (github.event.label.name == 'windows-all') || (github.event.label.name == 'windows-2022') || (github.event_name == 'workflow_dispatch') || (github.event_name == 'schedule') }} uses: ./.github/workflows/ubuntu-win-generation.yml with: image_name: 'windows2022' diff --git a/images.CI/macos/move-vm.ps1 b/images.CI/macos/move-vm.ps1 index 4128c36b7..4b5cb9e24 100644 --- a/images.CI/macos/move-vm.ps1 +++ b/images.CI/macos/move-vm.ps1 @@ -41,6 +41,8 @@ param( [ValidateNotNullOrEmpty()] [string]$VIPassword, + [string]$JobStatus, + [int32]$CpuCount, [int32]$CoresPerSocketCount, @@ -62,7 +64,7 @@ try { } $vm = Get-VM $VMName -if ($env:AGENT_JOBSTATUS -eq 'Failed') { +if (($env:AGENT_JOBSTATUS -and $env:AGENT_JOBSTATUS -eq 'Failed') -or ($JobStatus -and $JobStatus -eq 'failure')) { try { if($vm.PowerState -ne "PoweredOff") { Stop-VM -VM $vm -Confirm:$false -ErrorAction Stop | Out-Null