feat(go-ci): fetch private modules when given a token - #5
Merged
Conversation
kgkit is private, so every xraph repo depending on it fails at go mod download with "repository not found". That reads like a bad import path. It is not: go asked proxy.golang.org, got a 404 back, and never tried git, because nothing had marked the path private in the first place. The workflow takes an optional XRAPH_REPO_TOKEN. When it is set, every job that downloads dependencies rewrites the org's HTTPS clone URL to carry the token and exports GOPRIVATE so those paths bypass the proxy. Without the secret the step does nothing at all, so existing callers are unaffected. Two things are scoped deliberately narrow. The rewrite covers https://github.com/xraph/ and not all of github.com, so it cannot clobber a credential a consumer already configured for somewhere else. GOPRIVATE comes from a new input instead of being hardcoded, because it also sets GONOPROXY: a glob wider than the modules that are genuinely private drags public ones off the proxy and clones each of them per job, per run. foundry is the case in point, with twenty-two xraph modules and exactly one of them private. The default stays github.com/xraph/*, which is the right answer for a caller that has not thought about it. nested-modules is left alone. It reads go.mod files and never downloads.
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.
kgkit is private. Every xraph repo that depends on it fails at
go mod downloadwith "repository not found", which reads like a bad import path and is not one.
Go asked proxy.golang.org, got a 404 back, and never tried git, because nothing
had marked that path private.
go-ci.ymlnow takes an optionalXRAPH_REPO_TOKEN. Set it and every job thatdownloads dependencies rewrites the org's HTTPS clone URL to carry the token,
then exports
GOPRIVATEso those paths skip the proxy. Leave it out and thestep does nothing, so every current caller is untouched.
Two choices worth flagging, since both could reasonably have gone the other way.
The URL rewrite covers
https://github.com/xraph/rather than all ofgithub.com. twinos does the broad version inline, and it works, but this file
runs in every Go repo we have. Scoped to the org it cannot clobber a credential
a consumer already set up for somewhere else.
GOPRIVATEis an input instead of a hardcodedgithub.com/xraph/*, because italso sets
GONOPROXY. A glob wider than what is genuinely private drags publicmodules off the proxy and clones each one from scratch in every job. foundry is
the case in point: twenty-two xraph modules, exactly one of them private. The
default stays
github.com/xraph/*, which is right for a caller that has notthought about it, so nothing changes for anyone who does not pass the input.
nested-modulesis untouched. It reads go.mod files and never downloads.Verified with
actionlintlocally. The self-test smoke jobs call this workflowwithout the secret, which exercises the no-op path.