Documentation ¶
Index ¶
- Constants
- Variables
- func Duplicate(src, dst string) error
- func NewGithubClient(httpClient *http.Client, token string) *githubClient
- func NewGitlabClient(httpClient *http.Client, token string) (*gitlabClient, error)
- func SecretName(projectName string) string
- func WithAuth(auth Auth) repositoryOption
- func WithHTTPClient(client *http.Client) repositoryOption
- func WithProvider(provider Provider) repositoryOption
- type Auth
- type GenericProviderClient
- type GenericRepository
- func (g *GenericRepository) Commit(file string, message string) (string, error)
- func (g *GenericRepository) CreatePullRequest(title string, desc, src string, dst string) error
- func (g *GenericRepository) CurrentBranch() (string, error)
- func (g *GenericRepository) DeleteLocalBranch(branch string) error
- func (g *GenericRepository) Path() string
- func (g *GenericRepository) Pull() (string, error)
- func (g *GenericRepository) Push(src, dst string) error
- func (g *GenericRepository) RepoID() string
- func (g *GenericRepository) SwitchBranch(branch string, create bool) error
- type GithubRepository
- type GitlabRepository
- type Provider
- type PullRequestRequest
- type Repository
- type RepositoryConfigurator
- type RepositoryManager
- type WithKeySuffix
Constants ¶
View Source
const ( K8sSecretDataAuthType = "auth" K8sSecretDataAuthTypeSSH = "ssh" SSHKey = "identity" SSHPubKey = "identity.pub" Token = "token" )
View Source
const ( GitHub = "github" GitLab = "gitlab" Generic = "generic" )
View Source
const DefaultRepoID = "none/none"
Variables ¶
View Source
var (
ErrPRAlreadyExists = errors.New("Pull-Request already exists")
)
View Source
var ErrPullRequestNotSupported = errors.New("Pull-Request not supported")
View Source
var (
ErrRepositoryID = errors.New("Unknown repository id")
)
View Source
var (
ErrUnknownURLFormat = errors.New("Unknown git url format")
)
Functions ¶
func NewGithubClient ¶
func NewGitlabClient ¶
func SecretName ¶
func WithHTTPClient ¶
func WithProvider ¶
func WithProvider(provider Provider) repositoryOption
Types ¶
type Auth ¶
type Auth struct { Method transport.AuthMethod // Personal Access Token with access rights to the VCS repository. // When empty, features like PR creation won't be possible. Token string }
Auth methods for repository access.
func GetAuth ¶
func GetAuth( ctx context.Context, kubeClient kube.Client[unstructured.Unstructured, unstructured.Unstructured], controllerNamespace string, projectName string, ) (*Auth, error)
type GenericProviderClient ¶
type GenericProviderClient struct{}
func (*GenericProviderClient) CreateDeployKey ¶
func (*GenericProviderClient) CreateDeployKey( ctx context.Context, repoID string, opts ...deployKeyOption, ) (*deployKey, error)
func (*GenericProviderClient) CreatePullRequest ¶
func (g *GenericProviderClient) CreatePullRequest( ctx context.Context, req PullRequestRequest, ) error
func (*GenericProviderClient) GetHostPublicSSHKey ¶
func (*GenericProviderClient) GetHostPublicSSHKey() string
type GenericRepository ¶
type GenericRepository struct {
// contains filtered or unexported fields
}
func (*GenericRepository) Commit ¶
func (g *GenericRepository) Commit(file string, message string) (string, error)
func (*GenericRepository) CreatePullRequest ¶
func (g *GenericRepository) CreatePullRequest(title string, desc, src string, dst string) error
func (*GenericRepository) CurrentBranch ¶
func (g *GenericRepository) CurrentBranch() (string, error)
func (*GenericRepository) DeleteLocalBranch ¶
func (g *GenericRepository) DeleteLocalBranch(branch string) error
func (*GenericRepository) Path ¶
func (g *GenericRepository) Path() string
func (*GenericRepository) Pull ¶
func (g *GenericRepository) Pull() (string, error)
func (*GenericRepository) Push ¶
func (g *GenericRepository) Push(src, dst string) error
func (*GenericRepository) RepoID ¶
func (g *GenericRepository) RepoID() string
func (*GenericRepository) SwitchBranch ¶
func (g *GenericRepository) SwitchBranch(branch string, create bool) error
type GithubRepository ¶
type GithubRepository struct { GenericRepository // contains filtered or unexported fields }
func (*GithubRepository) CreatePullRequest ¶
func (g *GithubRepository) CreatePullRequest(title, desc, branch, targetBranch string) error
type GitlabRepository ¶
type GitlabRepository struct { GenericRepository // contains filtered or unexported fields }
func (*GitlabRepository) CreatePullRequest ¶
func (g *GitlabRepository) CreatePullRequest(title, desc, branch, targetBranch string) error
type PullRequestRequest ¶
type Repository ¶
type Repository interface { Path() string RepoID() string Pull() (string, error) Commit(file, message string) (string, error) SwitchBranch(branch string, create bool) error CurrentBranch() (string, error) DeleteLocalBranch(branch string) error Push(src, dst string) error CreatePullRequest(title, desc, src, dst string) error }
func NewRepository ¶
func NewRepository( localTargetPath string, gitRepository *git.Repository, opts ...repositoryOption, ) (Repository, error)
func Open ¶
func Open( path string, opts ...repositoryOption, ) (Repository, error)
type RepositoryConfigurator ¶
type RepositoryConfigurator struct {
// contains filtered or unexported fields
}
RepositoryConfigurator is capable of setting up Navecd with a Git provider.
func NewRepositoryConfigurator ¶
func NewRepositoryConfigurator( controllerNamespace string, kubeClient kube.Client[unstructured.Unstructured, unstructured.Unstructured], httpClient *http.Client, url string, token string, ) (*RepositoryConfigurator, error)
func (RepositoryConfigurator) CreateDeployKeyIfNotExists ¶
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, unstructured.Unstructured], log logr.Logger, ) RepositoryManager
func (*RepositoryManager) Load ¶
func (manager *RepositoryManager) Load( ctx context.Context, remoteURL string, branch string, targetPath string, projectName string, ) (Repository, error)
Load clones a remote vcs repository to a local path or opens it if it exists.
func (*RepositoryManager) LoadLocally ¶
func (manager *RepositoryManager) LoadLocally( ctx context.Context, srcRepoPath string, targetPath string, projectName string, ) (Repository, error)
type WithKeySuffix ¶
type WithKeySuffix string
Click to show internal directories.
Click to hide internal directories.