Commit 621e630
fix: NuGet auth config layering to fix 401 on private feed in Docker (#1062)
## Problem
PR #1060 merged with the `--configfile` approach for Docker NuGet auth.
This approach:
- Discards the repo's `nuget.config` entirely (including
`packageSourceMapping`)
- Caused 401 Unauthorized on the Azure DevOps private feed
The fixup commit from the original PR branch was never applied to main.
## Fix
Switch to **NuGet config layering** (NuGet 5.7+):
- CI generates a **credentials-only** config (no `<packageSources>`)
- Dockerfile copies it to `~/.nuget/config/credentials.config`
- NuGet merges it with the repo's `nuget.config` automatically
- `nuget.config` remains the single source of truth for feeds +
`packageSourceMapping`
### Changes
- **`Dockerfile`**: `cp /run/secrets/nugetconfig
~/.nuget/config/credentials.config` instead of `--configfile`; add
`required=false` on secret mount
- **`Build-Test-And-Deploy.yml`**: credentials-only generated config (no
`<packageSources>` section)
## Testing
- PR build: uses `ACCESS_TO_NUGET_FEED=false` (no auth needed, verifies
image builds)
- Main build: full auth path with layered config
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 26ebbed commit 621e630
2 files changed
Lines changed: 6 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | 74 | | |
80 | 75 | | |
81 | 76 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | | - | |
24 | | - | |
25 | | - | |
| 23 | + | |
| 24 | + | |
26 | 25 | | |
| 26 | + | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
0 commit comments