Documentation ¶
Index ¶
- Constants
- func CheckoutBranch(project string, branch string, disableUpstreamSync bool) error
- func CloneRepo(project string, credentials apimodels.GitAuthCredentials) (bool, error)
- func ConfigureGitUser(project string) error
- func CreateBranch(project string, branch string, sourceBranch string) error
- func DeleteFile(path string) error
- func FileExists(path string) bool
- func GetBranches(project string) ([]string, error)
- func GetCredentials(project string) (*apimodels.GitAuthCredentials, error)
- func GetCurrentVersion(project string) (string, error)
- func GetDefaultBranch(project string) (string, error)
- func GetPaginatedResources(dir string, pageSize *int64, nextPageKey *string) *models.Resources
- func GetResourceMetadata(project string) *models.Version
- func Lock()
- func LockProject(project string)
- func ProjectExists(project string) bool
- func Reset(project string) error
- func ServiceExists(project string, stage string, service string, disableUpstreamSync bool) bool
- func StageAndCommitAll(project string, message string, withPull bool) error
- func StageExists(project string, stage string, disableUpstreamSync bool) bool
- func Unlock()
- func UnlockProject(project string)
- func UpdateOrCreateOrigin(project string) error
- func WriteBase64EncodedFile(path string, content string) error
- func WriteFile(path string, content []byte) error
- type CommandExecutor
- type CredentialReader
- type Git
- func (g *Git) CheckoutBranch(project string, branch string, disableUpstreamSync bool) error
- func (g *Git) CloneRepo(project string, credentials *apimodels.GitAuthCredentials) (bool, error)
- func (g *Git) ConfigureGitUser(project string) error
- func (g *Git) CreateBranch(project string, branch string, sourceBranch string) error
- func (g *Git) GetBranches(project string) ([]string, error)
- func (g *Git) GetCurrentVersion(project string) (string, error)
- func (g *Git) GetDefaultBranch(project string) (string, error)
- func (g *Git) Reset(project string) error
- func (g *Git) StageAndCommitAll(project string, message string, withPull bool) error
- func (g *Git) UpdateOrCreateOrigin(project string) error
- type K8sCredentialReader
- type KeptnUtilsCommandExecutor
- type PaginationResult
Constants ¶
const CannotAddResourceErrorMsg = "Could not add resource"
const CannotCheckOutBranchErrorMsg = "Could not check out branch"
const CannotUpdateResourceErrorMsg = "Could not update resource"
const ConfigurationServiceName = "configuration-service"
const GitError = "exit status 128"
const GitURLNotFound = "not found"
const HostNotFound = "host"
const InternalErrorErrMsg = "Internal server error"
const InvalidUpstreamTokenErrorMsg = "Invalid git token"
const ProjectDoesNotExistErrorMsg = "Project does not exist"
const RepositoryNotFoundErrorMsg = "Upstream repository not found"
const ServiceDoesNotExistErrorMsg = "Service does not exist"
const StageDoesNotExistErrorMsg = "Stage does not exist"
const WrongToken = "access token"
Variables ¶
This section is empty.
Functions ¶
func CheckoutBranch ¶
CheckoutBranch checks out the given branch
func CloneRepo ¶
func CloneRepo(project string, credentials apimodels.GitAuthCredentials) (bool, error)
CloneRepo clones an upstream repository into a local folder "project" and returns whether the Git repo is already initialized.
func ConfigureGitUser ¶
ConfigureGitUser sets the properties user.name and user.email needed for interacting with git in the given project's git repository
func CreateBranch ¶
CreateBranch creates a new branch
func FileExists ¶
FileExists checks whether a file is available or not
func GetBranches ¶
GetBranches returns a list of branches within the project
func GetCredentials ¶
func GetCredentials(project string) (*apimodels.GitAuthCredentials, error)
GetCredentials returns the git upstream credentials for a given project (stored as a secret), if available
func GetCurrentVersion ¶
GetCurrentVersion gets the latest version (i.e. commit hash) of the currently checked out branch
func GetDefaultBranch ¶
GetDefaultBranch returns the name of the default branch of the repo
func GetPaginatedResources ¶
GetPaginatedResources returns a paginates resources set
func GetResourceMetadata ¶
GetResourceMetadata godoc
func ProjectExists ¶
ProjectExists checks if a project exists
func ServiceExists ¶
ServiceExists checks if a service exists in a given stage of a project
func StageAndCommitAll ¶
StageAndCommitAll stages all current changes and commits them to the current branch
func StageExists ¶
StageExists checks if a stage in a given project exists
func UnlockProject ¶
func UnlockProject(project string)
func UpdateOrCreateOrigin ¶
UpdateOrCreateOrigin tries to update the remote origin. If no remote origin exists, it will add one
func WriteBase64EncodedFile ¶
WriteBase64EncodedFile writes a file using the base64 encoded input
Types ¶
type CommandExecutor ¶
type CredentialReader ¶
type CredentialReader interface {
GetCredentials(project string) (*apimodels.GitAuthCredentials, error)
}
type Git ¶
type Git struct { Executor CommandExecutor CredentialReader CredentialReader }
func NewGit ¶
func NewGit(e CommandExecutor, c CredentialReader) Git
func (*Git) CheckoutBranch ¶
CheckoutBranch checks out the given branch
func (*Git) CloneRepo ¶
CloneRepo clones an upstream repository into a local folder "project" and returns whether the Git repo is already initialized.
func (*Git) ConfigureGitUser ¶
func (*Git) CreateBranch ¶
CreateBranch creates a new branch
func (*Git) GetBranches ¶
GetBranches returns a list of branches within the project
func (*Git) GetCurrentVersion ¶
GetCurrentVersion gets the latest version (i.e. commit hash) of the currently checked out branch
func (*Git) GetDefaultBranch ¶
GetDefaultBranch returns the name of the default branch of the repo
func (*Git) StageAndCommitAll ¶
StageAndCommitAll stages all current changes and commits them to the current branch
func (*Git) UpdateOrCreateOrigin ¶
UpdateOrCreateOrigin tries to update the remote origin. If no remote origin exists, it will add one
type K8sCredentialReader ¶
type K8sCredentialReader struct{}
func (K8sCredentialReader) GetCredentials ¶
func (K8sCredentialReader) GetCredentials(project string) (*apimodels.GitAuthCredentials, error)
type KeptnUtilsCommandExecutor ¶
type KeptnUtilsCommandExecutor struct{}