Skip to content

Add Attempt and JobAttempt options to json2junit#449

Merged
michelle-clayton-work merged 2 commits intomainfrom
dev/mclayton/sep-attempts
Apr 1, 2026
Merged

Add Attempt and JobAttempt options to json2junit#449
michelle-clayton-work merged 2 commits intomainfrom
dev/mclayton/sep-attempts

Conversation

@michelle-clayton-work
Copy link
Copy Markdown
Contributor

@michelle-clayton-work michelle-clayton-work commented Mar 24, 2026

Add Attempt and JobAttempt fields to json2junit.Options that, when set, append labels to JUnit test suite names to distinguish different kinds of retries:

  • JobAttempt: CI job-level reruns (e.g. System.JobAttempt in Azure DevOps)
  • Attempt: in-job test retry loop attempts

Suite names are formatted as:

  • 'pkg [job attempt N]' (job rerun only)
  • 'pkg [retry N]' (in-job retry only)
  • 'pkg [job attempt N, retry M]' (both)

References:

@michelle-clayton-work
Copy link
Copy Markdown
Contributor Author

result:
image

Add a JobAttempt field to json2junit.Options that, when set, appends an
attempt label to JUnit test suite names (e.g. 'pkg [attempt 2]') to
distinguish CI job-level reruns (System.StageAttempt in Azure DevOps).

Ref: microsoft/go#2134
@dagood
Copy link
Copy Markdown
Member

dagood commented Mar 31, 2026

/azp run microsoft-go-infra

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@michelle-clayton-work michelle-clayton-work marked this pull request as ready for review March 31, 2026 19:56
@michelle-clayton-work michelle-clayton-work requested a review from a team as a code owner March 31, 2026 19:56
Copilot AI review requested due to automatic review settings March 31, 2026 19:56
Copy link
Copy Markdown
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 extends json2junit so JUnit test suite names can be labeled with an attempt identifier, enabling CI systems to distinguish reruns when aggregating results.

Changes:

  • Added JobAttempt to json2junit.Options.
  • Appended an attempt suffix to JUnit <testsuite name="..."> during conversion when JobAttempt is set.
  • Added a unit test to verify suite name labeling behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
json2junit/json2junit.go Adds Options.JobAttempt and uses it to suffix JUnit suite names.
json2junit/json2junit_test.go Adds a test that asserts the suite name includes the attempt label when configured.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread json2junit/json2junit.go
Comment thread json2junit/json2junit.go
Comment thread json2junit/json2junit_test.go Outdated
Comment thread json2junit/json2junit.go
@michelle-clayton-work michelle-clayton-work merged commit 3fd8e08 into main Apr 1, 2026
23 checks passed
@michelle-clayton-work michelle-clayton-work deleted the dev/mclayton/sep-attempts branch April 1, 2026 17:13
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.

4 participants