Skip to content

Conversation

mbg
Copy link
Member

@mbg mbg commented Sep 4, 2025

This PR modifies the Go autobuilder/extractor to support git_source private registry configurations, in addition to the goproxy_server configurations that were already supported.

In github/codeql-action#3079, we modified the CodeQL Action so that git_source configurations are now propagated to the Go autobuilder/extractor.

With the changes in this PR, if a git_source configuration is provided, we set GOPRIVATE to include a pattern for the hostname provided in the configuration. The GOPRIVATE variable instructs go which packages should not be fetched via a GOPROXY (whether it's the default one or a custom one). For example, if the git_source configuration is for https://github.com/foo, then we'd set GOPRIVATE=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 make GOPRIVATE configurable somehow, possibly using a go.env file in the repository or similar. However, for initially supporting this, the behaviour here should be sufficient.

If a git_source is configured, we also configure git on the runner to use the self-signed proxy certificate. Otherwise, it will refuse to connect.

@Copilot Copilot AI review requested due to automatic review settings September 4, 2025 14:53
@github-actions github-actions bot added the Go label Sep 4, 2025
Copy link
Contributor

@Copilot Copilot AI left a 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_source type 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

@mbg mbg force-pushed the mbg/go/support-git-source branch 4 times, most recently from 82f29ab to baad5dd Compare September 8, 2025 09:27
@mbg mbg force-pushed the mbg/go/support-git-source branch from baad5dd to 7be30e2 Compare September 15, 2025 14:58
@mbg mbg force-pushed the mbg/go/support-git-source branch from 7be30e2 to 0ffc9fc Compare September 15, 2025 15:09
@mbg mbg marked this pull request as ready for review September 15, 2025 15:09
@mbg mbg requested a review from a team as a code owner September 15, 2025 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant