-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Go: Support git_source
#20368
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Go: Support git_source
#20368
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for git_source type registry configurations in the Go extractor's proxy handling functionality. The change extends the existing registry proxy system to handle Git sources alongside the existing goproxy server support.
- Adds
git_sourcetype support to registry configurations - Updates proxy environment variable handling to process Git sources
- Adds comprehensive test coverage for multiple registry configurations
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| go/extractor/util/registryproxy.go | Adds git_source constant, refactors data structures to separate goproxy servers and Git sources, and updates environment variable handling logic |
| go/extractor/util/registryproxy_test.go | Adds new test function to verify parsing of multiple registry configurations including both git_source and goproxy_server types |
82f29ab to
baad5dd
Compare
7be30e2 to
0ffc9fc
Compare
owen-mc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks sensible.
Since `GOPRIVATE` / `GONOPROXY` expect a glob pattern
0ffc9fc to
8c84992
Compare
This PR modifies the Go autobuilder/extractor to support
git_sourceprivate registry configurations, in addition to thegoproxy_serverconfigurations that were already supported.In github/codeql-action#3079, we modified the CodeQL Action so that
git_sourceconfigurations are now propagated to the Go autobuilder/extractor.With the changes in this PR, if a
git_sourceconfiguration is provided, we setGOPRIVATEto include a pattern for the hostname provided in the configuration. TheGOPRIVATEvariable instructsgowhich packages should not be fetched via aGOPROXY(whether it's the default one or a custom one). For example, if thegit_sourceconfiguration is forhttps://github.com/foo, then we'd setGOPRIVATE=github.com/foo*.This is a simplification of what is necessary for
GOPRIVATE, because Go modules may not have the same name as the address of the repository that contains them. Ideally, we would makeGOPRIVATEconfigurable somehow, possibly using ago.envfile in the repository or similar. However, for initially supporting this, the behaviour here should be sufficient.If a
git_sourceis configured, we also configuregiton the runner to use the self-signed proxy certificate. Otherwise, it will refuse to connect.