Documentation ¶
Index ¶
- Constants
- func GenerateKeys() (string, string, error)
- func PathExists(path string) (bool, error)
- func SetupGitOps(user GitUser, gitConfig GitConfig) (string, error)
- type GitConfig
- func (c GitConfig) GetChanges() (string, map[string]int, error)
- func (c GitConfig) GetLatestCommitHash() (string, error)
- func (c GitConfig) GitCheckout() error
- func (c GitConfig) GitClone() (*git.Repository, error)
- func (c GitConfig) GitCommit(user GitUser, message string, deleteFile *string) (string, error)
- func (c GitConfig) GitGetStatus() (bool, error)
- func (c GitConfig) GitHardReset() error
- func (c GitConfig) GitPull() error
- func (c GitConfig) GitPush() error
- func (c GitConfig) UnsafeGitPull() error
- type GitMutexLock
- type GitUser
- type Service
Constants ¶
const ( DefaultPath = "/tmp/gitops/" ProjectDataPath = "litmus" )
Variables ¶
This section is empty.
Functions ¶
func GenerateKeys ¶
func PathExists ¶
PathExists checks for the existence of this path
Types ¶
type GitConfig ¶
type GitConfig struct { ProjectID string RepositoryURL string LocalPath string RemoteName string Branch string LatestCommit string UserName *string Password *string AuthType model.AuthType Token *string SSHPrivateKey *string }
GitConfig structure for the GitOps settings
func GetGitOpsConfig ¶
func GetGitOpsConfig(repoData gitops.GitConfigDB) GitConfig
GetGitOpsConfig is used for constructing the GitConfig from dbSchemaGitOps.GitConfigDB
func (GitConfig) GetChanges ¶
GetChanges returns the LatestCommit and list of files changed(since previous LatestCommit) in the project directory mentioned in GitConfig
func (GitConfig) GetLatestCommitHash ¶
GetLatestCommitHash returns the latest commit hash in the local repo for the project directory
func (GitConfig) GitCheckout ¶
GitCheckout changes the current active branch to specified branch in GitConfig
func (GitConfig) GitCommit ¶
GitCommit saves the changes in the repo and commits them with the message provided
func (GitConfig) GitGetStatus ¶
GitGetStatus executes "git get status --porcelain" for the provided Repository Path, returns true if the repository is clean and false if the repository is dirty
func (GitConfig) GitHardReset ¶
GitHardReset executes "git reset --hard HEAD" in provided Repository Path
func (GitConfig) GitPush ¶
GitPush pushes the current changes to remote set in GitConfig, always needs auth credentials
func (GitConfig) UnsafeGitPull ¶
UnsafeGitPull executes git pull after a hard reset when uncommitted changes are present in repo. Not safe.
type GitMutexLock ¶
type GitMutexLock struct {
// contains filtered or unexported fields
}
GitMutexLock structure for the Git MutexLock
func (*GitMutexLock) Lock ¶
func (g *GitMutexLock) Lock(repo string, branch *string)
Lock acquires a lock on particular project or repo for access
func (*GitMutexLock) Unlock ¶
func (g *GitMutexLock) Unlock(repo string, branch *string)
Unlock releases the lock on particular project or repo
type GitUser ¶
type GitUser struct {
// contains filtered or unexported fields
}
func GitUserFromContext ¶
type Service ¶
type Service interface { GitOpsNotificationHandler(ctx context.Context, infra chaos_infrastructure.ChaosInfra, experimentID string) (string, error) EnableGitOpsHandler(ctx context.Context, projectID string, config model.GitConfig) (bool, error) DisableGitOpsHandler(ctx context.Context, projectID string) (bool, error) UpdateGitOpsDetailsHandler(ctx context.Context, projectID string, config model.GitConfig) (bool, error) GetGitOpsDetails(ctx context.Context, projectID string) (*model.GitConfigResponse, error) UpsertExperimentToGit(ctx context.Context, projectID string, experiment *model.ChaosExperimentRequest) error DeleteExperimentFromGit(ctx context.Context, projectID string, experiment *model.ChaosExperimentRequest) error GitOpsSyncHandler(singleRun bool) SyncDBToGit(ctx context.Context, config GitConfig) error }
func NewGitOpsService ¶
func NewGitOpsService(gitOpsOperator *gitops.Operator, chaosExperimentService chaosExperimentOps.Service, chaosExperimentOps chaos_experiment.Operator) Service
NewGitOpsService returns a new instance of a gitOpsService