Skip to content

Enable container test execution #48763

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 22, 2025
Merged

Conversation

v-wuzhai
Copy link
Member

No description provided.

@v-wuzhai v-wuzhai force-pushed the dev/Jason/enable-container-tests branch from 7446be0 to 0d90f8c Compare April 30, 2025 09:22
@v-wuzhai
Copy link
Member Author

v-wuzhai commented May 6, 2025

We're encountering test failures because dotnet workload restore attempts to write to paths that are not writable in containerized environments. This appears to be a common limitation in CI scenarios.

StdErr: Unhandled exception: Read-only file system : '/root/helix/work/correlation/d/metadata' , but found 1 (difference of 1).

@dotnet/domestic-cat @marcpopMSFT — is there a recommended workaround or best practice for handling this?

@Forgind
Copy link
Contributor

Forgind commented May 7, 2025

Can you clarify which part is going wrong? There's normally a metadata folder somewhere next to process path, so we're expecting to be able to access the spot right next to dotnet.exe or dotnet on linux. You can move the standard workload metadata folder that we write to if you set user local.

@v-wuzhai
Copy link
Member Author

v-wuzhai commented May 7, 2025

Can you clarify which part is going wrong? There's normally a metadata folder somewhere next to process path, so we're expecting to be able to access the spot right next to dotnet.exe or dotnet on linux. You can move the standard workload metadata folder that we write to if you set user local.

Thanks for the follow-up! Just to clarify, the issue is happening in the context of the two tests in this PR:

1. ProjectsThatDoNotSupportWorkloadsAreNotInspected
2. ProjectsThatDoNotSupportWorkloadsAndAreTransitivelyReferencedDoNotBreakTheBuild

These tests are failing in our containerized CI environment due to dotnet workload restore attempting to write to a read-only path:

Unhandled exception: Read-only file system : '/root/helix/work/correlation/d/metadata'
👉 Full pipeline failure log here

I tried setting the following environment variables in the test setup:

1. .WithEnvironmentVariable("DOTNET_CLI_HOME", cliHome)
2. .WithEnvironmentVariable("DOTNET_WORKLOAD_METADATA_DIR", metadataDir)
3. .WithEnvironmentVariable("DOTNET_SKIP_WORKLOAD_VERIFICATION", "true")

However, the error still occurs, which suggests that some part of the workload infrastructure is still trying to write to the default location. Is there another recommended way to fully redirect or disable workload-related writes in this scenario?

@Forgind
Copy link
Contributor

Forgind commented May 7, 2025

I believe that if you create a userlocal file, that is, a 0-byte file here (like C:\Program Files\dotnet\metadata\workloads\10.0.100\userlocal), it will only write to a directory under your DOTNET_CLI_HOME folder.

I'm not really sure what's being written. Are these from updating advertising manifests? If so, perhaps we could disable that?

@v-wuzhai
Copy link
Member Author

v-wuzhai commented May 7, 2025

I believe that if you create a userlocal file, that is, a 0-byte file here (like C:\Program Files\dotnet\metadata\workloads\10.0.100\userlocal), it will only write to a directory under your DOTNET_CLI_HOME folder.

I'm not really sure what's being written. Are these from updating advertising manifests? If so, perhaps we could disable that?

Thanks, that’s super helpful! I wasn’t aware of the userlocal file trick — I’ll try creating a 0-byte file at:

<dotnet-root>/metadata/workloads/<sdk-feature-band>/userlocal
and see if that redirects all writes to DOTNET_CLI_HOME as expected.

@v-wuzhai v-wuzhai force-pushed the dev/Jason/enable-container-tests branch from 463da35 to e7403bf Compare May 13, 2025 07:19
@v-wuzhai
Copy link
Member Author

v-wuzhai commented May 13, 2025

@Forgind Thanks for the suggestion! I looked into the userlocal file workaround, but in my case, DOTNET_ROOT is set to a read-only path (/root/helix/work/correlation/d), and I don’t have permission to create files under it. So unfortunately, I can’t create the metadata/.../userlocal file there.

Unless there's a better workaround, I might have to temporarily skip these two.

@Forgind
Copy link
Contributor

Forgind commented May 14, 2025

I looked into the code a bit, and the only thing that I can think of that should be being written is advertising manifests, but unfortunately there isn't really an option to disable that, so I don't know that there's a 'natural' answer.

You could probably add a way to opt out of updating advertising manifests from the workload restore command, but I think that would be too much effort for something like this, so I think disabling it is the right choice.

@v-wuzhai v-wuzhai marked this pull request as ready for review May 14, 2025 05:45
@v-wuzhai v-wuzhai merged commit b179531 into main May 22, 2025
30 checks passed
@v-wuzhai v-wuzhai deleted the dev/Jason/enable-container-tests branch May 22, 2025 05:43
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.

3 participants