Is there a way to disable an Azure agent when it returns a failed result of a certain type?

Kyle Leighton 0 Reputation points
2024-11-12T18:27:36.4466667+00:00

In my case, I am running automated UI tests through ADO pipeline release jobs. Sometimes the PC loses USB debugging authorization to the android device. When that occurs the job will fail all tests sent to the agent on that PC. This requires us to catch it quickly to disable that agent to stop it from gobbling up a majority of the tests and failing them. Is there a way that I can, upon receiving the results of Fail for the 'Clean Android storage' (or next best just any failed job) to then cut switch to disable for that agent in the pool?

Log with error

2024-11-11T16:30:17.5683657Z ##[section]Starting: Clean Android storage
2024-11-11T16:30:17.5688625Z ==============================================================================
2024-11-11T16:30:17.5688684Z Task         : PowerShell
2024-11-11T16:30:17.5688713Z Description  : Run a PowerShell script on Linux, macOS, or Windows
2024-11-11T16:30:17.5688755Z Version      : 2.247.1
2024-11-11T16:30:17.5688788Z Author       : Microsoft Corporation
2024-11-11T16:30:17.5688820Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/powershell
2024-11-11T16:30:17.5688864Z ==============================================================================
2024-11-11T16:30:18.2537950Z Generating script.
2024-11-11T16:30:18.2744984Z ========================== Starting Command Output ===========================
2024-11-11T16:30:18.2882981Z ##[command]"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command ". 'C:\agent\_work\_temp\e5f5ec3c-9f1e-46c2-8f7d-d7a1726d0e6e.ps1'"
2024-11-11T16:30:18.4681710Z adb.exe: device unauthorized.
2024-11-11T16:30:18.4682378Z This adb server's $ADB_VENDOR_KEYS is not set
2024-11-11T16:30:18.4683828Z Try 'adb kill-server' if that seems wrong.
2024-11-11T16:30:18.4684064Z Otherwise check for a confirmation dialog on your device.
2024-11-11T16:30:18.6144780Z ##[error]PowerShell exited with code '1'.
2024-11-11T16:30:18.6366885Z ##[section]Finishing: Clean Android storage


Screenshots:
User's image

User's image

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
40,235 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.