From 9c7709f5cb46b76d1a53763b61adb34097ec05f9 Mon Sep 17 00:00:00 2001 From: Scott Beddall Date: Wed, 19 Nov 2025 23:16:14 +0000 Subject: [PATCH 1/5] utilize whl check for prs --- eng/pipelines/templates/steps/build-test.yml | 97 ++++++++++---------- scripts/devops_tasks/set_tox_environment.py | 3 +- 2 files changed, 48 insertions(+), 52 deletions(-) diff --git a/eng/pipelines/templates/steps/build-test.yml b/eng/pipelines/templates/steps/build-test.yml index 8364a124cb4e..f0f2f1815f5f 100644 --- a/eng/pipelines/templates/steps/build-test.yml +++ b/eng/pipelines/templates/steps/build-test.yml @@ -44,6 +44,8 @@ steps: $(PIP_EXE) freeze displayName: 'Prep Environment' + # this needs to move under eng/scripts from scripts/devops_tasks/ + # AND be renamed prior to merging any PR with this changeset - task: PythonScript@0 displayName: 'Set Tox Environment' inputs: @@ -64,8 +66,6 @@ steps: - ${{ parameters.BeforeTestSteps }} - - template: /eng/pipelines/templates/steps/seed-virtualenv-wheels.yml - - ${{ if eq('true', parameters.UseFederatedAuth) }}: - task: AzurePowerShell@5 @@ -79,6 +79,7 @@ steps: pwsh: true ScriptType: InlineScript Inline: >- + $env:TOX_PIP_IMPL="uv" $account = (Get-AzContext).Account; $env:AZURESUBSCRIPTION_CLIENT_ID = $account.Id; $env:AZURESUBSCRIPTION_TENANT_ID = $account.Tenants; @@ -92,20 +93,20 @@ steps: $markArg = "${{ parameters.TestMarkArgument }}" } - python scripts/devops_tasks/dispatch_tox.py + python eng/scripts/dispatch_checks.py "$(TargetingString)" ${{ parameters.AdditionalTestArgs }} ${{ parameters.CoverageArg }} --mark_arg="$markArg" --service="${{ parameters.ServiceDirectory }}" - --toxenv="${{ parameters.ToxTestEnv }}" + --checks="${{ parameters.ToxTestEnv }}" --injected-packages="${{ parameters.InjectedPackages }}" - --tenvparallel="${{ parameters.ToxEnvParallel }}"; Write-Host "Last exit code: $LASTEXITCODE"; exit $LASTEXITCODE; - ${{ else }}: - pwsh: | + $env:TOX_PIP_IMPL="uv" Write-Host (Get-Command python).Source if ($env:TESTMARKARGUMENT) { @@ -115,14 +116,13 @@ steps: $markArg = "${{ parameters.TestMarkArgument }}" } - python scripts/devops_tasks/dispatch_tox.py "$(TargetingString)" ` + python eng/scripts/dispatch_checks.py "$(TargetingString)" ` ${{ parameters.AdditionalTestArgs }} ` ${{ parameters.CoverageArg }} ` --mark_arg="$markArg" ` --service="${{ parameters.ServiceDirectory }}" ` - --toxenv="${{ parameters.ToxTestEnv }}" ` + --checks="${{ parameters.ToxTestEnv }}" --injected-packages="${{ parameters.InjectedPackages }}" ` - --tenvparallel="${{ parameters.ToxEnvParallel }}"; exit $LASTEXITCODE; env: ${{ parameters.EnvVars }} displayName: Run Tests @@ -147,49 +147,44 @@ steps: displayName: Report Coverage condition: and(succeeded(), ${{ parameters.RunCoverage }}) - - ${{ if eq('true', parameters.UseFederatedAuth) }}: - - task: AzurePowerShell@5 - displayName: Test Samples (AzurePowerShell@5) - condition: and(succeeded(), eq(variables['TestSamples'], 'true')) - env: - SYSTEM_ACCESSTOKEN: $(System.AccessToken) - # Enable samples tests that use DefaultAzureCredential to load the federated pipeline credential - AZURE_POD_IDENTITY_AUTHORITY_HOST: 'https://FakeAuthorityHost' - ${{ insert }}: ${{ parameters.EnvVars }} - inputs: - azureSubscription: azure-sdk-tests-public - azurePowerShellVersion: LatestVersion - pwsh: true - ScriptType: InlineScript - Inline: | - $account = (Get-AzContext).Account; - $env:AZURESUBSCRIPTION_CLIENT_ID = $account.Id; - $env:AZURESUBSCRIPTION_TENANT_ID = $account.Tenants; - - Write-Host (Get-Command python).Source - - python scripts/devops_tasks/dispatch_tox.py "$(TargetingString)" ` - --service="${{ parameters.ServiceDirectory }}" ` - --toxenv="samples" - - Write-Host "Last exit code: $LASTEXITCODE"; - exit $LASTEXITCODE; - - ${{ else }}: - - pwsh: | - if ($IsWindows) { - . $(VENV_LOCATION)/Scripts/Activate.ps1 - } - else { - . $(VENV_LOCATION)/bin/activate.ps1 - } - Write-Host (Get-Command python).Source - python scripts/devops_tasks/dispatch_tox.py "$(TargetingString)" ` - --service="${{ parameters.ServiceDirectory }}" ` - --toxenv="samples" - exit $LASTEXITCODE; - env: ${{ parameters.EnvVars }} - displayName: 'Test Samples' - condition: and(succeeded(), eq(variables['TestSamples'], 'true')) + # re-enable after migrating `samples` + # - ${{ if eq('true', parameters.UseFederatedAuth) }}: + # - task: AzurePowerShell@5 + # displayName: Test Samples (AzurePowerShell@5) + # condition: and(succeeded(), eq(variables['TestSamples'], 'true')) + # env: + # SYSTEM_ACCESSTOKEN: $(System.AccessToken) + # # Enable samples tests that use DefaultAzureCredential to load the federated pipeline credential + # AZURE_POD_IDENTITY_AUTHORITY_HOST: 'https://FakeAuthorityHost' + # ${{ insert }}: ${{ parameters.EnvVars }} + # inputs: + # azureSubscription: azure-sdk-tests-public + # azurePowerShellVersion: LatestVersion + # pwsh: true + # ScriptType: InlineScript + # Inline: | + # $account = (Get-AzContext).Account; + # $env:AZURESUBSCRIPTION_CLIENT_ID = $account.Id; + # $env:AZURESUBSCRIPTION_TENANT_ID = $account.Tenants; + + # Write-Host (Get-Command python).Source + + # python eng/scripts/dispatch_checks.py "$(TargetingString)" ` + # --service="${{ parameters.ServiceDirectory }}" ` + # --checks="samples" + + # Write-Host "Last exit code: $LASTEXITCODE"; + # exit $LASTEXITCODE; + # - ${{ else }}: + # - pwsh: | + # Write-Host (Get-Command python).Source + # python eng/scripts/dispatch_checks.py "$(TargetingString)" ` + # --service="${{ parameters.ServiceDirectory }}" ` + # --checks="samples" + # exit $LASTEXITCODE; + # env: ${{ parameters.EnvVars }} + # displayName: 'Test Samples' + # condition: and(succeeded(), eq(variables['TestSamples'], 'true')) - task: PublishTestResults@2 condition: always() diff --git a/scripts/devops_tasks/set_tox_environment.py b/scripts/devops_tasks/set_tox_environment.py index fa689640ee55..353ae4220308 100644 --- a/scripts/devops_tasks/set_tox_environment.py +++ b/scripts/devops_tasks/set_tox_environment.py @@ -20,7 +20,8 @@ "mindependency", "whl_no_aio", ] -PR_BUILD_SET = ["whl", "sdist", "mindependency"] +# this branch is checking only whl for now. rest will follow as they migrate +PR_BUILD_SET = ["whl"] #, "sdist", "mindependency" def resolve_devops_variable(var_value: str) -> List[str]: From 97b39f6f4eb91009b17cba0a9571ec07c2fa4cb0 Mon Sep 17 00:00:00 2001 From: Scott Beddall Date: Thu, 20 Nov 2025 00:48:34 +0000 Subject: [PATCH 2/5] fix the pipeline --- eng/pipelines/templates/steps/build-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/templates/steps/build-test.yml b/eng/pipelines/templates/steps/build-test.yml index f0f2f1815f5f..c7c8867b63f0 100644 --- a/eng/pipelines/templates/steps/build-test.yml +++ b/eng/pipelines/templates/steps/build-test.yml @@ -121,7 +121,7 @@ steps: ${{ parameters.CoverageArg }} ` --mark_arg="$markArg" ` --service="${{ parameters.ServiceDirectory }}" ` - --checks="${{ parameters.ToxTestEnv }}" + --checks="${{ parameters.ToxTestEnv }}" ` --injected-packages="${{ parameters.InjectedPackages }}" ` exit $LASTEXITCODE; env: ${{ parameters.EnvVars }} From 4d35f37c9322452c42a335b79a115a103b00dbb2 Mon Sep 17 00:00:00 2001 From: Scott Beddall Date: Thu, 20 Nov 2025 22:59:07 +0000 Subject: [PATCH 3/5] command was bleeding forward --- eng/pipelines/templates/steps/build-test.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/eng/pipelines/templates/steps/build-test.yml b/eng/pipelines/templates/steps/build-test.yml index c7c8867b63f0..c680c483e5d5 100644 --- a/eng/pipelines/templates/steps/build-test.yml +++ b/eng/pipelines/templates/steps/build-test.yml @@ -67,7 +67,6 @@ steps: - ${{ parameters.BeforeTestSteps }} - ${{ if eq('true', parameters.UseFederatedAuth) }}: - - task: AzurePowerShell@5 displayName: Run Tests (AzurePowerShell@5) env: @@ -122,7 +121,7 @@ steps: --mark_arg="$markArg" ` --service="${{ parameters.ServiceDirectory }}" ` --checks="${{ parameters.ToxTestEnv }}" ` - --injected-packages="${{ parameters.InjectedPackages }}" ` + --injected-packages="${{ parameters.InjectedPackages }}" exit $LASTEXITCODE; env: ${{ parameters.EnvVars }} displayName: Run Tests From a6c4a6f7eb54ad1e19a52f974128a1f43a51c8c6 Mon Sep 17 00:00:00 2001 From: Scott Beddall Date: Fri, 21 Nov 2025 00:32:28 +0000 Subject: [PATCH 4/5] nicely format the printed results so that we can easily examine the output for a specific package --- eng/scripts/dispatch_checks.py | 6 ++++++ scripts/devops_tasks/set_tox_environment.py | 10 +++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/eng/scripts/dispatch_checks.py b/eng/scripts/dispatch_checks.py index 498e7194cc9c..756f4655a2b9 100644 --- a/eng/scripts/dispatch_checks.py +++ b/eng/scripts/dispatch_checks.py @@ -77,6 +77,9 @@ async def run_check( # Print captured output after completion to avoid interleaving header = f"===== OUTPUT: {check} :: {package} (exit {exit_code}) =====" trailer = "=" * len(header) + if in_ci(): + print(f"##[group]{package} :: {check}") + if stdout: print(header) print(stdout.rstrip()) @@ -86,6 +89,9 @@ async def run_check( print(stderr.rstrip()) print(trailer) + if in_ci(): + print("##[endgroup]") + # if we have any output collections to complete, do so now here # finally, we need to clean up any temp dirs created by --isolate diff --git a/scripts/devops_tasks/set_tox_environment.py b/scripts/devops_tasks/set_tox_environment.py index 353ae4220308..1e8f8f0870cc 100644 --- a/scripts/devops_tasks/set_tox_environment.py +++ b/scripts/devops_tasks/set_tox_environment.py @@ -14,11 +14,11 @@ FULL_BUILD_SET = [ "whl", - "sdist", - "depends", - "latestdependency", - "mindependency", - "whl_no_aio", + # "sdist", + # "depends", + # "latestdependency", + # "mindependency", + # "whl_no_aio", ] # this branch is checking only whl for now. rest will follow as they migrate PR_BUILD_SET = ["whl"] #, "sdist", "mindependency" From 670aa5c8e1274832bd44044b8e0905fdfeeb29b5 Mon Sep 17 00:00:00 2001 From: jennypng <63012604+JennyPng@users.noreply.github.com> Date: Mon, 24 Nov 2025 16:53:25 -0800 Subject: [PATCH 5/5] add pytest exit code --- eng/tools/azure-sdk-tools/azpysdk/whl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/tools/azure-sdk-tools/azpysdk/whl.py b/eng/tools/azure-sdk-tools/azpysdk/whl.py index fbd7850f8e5c..15a8359ec251 100644 --- a/eng/tools/azure-sdk-tools/azpysdk/whl.py +++ b/eng/tools/azure-sdk-tools/azpysdk/whl.py @@ -101,8 +101,8 @@ def run(self, args: argparse.Namespace) -> int: ) # Align with tox: skip coverage when tests are skipped entirely continue - logger.error(f"pytest failed for {package_name} with exit code {pytest_result.returncode}.") + overall_result = max(overall_result, pytest_result.returncode or 1) continue coverage_command = [