Documentation
¶
Overview ¶
Package git answers "what credentials apply to this repository?" for everything in Hecate that talks to one.
It exists because two things do: a step cloning and pushing a promotion, and a Beacon watching a repository for new commits. They are given the same `credentialsRef` pointing at the same Secret, so a second implementation would eventually disagree with the first about what that Secret means — which shows up as a Beacon that cannot see a repository its own promotion step writes to every day.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Auth ¶
func Auth( ctx context.Context, c client.Client, namespace string, ref *v1alpha1.LocalSecretRef, ) (transport.AuthMethod, error)
Auth builds a transport auth method from a Secret, or nil for public repositories and ambient credentials.
func AuthFromSecret ¶
func AuthFromSecret(secret *corev1.Secret) (transport.AuthMethod, error)
AuthFromSecret is Auth once the Secret is in hand, for the static credentials — an SSH key, or a username and password.
A GitHub App credential is handled by Auth rather than here, because minting an installation token is a network call and this function has no context to make one with.
func KnownHostsCallback ¶
func KnownHostsCallback(hosts []byte) (ssh.HostKeyCallback, error)
KnownHostsCallback builds a host-key checker from a known_hosts file.
Written to a temp file because golang.org/x/crypto/ssh's parser takes a path. Verification is not optional: skipping it would accept any host key and make the SSH transport trivially interceptable.
func TokenAuth ¶ added in v0.2.0
func TokenAuth(token string) transport.AuthMethod
TokenAuth is basic auth for a token that was minted elsewhere — a GitHub App installation token, which works as a git password as well as an API token.
The username is a placeholder GitHub requires: it ignores the value but rejects an empty one, and `x-access-token` is what its own documentation uses for an installation token.
Types ¶
This section is empty.