Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 11, 2025

UITest snapshot artifact publishes were failing with “artifact … already exists” when multiple stages reused the same job names, blocking CI.

  • Artifact naming: Include $(System.StageName) alongside $(System.JobName)/$(System.JobAttempt) for all platform snapshot publishes (Android, iOS, iOS CV2/CARV2, Windows, Mac) to guarantee uniqueness across stages.
  • Cleanup: Removed an accidentally added HybridWebView.js.map artifact from source.

Example artifact name after change:

artifactName: 'uitest-snapshot-results-android-$(System.StageName)-$(System.JobName)-$(System.JobAttempt)'
Original prompt

This section details on the original issue you should resolve

<issue_title>CI artifact error: uitest-snapshot-results-android-Job19-1 already exists for build</issue_title>
<issue_description>### Description

A recurring CI problem is observed where the following error occurs frequently during builds:

ApplicationInsightsTelemetrySender correlated 2 events with X-TFS-Session 75fbd866-b837-439c-aa40-9124468648de
##[error]Artifact uitest-snapshot-results-android-Job19-1 already exists for build 155110.

This seems related to test/artifact uploads and may cause upstream instability or block other CI jobs. The error is reproduced in public builds and impacts developer productivity.

Example build link encountering this error:
https://dev.azure.com/xamarin/public/public%20Team/_build/results?buildId=155110&view=logs&j=1da51a49-4ede-5a09-243d-c03b38642bb4&t=0246a852-7b1b-5ffa-dc3e-7499856e1f02&l=32

This issue needs investigation and may require CI pipeline or artifact logic changes.

Steps to Reproduce

  1. Trigger a build in the CI pipeline for maui repo
  2. Observe that some jobs intermittently fail with the error about already existing artifact for a given build ID.
  3. Look at the provided build link for log details and error location.

Expected:

  • CI should either overwrite or handle duplicate artifact names gracefully so builds do not fail due to this specific error.

Actual:

  • The error blocks further progress in the build and needs manual attention or rerun.

Link to public reproduction project repository

https://dev.azure.com/xamarin/public/public%20Team/_build/results?buildId=155110&view=logs&j=1da51a49-4ede-5a09-243d-c03b38642bb4&t=0246a852-7b1b-5ffa-dc3e-7499856e1f02&l=32

Version with bug

Unknown/Other

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

Unknown/Other

Affected platforms

I was not able test on other platforms

Affected platform versions

Android (CI jobs, all recent builds)

Did you find any workaround?

A temporary workaround is to manually rerun the job when the artifact collision happens. No permanent workaround is currently known.

Relevant log output

ApplicationInsightsTelemetrySender correlated 2 events with X-TFS-Session 75fbd866-b837-439c-aa40-9124468648de
##[error]Artifact uitest-snapshot-results-android-Job19-1 already exists for build 155110.
```</issue_description>

<agent_instructions>The original change to make this possible was done here: https://github.com/dotnet/maui/pull/31724 now it seems like sometimes we create duplicate artifacts, can you see why? Are we using a value that is not always unique? </agent_instructions>

## Comments on the Issue (you are @copilot in this section)

<comments>
</comments>

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Fix CI artifact error for uitest-snapshot-results Avoid UITest snapshot artifact name collisions across stages Dec 11, 2025
Copilot AI requested a review from jfversluis December 11, 2025 16:24
@jfversluis jfversluis marked this pull request as ready for review December 12, 2025 12:08
Copilot AI review requested due to automatic review settings December 12, 2025 12:08
@jfversluis jfversluis merged commit 6b5bab3 into main Dec 12, 2025
158 of 163 checks passed
@jfversluis jfversluis deleted the copilot/fix-ci-artifact-error branch December 12, 2025 12:08
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a recurring CI issue where UITest snapshot artifact publishes failed with "artifact already exists" errors. The root cause was that when multiple stages used the same job names (e.g., both android_ui_tests and android_ui_tests_coreclr stages use job name android_ui_tests_${{ project.name }}_${{ api }}), the artifact names collided because they only included $(System.JobName) and $(System.JobAttempt), which were identical across stages.

Key changes:

  • Added $(System.StageName) to artifact names across all 7 UITest snapshot artifact publishes to ensure uniqueness across stages
  • Updated artifact naming pattern consistently for Android, iOS, iOS CV2, iOS CARV2, Windows, and Mac platforms

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CI artifact error: uitest-snapshot-results-android-Job19-1 already exists for build

2 participants