Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: [chaoscenter]: Added git ops functionality in experiment handlers #4446

Merged
merged 7 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion chaoscenter/graphql/server/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ require (
github.com/goccy/go-json v0.10.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/snappy v0.0.3 // indirect
github.com/golang/snappy v0.0.1 // indirect
github.com/google/go-cmp v0.5.7 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/googleapis/gnostic v0.5.5 // indirect
Expand Down
3 changes: 1 addition & 2 deletions chaoscenter/graphql/server/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -537,9 +537,8 @@ github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/golang/snappy v0.0.0-20170215233205-553a64147049/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4=
github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/golang/snappy v0.0.3 h1:fHPg5GQYlCeLIPB9BZqMVR5nR9A+IM5zcgeTdjMYmLA=
github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2/go.mod h1:k9Qvh+8juN+UKMCS/3jFtGICgW8O96FVaZsaxdzDkR4=
github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a/go.mod h1:ryS0uhF+x9jgbj/N71xsEqODy9BN81/GonCZiOzirOk=
github.com/golangci/errcheck v0.0.0-20181223084120-ef45e06d44b6/go.mod h1:DbHgvLiFKX1Sh2T1w8Q/h4NAI8MHIpzCdnBUDTXU3I0=
Expand Down
10 changes: 10 additions & 0 deletions chaoscenter/graphql/server/pkg/chaos_experiment/handler/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,16 @@ func (c *ChaosExperimentHandler) DeleteChaosExperiment(ctx context.Context, proj
return false, err
}
}
wf := model.ChaosExperimentRequest{
ExperimentID: &workflow.ExperimentID,
ExperimentName: workflow.Name,
}

err = c.gitOpsService.DeleteExperimentFromGit(ctx, projectID, &wf)
if err != nil {
logrus.Errorf("error deleting experiment manifest from git, err: %v", err)
return false, err
}
// Delete experiment
err = c.chaosExperimentService.ProcessExperimentDelete(query, workflow, uid, r)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion chaoscenter/graphql/server/pkg/gitops/gitops.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ func (c GitConfig) GitGetStatus() (bool, error) {
return status.IsClean(), nil
}

// getRepositoryWorktreeReference returns the git.Repository and git.Worktree instanes for the repo
// getRepositoryWorktreeReference returns the git.Repository and git.Worktree instances for the repo
func (c GitConfig) getRepositoryWorktreeReference() (*git.Repository, *git.Worktree, error) {
repo, err := git.PlainOpen(c.LocalPath)
if err != nil {
Expand Down
Loading