Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 7, 2026

The dotnet-docker-cg-code pipeline fails with permission denied when creating /usr/share/.dotnet on the Linux pool image.

Changes

  • Update eng/docker-tools/templates/jobs/cg-build-projects.yml to use $(Build.SourcesDirectory)/.dotnet instead of /usr/share/.dotnet

Note

This file is in eng/docker-tools/ — changes should be backported to dotnet/docker-tools.

Original prompt

This section details on the original issue you should resolve

<issue_title>Pipeline Failure: dotnet-docker-cg-code - Permission denied when creating .NET install directory</issue_title>
<issue_description>### Description

The dotnet-docker-cg-code pipeline is failing during the "Run Dotnet Install Script" step with a permission denied error when attempting to create the .dotnet directory.

Error

/bin/mkdir: cannot create directory '/usr/share/.dotnet': Permission denied
Executing 'Invoke-WebRequest 'https://builds.dotnet.microsoft.com/dotnet/scripts/v1/dotnet-install.sh' -OutFile /usr/share/.dotnet/dotnet-install.sh'
Retry 1/2, retrying in 1 seconds...
Retry 2/2, no more retries left.
Exception: Failed to execute 'Invoke-WebRequest 'https://builds.dotnet.microsoft.com/dotnet/scripts/v1/dotnet-install.sh' -OutFile /usr/share/.dotnet/dotnet-install.sh'

Root Cause

The Install-DotNetSdk.ps1 script attempts to create the install directory at /usr/share/.dotnet, but the pipeline agent doesn't have write permissions to /usr/share/.

The failing code is at line 29:

if (!(Test-Path "$InstallPath")) {
    mkdir "$InstallPath" | Out-Null
}

Suggested Fix

Change the install path to a directory the agent has permission to write to (e.g., $HOME/.dotnet or a path under the agent's working directory).

Pipeline Information

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


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Fix pipeline failure due to permission denied on .dotnet directory Fix CG pipeline permission error: use writable install path Jan 7, 2026
Copilot AI requested a review from lbussell January 7, 2026 18:21
@lbussell
Copy link
Member

lbussell commented Jan 7, 2026

I verified this works in build#2873967

@lbussell lbussell marked this pull request as ready for review January 7, 2026 18:51
@lbussell lbussell requested a review from a team as a code owner January 7, 2026 18:51
@lbussell lbussell requested a review from mthalman January 7, 2026 18:51
@lbussell
Copy link
Member

lbussell commented Jan 8, 2026

/backport to nightly

@github-actions
Copy link
Contributor

github-actions bot commented Jan 8, 2026

Started backporting to nightly (link to workflow run)

@lbussell lbussell changed the title Fix CG pipeline permission error: use writable install path [main] Fix CG pipeline permission error: use writable install path Jan 8, 2026
@lbussell
Copy link
Member

lbussell commented Jan 8, 2026

This belongs in the docker-tools repo instead.

@lbussell lbussell closed this Jan 8, 2026
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.

Pipeline Failure: dotnet-docker-cg-code - Permission denied when creating .NET install directory

3 participants