azdo-pipelines: Publish NPM release to internal feed in addition to npmjs.org#2335
Draft
bwateratmsft wants to merge 10 commits into
Draft
azdo-pipelines: Publish NPM release to internal feed in addition to npmjs.org#2335bwateratmsft wants to merge 10 commits into
bwateratmsft wants to merge 10 commits into
Conversation
Add an optional npmFeed parameter to the 1es-mb-release-npm template. When set, the same tarball is published to the internal Azure Artifacts feed after the ESRP publish to npmjs.org succeeds, guarded by the same dryRun check. A same-org feed authenticates via the build identity through npmAuthenticate@0; an optional npmReleaseServiceConnection parameter covers external/cross-org feeds. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Factor the .npmrc creation + npmAuthenticate@0 logic out of setup.yml and the NPM release template into a reusable templates/write-npmrc-auth.yml that derives the registry from either feedBaseUrl or npmFeed (+ System.CollectionUri). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Per code review, pass feedBaseUrl through to the NPM release template instead of npmFeed, and simplify write-npmrc-auth.yml to derive the registry solely from feedBaseUrl (dropping the System.CollectionUri-based npmFeed derivation). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Check the working directory first, then the repo root (Build.SourcesDirectory), for a checked-in .npmrc, mirroring the .nvmrc lookup in setup.yml. The resolved path is threaded to npmAuthenticate@0 via a runtime npmrcFile variable so the token is injected into whichever file was found. In the release job (checkout: none) the repo-root path simply doesn't exist, so behavior there is unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TODO
Summary
Updates the NPM release template (
azdo-pipelines/1es-mb-release-npm.yml) to optionally publish the released package to an internal Azure Artifacts feed, in addition to the existing ESRP/MicroBuild publish to npmjs.org.Changes
feedBaseUrlparameter (the Azure Artifacts feed base URL, e.g.https://devdiv.pkgs.visualstudio.com/DevDiv/_packaging/azcode). When set, the same tarball is also published to that feed.waitForReleaseCompletion: true, and the new steps run sequentially after it)..npmrccreation +npmAuthenticate@0logic shared withsetup.ymlinto a reusableazdo-pipelines/templates/write-npmrc-auth.yml. It respects a checked-in.npmrcwhen present, otherwise writes one withregistry=<feedBaseUrl>/npm/registry/.dryRuncompile-time guard applies to the internal-feed publish.Npm@1task (command: custom,publish "$(tgzFileName)" --ignore-scripts), so the task handles exit-code failures and no lifecycle/build scripts run in the release pool.feedBaseUrland the Feed Publisher (Contributor) permission requirement (publish permission is not automatic even for same-org feeds) inREADME.md.Notes
Draft PR for review before merge. Note: a service connection is intentionally not included — cross-org/external feeds are out of scope, and same-org feeds authenticate via the build identity.