Repository navigation
Job Monitor: Fail when no jobs submitted - #17216
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the Helix Job Monitor to treat “no Helix jobs submitted for the monitored stage (across all attempts)” as a failure condition, ensuring pipelines don’t silently pass when Helix work never ran.
Changes:
- Add a new terminal failure condition in
JobMonitorRunnerwhenAssociatedJobsCount == 0. - Add a dedicated error log line via
StatusReporter.LogNoHelixJobsFailure(). - Update multiple SDK test scenarios to expect exit code
1when no Helix jobs exist (including stage-scoped monitoring cases), and assert the failure message in one test.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/Microsoft.DotNet.Helix/Sdk.Tests/Microsoft.DotNet.Helix.Sdk.Tests/JobMonitorRunnerTests.cs | Updates existing scenarios to assert exit code 1 when no Helix jobs are submitted; adds a log assertion for the new failure message. |
| src/Microsoft.DotNet.Helix/JobMonitor/StatusReporter.cs | Adds LogNoHelixJobsFailure() to emit a dedicated error message for the new failure mode. |
| src/Microsoft.DotNet.Helix/JobMonitor/JobMonitorRunner.cs | Implements the new “fail if no Helix jobs were ever observed” exit-code behavior after pipeline/Helix completion gating. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
I have a feeling (but can't find a concrete example right now) that we might have cases where this is expected, should we add an escape hatch? |
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
mmitche
left a comment
There was a problem hiding this comment.
Are you sure this is checking any attempt? Can you add a test with two jobs. First iteration, one job submits successful helix jobs, and the other submits nothing and fails. On retry, the other job submits nothing. The job monitor should not exit one on the retry attempt.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
src/Microsoft.DotNet.Helix/JobMonitor/StatusReporter.cs:213
- The new "no Helix jobs" failure message is not very actionable on its own. Since the intended escape hatch is
allowNoHelixJobs/--allow-no-helix-jobs, include that hint in the error text so users can immediately remediate expected-empty stages without needing to search docs.
public void LogNoHelixJobsFailure()
{
LogError($"No Helix jobs were submitted by this stage in any attempt. Stage: '{_options.StageName}', BuildId: {_options.BuildId}.");
}
No description provided.