Skip to content

Commit ec79089

Browse files
kubafloCopilot
andauthored
[net11.0] Use Helix job monitor for unit tests (#37852)
<!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ## Root cause `maui-pr` builds [1568023](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1568023) and [1568717](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1568717) failed their Windows Helix lanes even though the affected xUnit commands completed with exit code 0. The latest run dead-lettered nine work items after the legacy per-work-item Azure Pipelines reporter hit `TF10216` service-unavailable responses and 100-second read timeouts. ## Fix - Opt the unit-test submission jobs into `EnableHelixJobMonitor`, which disables the legacy per-work-item reporter and hands completion/result publication to one monitor job. - Bootstrap the pinned SDK and install the matching `Microsoft.DotNet.Helix.JobMonitor` version only inside the dedicated Linux monitor job. This keeps the net11-targeted tool out of the repository-wide tool manifest, whose restore runs before the pinned SDK is available. - Invoke the Arcade bootstrap script through `bash` because MAUI's generated copy is not executable. - Give the monitor a 360-minute timeout so it outlives the 240-minute submission jobs. The monitor runs alongside the submitters in the same stage and gates on both the stage timeline and every discovered Helix job. Real test failures still fail the centralized monitor; only the unreliable legacy reporting path is removed. No open `net11.0` PR currently addresses the Helix reporter failure. This uses the job-monitor path already shipped by the branch-pinned Arcade SDK instead of suppressing test failures or dropping Azure DevOps test results. ## Validation - Restored the unchanged root tool manifest from an empty NuGet cache. - Installed and invoked `dotnet-helix-job-monitor` version `11.0.0-beta.26379.102` from an isolated empty cache. - Verified the normal path remains `monitor=false`, `reporter=true`, `wait=true`. - Verified the monitored stage path evaluates to `monitor=true`, `reporter=false`, `wait=false`. - Parsed the updated Azure Pipelines YAML and checked the patch for whitespace errors. The first PR run, [1568855](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1568855), exposed two integration issues in the initial implementation: adding the net11 tool to the root manifest broke pre-bootstrap restores, and the generated monitor template directly executed a non-executable script. Commit `d1ca1493b8` corrects both by isolating installation and invoking the script through `bash`. --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent bedd1b1 commit ec79089

1 file changed

Lines changed: 62 additions & 3 deletions

File tree

eng/pipelines/arcade/stage-helix-tests.yml

Lines changed: 62 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ parameters:
4747
default:
4848
- Debug
4949
- Release
50+
- name: helixJobMonitorTimeoutInMinutes
51+
type: number
52+
default: 360
5053
- name: helixPool
5154
type: object
5255

@@ -91,9 +94,65 @@ stages:
9194
DOTNET_TOKEN: $(dotnetbuilds-internal-container-read-token)
9295
PRIVATE_BUILD: $(PrivateBuild)
9396

94-
- script: $(_msbuildCommand) "${{ parameters.helixProject }}" -warnAsError 0 -restore /p:Configuration=${{ BuildConfiguration }} /p:HelixInternal="${{ parameters.helixInternal }}" /p:TestRunNameSuffix="_${{ BuildConfiguration }}" /p:SkipInitInternalTooling=true /bl:$(Build.Arcade.LogsPath)${{ BuildConfiguration }}/helix_tests.binlog ${{ parameters.extraHelixArguments }}
97+
- script: $(_msbuildCommand) "${{ parameters.helixProject }}" -warnAsError 0 -restore /p:Configuration=${{ BuildConfiguration }} /p:EnableHelixJobMonitor=true /p:HelixInternal="${{ parameters.helixInternal }}" /p:TestRunNameSuffix="_${{ BuildConfiguration }}" /p:SkipInitInternalTooling=true /bl:$(Build.Arcade.LogsPath)${{ BuildConfiguration }}/helix_tests.binlog ${{ parameters.extraHelixArguments }}
9598
displayName: Run Helix Tests
9699
env:
97-
SYSTEM_ACCESSTOKEN: $(System.AccessToken) # We need to set this env var to publish helix results to Azure Dev Ops
100+
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
98101
HelixAccessToken: ${{ parameters.HelixAccessToken }}
99-
102+
103+
- job: HelixJobMonitor
104+
displayName: Monitor Helix Jobs
105+
timeoutInMinutes: ${{ parameters.helixJobMonitorTimeoutInMinutes }}
106+
pool:
107+
${{ if eq(variables['System.TeamProject'], 'public') }}:
108+
name: $(DncEngPublicBuildPool)
109+
demands: ImageOverride -equals build.azurelinux.3.amd64.open
110+
${{ else }}:
111+
name: $(DncEngInternalBuildPool)
112+
demands: ImageOverride -equals build.azurelinux.3.amd64
113+
steps:
114+
- checkout: self
115+
fetchDepth: 1
116+
117+
- bash: |
118+
set -euo pipefail
119+
120+
toolPath="$AGENT_TEMPDIRECTORY/helix-job-monitor"
121+
bash ./eng/common/dotnet.sh
122+
toolVersion=$(bash ./eng/common/dotnet.sh msbuild eng/Versions.props -getProperty:MicrosoftDotNetHelixSdkPackageVersion -nologo | tail -n 1)
123+
if [[ -z "$toolVersion" || "$toolVersion" =~ [[:space:]] ]]; then
124+
echo "Could not read the Helix SDK package version from eng/Versions.props." >&2
125+
exit 1
126+
fi
127+
128+
bash ./eng/common/dotnet.sh tool install \
129+
--tool-path "$toolPath" \
130+
Microsoft.DotNet.Helix.JobMonitor \
131+
--version "$toolVersion"
132+
133+
toolDll=$(find "$toolPath/.store" -path '*/tools/*/any/Microsoft.DotNet.Helix.JobMonitor.dll' -type f -print -quit)
134+
if [ ! -f "$toolDll" ]; then
135+
echo "Could not find the Helix Job Monitor DLL in '$toolPath/.store'." >&2
136+
exit 1
137+
fi
138+
139+
echo "##vso[task.setvariable variable=HelixJobMonitorDll]$toolDll"
140+
displayName: Install Helix Job Monitor
141+
142+
- bash: |
143+
set -euo pipefail
144+
145+
bash ./eng/common/dotnet.sh exec "$(HelixJobMonitorDll)" \
146+
--helix-base-uri 'https://helix.dot.net/' \
147+
--polling-interval-seconds 30 \
148+
--fail-on-failed-tests true \
149+
--max-wait-minutes "$((${{ parameters.helixJobMonitorTimeoutInMinutes }} - 5))" \
150+
--stage-name '$(System.StageName)' \
151+
--organization dotnet \
152+
--repository maui \
153+
--build-reason '$(Build.Reason)' \
154+
--source-branch '$(Build.SourceBranch)'
155+
displayName: Monitor Helix Jobs
156+
env:
157+
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
158+
HELIX_ACCESSTOKEN: ${{ parameters.HelixAccessToken }}

0 commit comments

Comments
 (0)