Skip to content

Commit 60846c0

Browse files
CR-11153 isc adjustments (#427)
* added sharedConfigRepo to create runtime mutation - models_gen update * added app-proxy isc interface * isc wip * model_gen * remove unused function and interface
1 parent 704c83b commit 60846c0

File tree

3 files changed

+115
-16
lines changed

3 files changed

+115
-16
lines changed

pkg/codefresh/argo_runtime.go

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ type (
1313
List(ctx context.Context) ([]model.Runtime, error)
1414
ReportErrors(ctx context.Context, opts *model.ReportRuntimeErrorsArgs) (int, error)
1515
Delete(ctx context.Context, runtimeName string) (int, error)
16+
SetSharedConfigRepo(ctx context.Context, suggestedSharedConfigRepo string) (string, error)
1617
}
1718

1819
argoRuntime struct {
@@ -53,6 +54,14 @@ type (
5354
}
5455
Errors []graphqlError
5556
}
57+
58+
59+
graphQlSetIscRepoResponse struct {
60+
Data struct {
61+
SetIscRepo string
62+
}
63+
Errors []graphqlError
64+
}
5665
)
5766

5867
func newArgoRuntimeAPI(codefresh *codefresh) IRuntimeAPI {
@@ -234,3 +243,29 @@ func (r *argoRuntime) Delete(ctx context.Context, runtimeName string) (int, erro
234243

235244
return res.Data.DeleteRuntime, nil
236245
}
246+
247+
func (r *argoRuntime) SetSharedConfigRepo(ctx context.Context, suggestedSharedConfigRepo string) (string, error) {
248+
jsonData := map[string]interface{}{
249+
"query": `
250+
mutation setIscRepo($suggestedSharedConfigRepo: String!) {
251+
setIscRepo(suggestedSharedConfigRepo: $suggestedSharedConfigRepo)
252+
}
253+
`,
254+
"variables": map[string]interface{}{
255+
"suggestedSharedConfigRepo": suggestedSharedConfigRepo,
256+
},
257+
}
258+
259+
res := &graphQlSetIscRepoResponse{}
260+
err := r.codefresh.graphqlAPI(ctx, jsonData, res)
261+
262+
if err != nil {
263+
return "", fmt.Errorf("failed making a graphql API call while setting shared config repo: %w", err)
264+
}
265+
266+
if len(res.Errors) > 0 {
267+
return "nil", graphqlErrorResponse{errors: res.Errors}
268+
}
269+
270+
return res.Data.SetIscRepo, nil
271+
}

pkg/codefresh/model/app-proxy/models_gen.go

Lines changed: 40 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/codefresh/model/models_gen.go

Lines changed: 40 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)