vcs

package
v0.11.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	GitHub  = "github"
	GitLab  = "gitlab"
	Generic = "generic"
)
View Source
const (
	K8sSecretName            = "vcs-auth"
	K8sSecretDataAuthType    = "auth"
	K8sSecretDataAuthTypeSSH = "ssh"
	SSHKey                   = "identity"
	SSHPubKey                = "identity.pub"
	SSHKnownHosts            = "known_hosts"
)
View Source
const (
	GitHubSSHKey = "github.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl"
)
View Source
const (
	GitLabSSHKey = "gitlab.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAfuCHKVTjquxvt6CM6tdG4SLp1Btn/nOeHHE5UOzRdf"
)

Variables

View Source
var (
	ErrAuthKeyNotFound = errors.New("VCS auth key secret not found")
)
View Source
var (
	ErrRepositoryID = errors.New("Unknown repository id")
)
View Source
var (
	ErrUnknownURLFormat = errors.New("Unknown git url format")
)

Functions

func NewGithubClient

func NewGithubClient(httpClient *http.Client, token string) *githubClient

func NewGitlabClient

func NewGitlabClient(httpClient *http.Client, token string) (*gitlabClient, error)

func WithTarget

func WithTarget(path string) loadOption

WithTarget provides a local path to where the vcs repository is cloned.

func WithUrl

func WithUrl(url string) loadOption

WithUrl provides a URL configuration for the load function.

Types

type GenericProviderClient

type GenericProviderClient struct{}

func (*GenericProviderClient) CreateDeployKey

func (*GenericProviderClient) CreateDeployKey(
	ctx context.Context,
	repoID string,
	opts ...deployKeyOption,
) (*deployKey, error)

func (*GenericProviderClient) GetHostPublicSSHKey

func (*GenericProviderClient) GetHostPublicSSHKey() string

type LoadOptions

type LoadOptions struct {
	// contains filtered or unexported fields
}

LoadOptions define configuration how to load a vcs repository.

type Provider

type Provider string

type PullFunc

type PullFunc = func() error

type Repository

type Repository struct {
	Path string
	// contains filtered or unexported fields
}

A vcs Repository.

func NewRepository

func NewRepository(path string, pull PullFunc) Repository

func (*Repository) Pull

func (repository *Repository) Pull() error

type RepositoryConfigurator

type RepositoryConfigurator struct {
	// contains filtered or unexported fields
}

RepositoryConfigurator is capable of setting up Declcd with a Git provider.

func NewRepositoryConfigurator

func NewRepositoryConfigurator(
	controllerNamespace string,
	kubeClient kube.Client[unstructured.Unstructured],
	httpClient *http.Client,
	url string,
	token string,
) (*RepositoryConfigurator, error)

func (RepositoryConfigurator) CreateDeployKeySecretIfNotExists

func (config RepositoryConfigurator) CreateDeployKeySecretIfNotExists(
	ctx context.Context,
	fieldManager string,
) error

type RepositoryManager

type RepositoryManager struct {
	// contains filtered or unexported fields
}

RepositoryManager clones a remote vcs repository to a local path.

func NewRepositoryManager

func NewRepositoryManager(
	controllerNamespace string,
	kubeClient kube.Client[unstructured.Unstructured],
	log logr.Logger,
) RepositoryManager

func (RepositoryManager) Load

func (manager RepositoryManager) Load(
	ctx context.Context,
	opts ...loadOption,
) (*Repository, error)

Load loads a remote vcs repository to a local path or opens it if it exists.

type WithKeySuffix

type WithKeySuffix string

Jump to

Keyboard shortcuts

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