use $.job.credentials-metadata
if $.credentials
isn't given
#11704
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.
This PR is for a very specific scenario, namely:
NuGet.Config
file exists in the repoThe NuGet updater relies heavily on native NuGet tooling and the native NuGet tooling looks in parent directories for a
NuGet.Config
file and also in the user-level location of~/.nuget/NuGet/NuGet.Config
.In this case a custom package feed needs to be added to the user-level
NuGet.Config
file so that all of the tooling knows it's available. The proxy service is then responsible for all authentication.Details
Update jobs are split into two phases,
fetch_files
andupdate_files
. Each job phase is given different information regarding feed credentials as specified in the job file.The
fetch_files
step passed along the root propertycredentials
which may contain secrets (but probably not given the last few months of updates and the push towards using the CLI) and theupdate_files
step passed alongjob.credentials-metadata
which is identical to the other property, but with all secrets removed.The NuGet updater needs feed information for the
fetch_files
step, but running with a job file like this:resulted in
fetch_files
getting an empty array because no secrets are passed to this step of the updater; the proxy is expected to handle it.The fix is to allow the file fetcher command to fall back to the secret-less
credentials-metadata
so that the feed URLs can be passed on. The end result is that the native NuGet tooling will see package feeds listed in the user-levelNuGet.Config
and honor those for all update operations.The generation of the user-level
NuGet.Config
was also updated to always include a reference toapi.nuget.org
. This was done because in the scenario covered here, the lack of aNuGet.Config
file in a repo, or the lack of a<clear />
directive indicates that the owners of that repo are expecting higher-level implicit feeds to be used and the only common higher-level implicit feed isapi.nuget.org
. This won't break other scenarios where repo owners explicitly don't wantapi.nuget.org
because they will have already specified the<clear />
directive which will exclude everything in the user-level file anyway.Fixes #11690