Skip to content

Use temp-scoped authenticated npmrc and pass it to release tagging job#7141

Closed
Copilot wants to merge 1 commit into
mainfrom
copilot/update-authenticated-npmrc-path
Closed

Use temp-scoped authenticated npmrc and pass it to release tagging job#7141
Copilot wants to merge 1 commit into
mainfrom
copilot/update-authenticated-npmrc-path

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 29, 2026

GenerateReleaseArtifacts currently writes authenticated npm config to the user profile. This update moves npm auth config to a temp-scoped path and carries it into the downstream release job so npm resolution remains feed-authenticated under network isolation.

  • GenerateReleaseArtifacts npm config location

    • Switched create-authenticated-npmrc.yml target from $(UserProfile)/.npmrc to $(Agent.TempDirectory)/gen-artifact/.npmrc.
  • Cross-job config handoff

    • Added a staging step in GenerateReleaseArtifacts to copy the authenticated file into the published packages artifact as packages/.npmrc.
    • Added guardrails: fail fast if source .npmrc is missing; ensure destination directory exists before copy.
  • Downstream job consumption

    • Updated TagRepository (create-tags-and-git-release.yml call) to consume:
      • NpmConfigUserConfig: $(Pipeline.Workspace)/packages/.npmrc
      • NpmConfigRegistry: https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-js/npm/registry/
- template: /eng/common/pipelines/templates/steps/create-authenticated-npmrc.yml
  parameters:
    npmrcPath: $(Agent.TempDirectory)/gen-artifact/.npmrc

- pwsh: |
    $npmrcPath = "$(Agent.TempDirectory)/gen-artifact/.npmrc"
    if (!(Test-Path -Path $npmrcPath)) { throw "Expected authenticated npm config was not found at $npmrcPath." }
    $packageStagingPath = "$(Build.ArtifactStagingDirectory)/packages"
    New-Item -ItemType Directory -Path $packageStagingPath -Force | Out-Null
    Copy-Item -Path $npmrcPath -Destination "$packageStagingPath/.npmrc" -Force

Pull Request Checklist

Please leverage this checklist as a reminder to address commonly occurring feedback when submitting a pull request to make sure your PR can be reviewed quickly:

See the detailed list in the contributing guide.

  • C++ Guidelines
  • Doxygen docs
  • Unit tests
  • No unwanted commits/changes
  • Descriptive title/description
    • PR is single purpose
    • Related issue listed
  • Comments in source
  • No typos
  • Update changelog
  • Not work-in-progress
  • External references or docs updated
  • Self review of PR done
  • Any breaking changes?
Original prompt

Update PR #7140 in repository Azure/azure-sdk-for-cpp to avoid writing the authenticated npm config to the user profile during the GenerateReleaseArtifacts flow.

Context:

  • The current change adds /eng/common/pipelines/templates/steps/create-authenticated-npmrc.yml in eng/pipelines/templates/jobs/archetype-sdk-client.yml.
  • It currently uses:
    • npmrcPath: $(UserProfile)/.npmrc
  • The requested behavior is:
    1. Change the npmrc path to $(Agent.TempDirectory)/gen-artifact/.npmrc
    2. Pass that config to the next job so the authenticated npm configuration is available there as well.

Requirements:

  • Modify the pipeline template(s) involved in this PR so the generated .npmrc is created under $(Agent.TempDirectory)/gen-artifact/.npmrc.
  • Ensure the subsequent job receives the config/path/artifact as needed for the existing pipeline design.
  • Keep the fix scoped to this PR’s purpose: configuring npm to use the Azure Artifacts feed in GenerateReleaseArtifacts under network isolation constraints.
  • Preserve existing pipeline behavior outside this flow.

Please implement the change directly in the branch for this PR and open/update a pull request with the changes.

The following is the prior conversation context from the user's chat exploration (may be truncated):

User: For this change you should use npmrcPath: $(Agent.TempDirectory)/gen-artifact/.npmrc and then pass the config to the next job can you make that change?

Assistant: I’m waiting for your confirmation on the proposed repository change, and once you approve it I can continue.

This pull request was created from Copilot chat.

Copilot AI changed the title [WIP] Update npm config path to temp directory for release artifacts Use temp-scoped authenticated npmrc and pass it to release tagging job May 29, 2026
Copilot AI requested a review from chidozieononiwu May 29, 2026 23:35
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.

2 participants