git

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSecretFromConfiguration

func NewSecretFromConfiguration(config Configuration) v1.Secret

Types

type Configuration

type Configuration struct {

	// ID of the configuration (it maps to the kubernetes secret)
	ID string
	// URL is the full url (schema/host/port) used to match a particular instance
	URL      string
	Provider models.GitProvider
	// Username and Password are used to perform a BasicAuth.
	// For Github/Gitlab the username can be anything (see https://gitlab.com/gitlab-org/gitlab/-/issues/212953).
	Username string
	// The Personal Access Token
	Password string
	// UserOrg is used to specify the username/organization/project
	UserOrg string
	// Repository is used to specify the exact repository
	Repository  string
	SkipSSL     bool
	Certificate []byte
}

Configuration is used to customize the Git requests for a specific git provider. The only required field is the URL, needed to check the specific instance to apply the configuration. If the UserOrg and/or the Repository are also specified then the most specific configuration will be used.

func NewConfigurationsFromSecrets

func NewConfigurationsFromSecrets(secrets []v1.Secret) []Configuration

func (Configuration) Gitconfig

func (c Configuration) Gitconfig() string

Gitconfig returns the id of the configuration, for filtering. Satisfies the interface `GitconfigResource`, see package `internal/auth`

type Manager

type Manager struct {
	SecretLister   SecretLister
	Configurations []Configuration
	// contains filtered or unexported fields
}

func NewManager

func NewManager(logger logr.Logger, secretLoader SecretLister) (*Manager, error)

func (*Manager) FindConfiguration

func (m *Manager) FindConfiguration(gitURL string) (*Configuration, error)

FindConfiguration will load the most specific Configuration for the provided gitUrl. A gitURL is a full git repo url like 'https://github.com/username/repo'

type SecretLister

type SecretLister interface {
	List(ctx context.Context, opts metav1.ListOptions) (*v1.SecretList, error)
}

Jump to

Keyboard shortcuts

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