Skip to content

Commit

Permalink
CR-15158 (#449)
Browse files Browse the repository at this point in the history
* CR-15158

* wip
  • Loading branch information
eti-codefresh authored Dec 8, 2022
1 parent b770df1 commit 792dd09
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.50.0
0.51.0
27 changes: 26 additions & 1 deletion pkg/codefresh/argo_runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ type (
Delete(ctx context.Context, runtimeName string) (int, error)
DeleteManaged(ctx context.Context, runtimeName string) (int, error)
SetSharedConfigRepo(ctx context.Context, suggestedSharedConfigRepo string) (string, error)
ResetSharedConfigRepo(ctx context.Context) error
}

argoRuntime struct {
Expand Down Expand Up @@ -64,13 +65,16 @@ type (
Errors []graphqlError
}


graphQlSuggestIscRepoResponse struct {
Data struct {
SuggestIscRepo string
}
Errors []graphqlError
}

graphQlResetIscRepoResponse struct {
Errors []graphqlError
}
)

func newArgoRuntimeAPI(codefresh *codefresh) IRuntimeAPI {
Expand Down Expand Up @@ -314,3 +318,24 @@ func (r *argoRuntime) SetSharedConfigRepo(ctx context.Context, suggestedSharedCo

return res.Data.SuggestIscRepo, nil
}

func (r *argoRuntime) ResetSharedConfigRepo(ctx context.Context) error {
jsonData := map[string]interface{}{
"query": `
mutation resetIscRepo {
resetIscRepo
}
`}

res := &graphQlResetIscRepoResponse{}
err := r.codefresh.graphqlAPI(ctx, jsonData, res)

if err != nil {
fmt.Errorf("failed making a graphql API call while resetting shared config repo: %w", err)
}

if len(res.Errors) > 0 {
return graphqlErrorResponse{errors: res.Errors}
}
return nil
}

0 comments on commit 792dd09

Please sign in to comment.