Skip to content

Conversation

@kotlarmilos
Copy link
Member

@kotlarmilos kotlarmilos commented Oct 13, 2025

Description

Sets the environment variable used by xUnit to detect if a test is running in a CI environment. This enables the SkipOnCI attribute to work correctly on Apple mobile and Android.

Fixes dotnet/xharness#1473

@kotlarmilos kotlarmilos requested a review from Copilot October 13, 2025 18:28
@kotlarmilos kotlarmilos self-assigned this Oct 13, 2025
Copy link

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 adds the HELIX_WORKITEM_ROOT environment variable to both Android and Apple XHarness work item commands. This enables xUnit's SkipOnCI attribute to function correctly by providing the necessary environment variable that xUnit uses to detect CI execution environments.

Key Changes

  • Added HELIX_WORKITEM_ROOT environment variable to Apple work item commands via --set-env parameter
  • Added HELIX_WORKITEM_ROOT environment variable to Android work item commands via --set-env parameter

Reviewed Changes

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

File Description
CreateXHarnessAppleWorkItems.cs Adds HELIX_WORKITEM_ROOT environment variable to Apple XHarness command construction
CreateXHarnessAndroidWorkItems.cs Adds HELIX_WORKITEM_ROOT environment variable to Android XHarness command construction

premun
premun previously approved these changes Oct 13, 2025
@kotlarmilos
Copy link
Member Author

Is there a way to test this change in the runtime repository? I confirmed that the variable is relevant in dotnet/runtime#120671 and I would like to verify that this change is correct.

@premun
Copy link
Member

premun commented Oct 13, 2025

@kotlarmilos possibly you can check the payload scripts of the Helix job sent in this PR and you will see where the envs went to.
You can then take a Helix job from runtime and replay it with the script files enriched with the vars to see what effect that will have.

@kotlarmilos kotlarmilos changed the title Add HELIX_WORKITEM_ROOT env variable to Android and Apple work item commands Add HELIX_WORKITEM_ROOT env variable to Apple work item command Oct 14, 2025
@kotlarmilos
Copy link
Member Author

Android doesn’t support the --set-env option (yet), so this PR updates only the Apple mobile command.

@kotlarmilos kotlarmilos requested a review from premun October 14, 2025 07:20
premun
premun previously approved these changes Oct 14, 2025
@premun
Copy link
Member

premun commented Oct 14, 2025

@kotlarmilos alternatively, you could prepend all of the envs by default and then you wouldn't have to come back here once you find you also need the correlation payload path or any of the others

@kotlarmilos
Copy link
Member Author

Do you mean a list like this?

  "--set-env=HELIX_CORRELATION_ID=\"$HELIX_CORRELATION_ID\" " +
  "--set-env=HELIX_CORRELATION_PAYLOAD=\"$HELIX_CORRELATION_PAYLOAD\" " +
  "--set-env=HELIX_PYTHONPATH=\"$HELIX_PYTHONPATH\" " +
  "--set-env=HELIX_WORKITEM_FRIENDLYNAME=\"$HELIX_WORKITEM_FRIENDLYNAME\" " +
  "--set-env=HELIX_WORKITEM_ID=\"$HELIX_WORKITEM_ID\" " +
  "--set-env=HELIX_WORKITEM_PAYLOAD=\"$HELIX_WORKITEM_PAYLOAD\" " +
  "--set-env=HELIX_WORKITEM_ROOT=\"$HELIX_WORKITEM_ROOT\" " +
  "--set-env=HELIX_WORKITEM_UPLOAD_ROOT=\"$HELIX_WORKITEM_UPLOAD_ROOT\" " +
  "--set-env=HELIX_DUMP_FOLDER=\"$HELIX_DUMP_FOLDER\" " +
  "--set-env=HELIX_CURRENT_LOG=\"$HELIX_CURRENT_LOG\" " +

I prefer being selective and passing only the required env variables instead of all of them. It requires some additional effort, but it gives a better sense of control and visibility over what is being passed.

@premun
Copy link
Member

premun commented Oct 14, 2025

Do you mean a list like this?

I meant more dynamically reading the envs in the payload script and passing that down to the app. Not before creating the job.
But if we don't care for the value, I think Vitek's direction is better.

@kotlarmilos kotlarmilos changed the title Add HELIX_WORKITEM_ROOT env variable to Apple work item command Add HELIX_WORKITEM_ROOT env variable to Apple and Android work item commands Oct 14, 2025
@akoeplinger akoeplinger changed the title Add HELIX_WORKITEM_ROOT env variable to Apple and Android work item commands Add DOTNET_CI=true env variable to Apple and Android work item commands Oct 15, 2025
@akoeplinger akoeplinger merged commit 0af6825 into dotnet:main Oct 15, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consider propagating CI related env variables to the device

4 participants