git

package
v0.11.0-beta.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 23, 2024 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultSecretName = "gitcredential" //nolint:gosec // this is a resource name
)

Variables

This section is empty.

Functions

func GetAuthFromSecret

func GetAuthFromSecret(url string, creds *corev1.Secret) (transport.AuthMethod, error)

GetAuthFromSecret returns the AuthMethod calculated from the given secret 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, CABundle []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

Types

type Fetch

type Fetch struct{}

func NewFetch

func NewFetch() *Fetch

func (*Fetch) LatestCommit

func (f *Fetch) LatestCommit(ctx context.Context, gitrepo *v1alpha1.GitRepo, client client.Client) (string, error)

type GoGitRemoteLister

type GoGitRemoteLister struct {
	URL             string
	Auth            transport.AuthMethod
	CABundle        []byte
	InsecureSkipTLS bool
}

GoGitRemoteLister implements the RemoteLister interface using the go-git library

func (*GoGitRemoteLister) List

func (g *GoGitRemoteLister) List(appendPeeled bool) ([]*RemoteRef, error)

type Remote

type Remote struct {
	Lister  RemoteLister
	URL     string
	Options *options
}

func NewRemote

func NewRemote(url string, opts *options) (*Remote, error)

func (*Remote) LatestBranchCommit

func (r *Remote) LatestBranchCommit(branch string) (string, error)

LatestBranchCommit returns the latest commit for the given branch

func (*Remote) RevisionCommit

func (r *Remote) RevisionCommit(revision string) (string, error)

RevisionCommit returns the commit for the given revision

type RemoteLister

type RemoteLister interface {
	// List returns a generic RemoteRef slice of remote references in a git repository
	List(appendPeeled bool) ([]*RemoteRef, error)
}

type RemoteRef

type RemoteRef struct {
	Name string
	Hash string
}

RemoteRef represents a remote reference is a git repository

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL