From 64feb16022ae615f630beaa9c589adb61da63017 Mon Sep 17 00:00:00 2001 From: Vincent Dai <23257217+vidai-msft@users.noreply.github.com> Date: Thu, 26 Jun 2025 15:58:13 +0800 Subject: [PATCH 1/2] Live test os upgrade. --- .azure-pipelines/live-test.yml | 71 +++++++++------------------------- 1 file changed, 18 insertions(+), 53 deletions(-) diff --git a/.azure-pipelines/live-test.yml b/.azure-pipelines/live-test.yml index ffc497e949fb..98dfc677c4ee 100644 --- a/.azure-pipelines/live-test.yml +++ b/.azure-pipelines/live-test.yml @@ -13,8 +13,7 @@ parameters: default: ' ' variables: - os_windows_2019: windows-2019 - os_windows_2022: windows-2022 + os_windows: windows-latest os_linux: ubuntu-latest os_macos: macOS-latest win_ps_5_1: 5.1 @@ -36,8 +35,8 @@ stages: jobs: - template: util/live-test-steps.yml parameters: - name: 'win_ps_5_1_win_2019' - vmImage: ${{ variables.os_windows_2019 }} + name: 'ps_5_1_windows' + vmImage: ${{ variables.os_windows }} osType: 'Windows' psVersion: ${{ variables.win_ps_5_1 }} dotnetVersion: ${{ variables.dotnet_sdk_8 }} @@ -46,48 +45,8 @@ stages: - template: util/live-test-steps.yml parameters: - name: 'win_ps_5_1_win_2022' - vmImage: ${{ variables.os_windows_2022 }} - osType: 'Windows' - psVersion: ${{ variables.win_ps_5_1 }} - dotnetVersion: ${{ variables.dotnet_sdk_8 }} - galleryName: ${{ parameters.GalleryName }} - pipelineBuildId: ${{ parameters.PipelineBuildId }} - - - template: util/live-test-steps.yml - parameters: - name: 'ps_7_4_x_win_2019' - vmImage: ${{ variables.os_windows_2019 }} - osType: 'Windows' - psVersion: ${{ variables.ps_7_4_x }} - dotnetVersion: ${{ variables.dotnet_sdk_8 }} - galleryName: ${{ parameters.GalleryName }} - pipelineBuildId: ${{ parameters.PipelineBuildId }} - - - template: util/live-test-steps.yml - parameters: - name: 'ps_7_5_x_win_2019' - vmImage: ${{ variables.os_windows_2019 }} - osType: 'Windows' - psVersion: ${{ variables.ps_7_5_x }} - dotnetVersion: ${{ variables.dotnet_sdk_9 }} - galleryName: ${{ parameters.GalleryName }} - pipelineBuildId: ${{ parameters.PipelineBuildId }} - - - template: util/live-test-steps.yml - parameters: - name: 'ps_latest_win_2019' - vmImage: ${{ variables.os_windows_2019 }} - osType: 'Windows' - psVersion: ${{ variables.ps_latest }} - dotnetVersion: ${{ variables.dotnet_sdk_9 }} - galleryName: ${{ parameters.GalleryName }} - pipelineBuildId: ${{ parameters.PipelineBuildId }} - - - template: util/live-test-steps.yml - parameters: - name: 'ps_7_4_x_win_2022' - vmImage: ${{ variables.os_windows_2022 }} + name: 'ps_7_4_x_windows' + vmImage: ${{ variables.os_windows }} osType: 'Windows' psVersion: ${{ variables.ps_7_4_x }} dotnetVersion: ${{ variables.dotnet_sdk_8 }} @@ -96,8 +55,8 @@ stages: - template: util/live-test-steps.yml parameters: - name: 'ps_7_5_x_win_2022' - vmImage: ${{ variables.os_windows_2022 }} + name: 'ps_7_5_x_windows' + vmImage: ${{ variables.os_windows }} osType: 'Windows' psVersion: ${{ variables.ps_7_5_x }} dotnetVersion: ${{ variables.dotnet_sdk_9 }} @@ -106,8 +65,8 @@ stages: - template: util/live-test-steps.yml parameters: - name: 'ps_latest_win_2022' - vmImage: ${{ variables.os_windows_2022 }} + name: 'ps_latest_windows' + vmImage: ${{ variables.os_windows }} osType: 'Windows' psVersion: ${{ variables.ps_latest }} dotnetVersion: ${{ variables.dotnet_sdk_9 }} @@ -146,27 +105,33 @@ stages: # - template: util/live-test-steps.yml # parameters: - # name: 'ps_7_4_x_macOS' + # name: 'ps_7_4_x_macos' # vmImage: ${{ variables.os_macos }} # osType: 'MacOS' # psVersion: ${{ variables.ps_7_4_x }} # dotnetVersion: ${{ variables.dotnet_sdk_8 }} + # galleryName: ${{ parameters.GalleryName }} + # pipelineBuildId: ${{ parameters.PipelineBuildId }} # - template: util/live-test-steps.yml # parameters: - # name: 'ps_7_5_x_macOS' + # name: 'ps_7_5_x_macos' # vmImage: ${{ variables.os_macos }} # osType: 'MacOS' # psVersion: ${{ variables.ps_7_5_x }} # dotnetVersion: ${{ variables.dotnet_sdk_9 }} + # galleryName: ${{ parameters.GalleryName }} + # pipelineBuildId: ${{ parameters.PipelineBuildId }} # - template: util/live-test-steps.yml # parameters: - # name: 'ps_latest_macOS' + # name: 'ps_latest_macos' # vmImage: ${{ variables.os_macos }} # osType: 'MacOS' # psVersion: ${{ variables.ps_latest }} # dotnetVersion: ${{ variables.dotnet_sdk_9 }} + # galleryName: ${{ parameters.GalleryName }} + # pipelineBuildId: ${{ parameters.PipelineBuildId }} - stage: Report displayName: Send Report From bfb2c5057b3ab8447aa44915b29bf1e4211db6b3 Mon Sep 17 00:00:00 2001 From: Vincent Dai <23257217+vidai-msft@users.noreply.github.com> Date: Fri, 27 Jun 2025 15:24:08 +0800 Subject: [PATCH 2/2] Fix MacOS live test hang issue --- .azure-pipelines/live-test.yml | 58 +++++++++---------- .azure-pipelines/util/live-test-steps.yml | 11 ++++ .../Live/CleanAzureIdentityKeysForMacOS | 44 ++++++++++++++ 3 files changed, 84 insertions(+), 29 deletions(-) create mode 100644 tools/TestFx/Live/CleanAzureIdentityKeysForMacOS diff --git a/.azure-pipelines/live-test.yml b/.azure-pipelines/live-test.yml index 98dfc677c4ee..d61c55bf672b 100644 --- a/.azure-pipelines/live-test.yml +++ b/.azure-pipelines/live-test.yml @@ -103,35 +103,35 @@ stages: galleryName: ${{ parameters.GalleryName }} pipelineBuildId: ${{ parameters.PipelineBuildId }} - # - template: util/live-test-steps.yml - # parameters: - # name: 'ps_7_4_x_macos' - # vmImage: ${{ variables.os_macos }} - # osType: 'MacOS' - # psVersion: ${{ variables.ps_7_4_x }} - # dotnetVersion: ${{ variables.dotnet_sdk_8 }} - # galleryName: ${{ parameters.GalleryName }} - # pipelineBuildId: ${{ parameters.PipelineBuildId }} - - # - template: util/live-test-steps.yml - # parameters: - # name: 'ps_7_5_x_macos' - # vmImage: ${{ variables.os_macos }} - # osType: 'MacOS' - # psVersion: ${{ variables.ps_7_5_x }} - # dotnetVersion: ${{ variables.dotnet_sdk_9 }} - # galleryName: ${{ parameters.GalleryName }} - # pipelineBuildId: ${{ parameters.PipelineBuildId }} - - # - template: util/live-test-steps.yml - # parameters: - # name: 'ps_latest_macos' - # vmImage: ${{ variables.os_macos }} - # osType: 'MacOS' - # psVersion: ${{ variables.ps_latest }} - # dotnetVersion: ${{ variables.dotnet_sdk_9 }} - # galleryName: ${{ parameters.GalleryName }} - # pipelineBuildId: ${{ parameters.PipelineBuildId }} + - template: util/live-test-steps.yml + parameters: + name: 'ps_7_4_x_macos' + vmImage: ${{ variables.os_macos }} + osType: 'MacOS' + psVersion: ${{ variables.ps_7_4_x }} + dotnetVersion: ${{ variables.dotnet_sdk_8 }} + galleryName: ${{ parameters.GalleryName }} + pipelineBuildId: ${{ parameters.PipelineBuildId }} + + - template: util/live-test-steps.yml + parameters: + name: 'ps_7_5_x_macos' + vmImage: ${{ variables.os_macos }} + osType: 'MacOS' + psVersion: ${{ variables.ps_7_5_x }} + dotnetVersion: ${{ variables.dotnet_sdk_9 }} + galleryName: ${{ parameters.GalleryName }} + pipelineBuildId: ${{ parameters.PipelineBuildId }} + + - template: util/live-test-steps.yml + parameters: + name: 'ps_latest_macos' + vmImage: ${{ variables.os_macos }} + osType: 'MacOS' + psVersion: ${{ variables.ps_latest }} + dotnetVersion: ${{ variables.dotnet_sdk_9 }} + galleryName: ${{ parameters.GalleryName }} + pipelineBuildId: ${{ parameters.PipelineBuildId }} - stage: Report displayName: Send Report diff --git a/.azure-pipelines/util/live-test-steps.yml b/.azure-pipelines/util/live-test-steps.yml index 31df28f7309a..40747c69fa33 100644 --- a/.azure-pipelines/util/live-test-steps.yml +++ b/.azure-pipelines/util/live-test-steps.yml @@ -97,6 +97,17 @@ jobs: outVar: 'LiveTestServicePrincipalSecret' execCondition: and(succeeded(), ne(variables['skipLatest'], 'true')) + - task: Bash@3 + displayName: Clean up Azure Identity Keys from MacOS Keychain + condition: and(succeeded(), ne(variables['skipLatest'], 'true'), ${{ eq(parameters.osType, 'MacOS') }}) + continueOnError: true + inputs: + targetType: filePath + filePath: ./tools/TestFx/Live/CleanAzureIdentityKeysForMacOS + failOnStderr: false + env: + KEYCHAIN_SERVICES: '$(AzureIdentityKeychainServices)' + - task: PowerShell@2 displayName: Connect Azure with live test service principal condition: and(succeeded(), ne(variables['skipLatest'], 'true')) diff --git a/tools/TestFx/Live/CleanAzureIdentityKeysForMacOS b/tools/TestFx/Live/CleanAzureIdentityKeysForMacOS new file mode 100644 index 000000000000..508c3bc39239 --- /dev/null +++ b/tools/TestFx/Live/CleanAzureIdentityKeysForMacOS @@ -0,0 +1,44 @@ +#!/bin/bash +# Purpose: Clean up Azure Identity Keys from the MacOS Keychain + +cleanup_service_from_keychain() { + local service_name="$1" + echo "Processing keychain entry: $service_name" + + if security find-generic-password -s "$service_name" &> /dev/null; then + echo "##[section]Found keychain entry for '$service_name'. Attempting to delete..." + + if security delete-generic-password -s "$service_name" &> /dev/null; then + echo "##[section]Successfully deleted '$service_name' from keychain." + return 0 + else + echo "##[warning]Failed to delete '$service_name' from keychain." + return 1 + fi + else + echo "##[warning]No keychain entry found for '$service_name'." + return 0 + fi +} + +if [ -n "$KEYCHAIN_SERVICES" ]; then + IFS=',' read -ra SERVICES_TO_CLEAN <<< "$KEYCHAIN_SERVICES" + echo "Keychain services to be cleaned up: $KEYCHAIN_SERVICES" + echo + + CLEANUP_FAILED=0 + for service in "${SERVICES_TO_CLEAN[@]}"; do + if ! cleanup_service_from_keychain "$service"; then + CLEANUP_FAILED=1 + fi + echo + done + + if [ $CLEANUP_FAILED -eq 1 ]; then + echo "##[warning]Some keychain entries could not be removed" + else + echo "##[section]All keychain services cleaned up successfully" + fi +else + echo "##[warning]No keychain services specified for cleanup." +fi