Skip to content

Commit 6871335

Browse files
removed redundant
1 parent 68ce5bf commit 6871335

File tree

1 file changed

+3
-41
lines changed

1 file changed

+3
-41
lines changed

pkg/codefresh/argo_runtime.go

Lines changed: 3 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,6 @@ type (
3434
}
3535

3636
graphQlRuntimeCreationResponse struct {
37-
Data struct {
38-
Runtime model.RuntimeCreationResponse
39-
}
40-
Errors []graphqlError
41-
}
42-
43-
graphQlRuntimeCreationResponseVersion34dot9AndUp struct {
4437
Data struct {
4538
RuntimeNew model.RuntimeCreationResponse
4639
}
@@ -68,48 +61,17 @@ func (r *argoRuntime) Create(ctx context.Context, opts *model.RuntimeInstallatio
6861
newAccessToken
6962
}
7063
}
71-
`,
64+
`,
7265
"variables": map[string]interface{}{
7366
"installationArgs": opts,
7467
},
7568
}
7669

77-
res := &graphQlRuntimeCreationResponseVersion34dot9AndUp{}
70+
res := &graphQlRuntimeCreationResponse{}
7871
err := r.codefresh.graphqlAPI(ctx, jsonData, res)
7972

8073
if err != nil {
81-
jsonDataOlderVersion := map[string]interface{}{
82-
"query": `
83-
mutation CreateRuntime(
84-
$runtimeName: String!, $cluster: String!, $runtimeVersion: String!, $ingressHost: String, $componentNames: [String]!
85-
) {
86-
runtime(runtimeName: $runtimeName, cluster: $cluster, runtimeVersion: $runtimeVersion, ingressHost: $ingressHost, componentNames: $componentNames) {
87-
name
88-
newAccessToken
89-
}
90-
}
91-
`,
92-
"variables": map[string]interface{}{
93-
"runtimeName": opts.RuntimeName,
94-
"cluster": opts.Cluster,
95-
"runtimeVersion": opts.RuntimeVersion,
96-
"ingressHost": opts.IngressHost,
97-
"componentNames": opts.ComponentNames,
98-
},
99-
}
100-
101-
resOlderVersion := &graphQlRuntimeCreationResponse{}
102-
err = r.codefresh.graphqlAPI(ctx, jsonDataOlderVersion, resOlderVersion)
103-
104-
if err != nil {
105-
return nil, fmt.Errorf("failed making a graphql API call while creating runtime: %w", err)
106-
}
107-
108-
if len(resOlderVersion.Errors) > 0 {
109-
return nil, graphqlErrorResponse{errors: resOlderVersion.Errors}
110-
}
111-
112-
return &resOlderVersion.Data.Runtime, nil
74+
return nil, fmt.Errorf("failed making a graphql API call while creating runtime: %w", err)
11375
}
11476

11577
if len(res.Errors) > 0 {

0 commit comments

Comments
 (0)