Skip to content

Commit 7150fde

Browse files
report installation erros to platform + small fix for models_gen (#228)
1 parent 96157c1 commit 7150fde

File tree

7 files changed

+247
-296
lines changed

7 files changed

+247
-296
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.35.3
1+
0.35.4

pkg/codefresh/argo_runtime.go

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ type (
1111
Create(ctx context.Context, opts *model.RuntimeInstallationArgs) (*model.RuntimeCreationResponse, error)
1212
Get(ctx context.Context, name string) (*model.Runtime, error)
1313
List(ctx context.Context) ([]model.Runtime, error)
14+
ReportErrors(ctx context.Context, opts *model.ReportRuntimeErrorsArgs) (int, error)
1415
Delete(ctx context.Context, runtimeName string) (int, error)
1516
}
1617

@@ -20,7 +21,7 @@ type (
2021

2122
graphqlRuntimesResponse struct {
2223
Data struct {
23-
Runtimes model.RuntimePage
24+
Runtimes model.RuntimeSlice
2425
}
2526
Errors []graphqlError
2627
}
@@ -39,6 +40,13 @@ type (
3940
Errors []graphqlError
4041
}
4142

43+
graphQlReportRuntimeErrorsResponse struct {
44+
Data struct {
45+
ReportRuntimeErrors int
46+
}
47+
Errors []graphqlError
48+
}
49+
4250
graphQlDeleteRuntimeResponse struct {
4351
Data struct {
4452
DeleteRuntime int
@@ -175,6 +183,33 @@ func (r *argoRuntime) List(ctx context.Context) ([]model.Runtime, error) {
175183
return runtimes, nil
176184
}
177185

186+
func (r *argoRuntime) ReportErrors(ctx context.Context, opts *model.ReportRuntimeErrorsArgs) (int, error) {
187+
jsonData := map[string]interface{}{
188+
"query": `
189+
mutation ReportRuntimeErrors(
190+
$reportErrorsArgs: ReportRuntimeErrorsArgs!
191+
) {
192+
reportRuntimeErrors(reportErrorsArgs: $reportErrorsArgs)
193+
}
194+
`,
195+
"variables": map[string]interface{}{
196+
"reportErrorsArgs": opts,
197+
},
198+
}
199+
200+
res := graphQlReportRuntimeErrorsResponse{}
201+
err := r.codefresh.graphqlAPI(ctx, jsonData, &res)
202+
if err != nil {
203+
return 0, fmt.Errorf("failed making a graphql API call to runtimeErrorReport: %w", err)
204+
}
205+
206+
if len(res.Errors) > 0 {
207+
return 0, graphqlErrorResponse{errors: res.Errors}
208+
}
209+
210+
return res.Data.ReportRuntimeErrors, nil
211+
}
212+
178213
func (r *argoRuntime) Delete(ctx context.Context, runtimeName string) (int, error) {
179214
jsonData := map[string]interface{}{
180215
"query": `

pkg/codefresh/component.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ type (
1818

1919
graphqlComponentsResponse struct {
2020
Data struct {
21-
Components model.ComponentPage
21+
Components model.ComponentSlice
2222
}
2323
Errors []graphqlError
2424
}

pkg/codefresh/git-source.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ type (
1818

1919
graphQlGitSourcesListResponse struct {
2020
Data struct {
21-
GitSources model.GitSourcePage
21+
GitSources model.GitSourceSlice
2222
}
2323
Errors []graphqlError
2424
}

0 commit comments

Comments
 (0)