Skip to content

Route enable-internal-sources by Agent.Os at runtime and use SetupNugetSources.sh on Unix#16953

Open
Copilot wants to merge 5 commits into
mainfrom
copilot/enable-internal-sources-yml-fix
Open

Route enable-internal-sources by Agent.Os at runtime and use SetupNugetSources.sh on Unix#16953
Copilot wants to merge 5 commits into
mainfrom
copilot/enable-internal-sources-yml-fix

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jun 2, 2026

enable-internal-sources.yml was invoking SetupNugetSources.ps1 on Unix via pwsh, which pulls in tools.ps1 and Windows-centric behavior. This change switches Unix execution to SetupNugetSources.sh and updates OS routing to use runtime task conditions.

  • Template routing by platform

    • eng/common/core-templates/steps/enable-internal-sources.yml now routes by Agent.Os at task runtime using condition:.
      • Windows: PowerShell@2 + SetupNugetSources.ps1
      • Unix: Bash@3 + SetupNugetSources.sh
    • Applied consistently for legacy credential and federated-token flows.
    • Avoids relying on Agent.Os during template expansion.
  • PowerShell invocation alignment

    • Template calls pass -Password to SetupNugetSources.ps1 (no script parameter alias changes required).
  • Scope after review feedback

    • Reverted prior changes to eng/common/SetupNugetSources.sh credential-update behavior.
    • Reverted prior SetupNugetSources.ps1 parameter alias change.
    • Reverted the added credential-update regression test tied to the reverted shell behavior.
- task: PowerShell@2
  condition: and(succeeded(), eq(variables['Agent.Os'], 'Windows_NT'))
  inputs:
    filePath: $(System.DefaultWorkingDirectory)/eng/common/SetupNugetSources.ps1
    arguments: -ConfigFile $(System.DefaultWorkingDirectory)/NuGet.config******
- task: Bash@3
  condition: and(succeeded(), ne(variables['Agent.Os'], 'Windows_NT'))
  inputs:
    filePath: $(System.DefaultWorkingDirectory)/eng/common/SetupNugetSources.sh
    arguments: $(System.DefaultWorkingDirectory)/NuGet.config $Token

To double check:

Copilot AI requested review from Copilot and removed request for Copilot June 2, 2026 17:00
Copilot AI changed the title [WIP] Fix enable-internal-sources.yml to run SetupNugetSources.ps1 only on Windows Route enable-internal-sources by Agent.Os and align SetupNugetSources.sh credential semantics Jun 2, 2026
Copilot AI requested a review from mmitche June 2, 2026 17:00
Comment thread eng/common/core-templates/steps/enable-internal-sources.yml Outdated
Comment thread src/Microsoft.DotNet.SetupNugetSources.Tests/CredentialHandlingTests.cs Outdated
Comment thread eng/common/SetupNugetSources.ps1 Outdated
Comment thread eng/common/SetupNugetSources.sh Outdated
Copilot AI requested review from Copilot and removed request for Copilot June 2, 2026 17:16
Copilot AI changed the title Route enable-internal-sources by Agent.Os and align SetupNugetSources.sh credential semantics Route enable-internal-sources by Agent.Os at runtime and align SetupNugetSources.sh credential semantics Jun 2, 2026
Copilot AI requested a review from mmitche June 2, 2026 17:17
Copilot AI requested review from Copilot and removed request for Copilot June 2, 2026 17:22
Copilot AI changed the title Route enable-internal-sources by Agent.Os at runtime and align SetupNugetSources.sh credential semantics Route enable-internal-sources by Agent.Os at runtime and use SetupNugetSources.sh on Unix Jun 2, 2026
@mmitche mmitche marked this pull request as ready for review June 2, 2026 17:46
Copilot AI review requested due to automatic review settings June 2, 2026 17:46
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 updates the enable-internal-sources.yml pipeline template to select the feed-setup implementation at task runtime based on Agent.Os, ensuring Unix agents run the Unix-native SetupNugetSources.sh instead of invoking the PowerShell script via pwsh.

Changes:

  • Route internal-feed setup tasks by Agent.Os using task condition: (Windows uses PowerShell@2, non-Windows uses Bash@3).
  • Switch Unix execution to eng/common/SetupNugetSources.sh for both legacy credential and federated-token flows.

Comment thread eng/common/core-templates/steps/enable-internal-sources.yml
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 2, 2026 21:43
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

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment on lines +29 to +31
targetType: inline
script: |
"$(System.DefaultWorkingDirectory)/eng/common/SetupNugetSources.sh" "$(System.DefaultWorkingDirectory)/NuGet.config" "$Token"
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.

enable-internal-sources.yml runs SetupNugetSources.ps1 (which dot-sources Windows-centric tools.ps1) on Unix

3 participants