Repository navigation
GitLab CI guide: let the runner write the NuGet configuration, from the ID token or a base64 CI/CD variable - #633
Merged
Conversation
The runner of "Every project on a runner" exchanges the ID token only for a project whose own nuget.config names Forge, so every project still carries one. A new section shows a runner whose pre_build_script writes the user's NuGet configuration, ~/.nuget/NuGet/NuGet.Config, itself: - a job with an ID token gets Forge's group feed under the key forge, and the exchanged key in NuGetPackageSourceCredentials_forge, out of the file; a failed exchange fails the job rather than falling back; - any other job gets the NuGet.Config an instance CI/CD variable, CI_NUGET_CONFIG, holds base64-encoded; a value that is no base64 fails the job, and without the variable the job keeps the image's configuration. The section says that a project's own nuget.config still comes first (one with <clear /> drops the runner's sources), that an instance variable with credentials reaches every job of every project on every runner, and that the runner needs an executor with a container per job, since a shell executor shares $HOME between its jobs. Fixes #632 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012e6DJbjyXxvtjaxyAg1Crw
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.
Fixes #632
What changes
GitLab CI with workload identity gets a new section under Every project on a runner: a runner whose
pre_build_scriptwrites the user's NuGet configuration,~/.nuget/NuGet/NuGet.Config, itself. Projects then need nonuget.config:forge. The exchanged key goes inNuGetPackageSourceCredentials_forge, not in the file. A failed exchange fails the job and does not fall back.NuGet.Configstored base64-encoded in an instance CI/CD variable,CI_NUGET_CONFIG. A value that isn't valid base64 fails the job. Without the variable, the job keeps the image's configuration.The section also covers:
nuget.configstill takes precedence; one with<clear />drops the runner's sources.$HOMEbetween jobs.The existing runner, which needs a
nuget.confignaming Forge in each project, stays as it is.Changelog fragment:
docs/changes/2.1.1/632.docs.md.How it was tested
I extracted the
pre_build_scriptfrom the doc's TOML block withtomllib, so the test ran the exact published text. I sourced it inmcr.microsoft.com/dotnet/sdk:10.0under bothbash -eo pipefailandsh -e. The Forge stand-in was an HTTPS mock: its token endpoint answers compact JSON like Forge, and its NuGet feeds require Basic auth.dotnet restorefetched a real package.forge; restore succeeds and sendsoidc:<key>nuget.configfrom step 5CI_NUGET_CONFIGsetCI_NUGET_CONFIGcurl401, job failsCI_NUGET_CONFIGnot base64base64: invalid input, job failsNuGet.Config(nuget.org) is left as isnuget.configwith<clear />and another sourcecargo xtask docs --checkandcargo xtask changelog --checkpass.Web UI
None needed: this is a documentation change; the admin API is unchanged.
Generated by Claude Code