Allow specifying a particular NPM registry for TfxInstaller task to use
It would be useful if TfxInstaller provided a registry option to select which NPM registry to install from. At the moment TfxInstaller is unusable in some configurations where (for example) npmjs.org is blocked.
(Auth should also automatically happen for this registry if it's an artifact feed in the same ADO project, just like in the Npm@x task.)
(See comments over here for more background: https://github.com/microsoft/tfs-cli/issues/476#issuecomment-2626119066.)
At the moment this is indeed unsupported. I suspect that if you add a nuget authentication step prior to the TfxInstaller, it should work, there is nothing in the code which forces the use of npmjs.org.
As an alternative, the tool installer runs a pretty rudimentary command to ensure the tfx-cli is there:
npm install [email protected] -g
But with a bit of flair to make it install in the toolcache of the runner (which is safer on self-hosted runners).
npm install [email protected] -g --prefix D:\a\_temp\tfx --no-fund
Then copies that output to:
C:\hostedtoolcache\windows\tfx\0.20.0\x64
That should be relatively easy to replicate. Or even just to zip up that folder on a hosted agent and extracting it on any elf-hosted agent would work.
I'm a bit hesitant to add even more dependencies on internal libraries of the azure-pipelines team, since they're not for official reuse and have had quite a few massive changes in the past years without notice.
But I'm open to a pull request. Looks like most of the required functionality could be lifted from the existing npm task and the following dependency:
https://github.com/microsoft/azure-pipelines-tasks-common-packages/tree/main/common-npm-packages/packaging-common/npm
The tasks that already doing this are here: https://github.com/microsoft/azure-pipelines-tasks/tree/master/Tasks/NpmV1 https://github.com/microsoft/azure-pipelines-tasks/blob/master/Tasks/NpmV1/npmcustom.ts https://github.com/microsoft/azure-pipelines-tasks/blob/master/Tasks/NpmV1/task.json
It would need to implement both auth, proxy and custom uri for the registry.
The TfxInstrller now has a builtin version of TFX to make your life easier.
@jessehouwing could you clarify what that means?
If you set the version to builtin it will use the version of TFX that's included in the extension. No extra download required.
But you are bound to the version we package. Any other version still must be downloaded.