Documentation
¶
Index ¶
- Constants
- Variables
- func GetAuthFromSecret(url string, creds *corev1.Secret, knownHosts string) (transport.AuthMethod, error)
- func GetHTTPClientFromSecret(creds *corev1.Secret, bundleCA []byte, insecureTLSVerify bool, ...) (*http.Client, error)
- func ProxyOptsFromEnvironment(repoURL string) transport.ProxyOptions
- type Fetch
- type GoGitRemoteLister
- type KnownHostsGetter
- type Remote
- type RemoteLister
- type RemoteRef
Constants ¶
const ProxyCABundleEnvVar = "PROXY_CA_BUNDLE"
ProxyCABundleEnvVar is the name of the environment variable that holds the PEM-encoded CA certificate used to trust HTTPS proxies with custom or self-signed certificates. The value is appended to the system cert pool so that well-known public CA certificates remain trusted.
Variables ¶
var GitHubAppGetter fleetgithub.AppAuthGetter = fleetgithub.DefaultAppAuthGetter{}
Functions ¶
func GetAuthFromSecret ¶
func GetAuthFromSecret(url string, creds *corev1.Secret, knownHosts string) (transport.AuthMethod, error)
GetAuthFromSecret returns the AuthMethod calculated from the given secret, setting known hosts if needed. Known hosts are sourced from the creds, if provided there. Otherwise, they will be sourced from the provided knownHosts if non-empty. The credentials secret is expected to be either basic-auth or ssh-auth (with extra known_hosts data option)
func GetHTTPClientFromSecret ¶
func GetHTTPClientFromSecret(creds *corev1.Secret, bundleCA []byte, insecureTLSVerify bool, timeout time.Duration) (*http.Client, error)
GetHTTPClientFromSecret returns a HTTP client filled from the information in the given secret and optional CABundle and insecureTLSVerify
func ProxyOptsFromEnvironment ¶
func ProxyOptsFromEnvironment(repoURL string) transport.ProxyOptions
ProxyOptsFromEnvironment reads the standard HTTP_PROXY / HTTPS_PROXY / NO_PROXY environment variables and returns a transport.ProxyOptions value ready to be embedded in go-git CloneOptions or ListOptions.
Why this is necessary: go-git's HTTP transport uses http.DefaultTransport, which already honors HTTP_PROXY / HTTPS_PROXY natively. However, go-git's SSH transport only routes through a proxy when ProxyOptions.URL is non-empty — it never reads the proxy env vars itself. Without wiring ProxyOptions the registered httpConnectDialer would never be invoked for SSH repos.
Proxy selection and NO_PROXY matching are delegated to golang.org/x/net/http/httpproxy, which follows the same rules as net/http. SSH and scp-style repos are looked up as https:// because SSH traffic is tunnelled through a CONNECT proxy the same way HTTPS is. Both HTTP_PROXY and HTTPS_PROXY work; HTTPS_PROXY is checked first for SSH URLs.
Types ¶
type Fetch ¶
type Fetch struct {
KnownHosts KnownHostsGetter
}
type GoGitRemoteLister ¶
type GoGitRemoteLister struct {
URL string
Auth transport.AuthMethod
CABundle []byte
InsecureSkipTLS bool
ProxyOptions transport.ProxyOptions
}
GoGitRemoteLister implements the RemoteLister interface using the go-git library
type KnownHostsGetter ¶ added in v0.10.11
type Remote ¶
type Remote struct {
Lister RemoteLister
URL string
Options *options
}
func (*Remote) LatestBranchCommit ¶
LatestBranchCommit returns the latest commit for the given branch