Skip to content

Commit 7ad7b81

Browse files
first error check and fix query
1 parent 88f33ad commit 7ad7b81

File tree

1 file changed

+19
-25
lines changed

1 file changed

+19
-25
lines changed

pkg/codefresh/argo_runtime.go

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -86,29 +86,23 @@ func (r *argoRuntime) Create(runtimeName, cluster, runtimeVersion string) (*mode
8686

8787
func (r *argoRuntime) List() ([]model.Runtime, error) {
8888
jsonData := map[string]interface{}{
89-
"query": `
90-
{
91-
runtimes
92-
(
93-
pagination: {}
94-
project: ""
95-
) {
96-
runtimes() {
97-
edges {
98-
node {
99-
metadata {
100-
name
101-
namespace
102-
}
103-
healthMessage
104-
runtimeVersion
105-
self {
106-
healthMessage
107-
version
108-
}
109-
cluster
89+
"query": `{
90+
runtimes {
91+
edges {
92+
node {
93+
metadata {
94+
name
95+
namespace
11096
}
97+
self {
98+
healthStatus
99+
version
100+
}
101+
cluster
102+
}
103+
}
111104
}
105+
}
112106
`,
113107
}
114108

@@ -136,14 +130,14 @@ func (r *argoRuntime) List() ([]model.Runtime, error) {
136130
return nil, err
137131
}
138132

133+
if len(res.Errors) > 0 {
134+
return nil, graphqlErrorResponse{errors: res.Errors}
135+
}
136+
139137
runtimes := make([]model.Runtime, len(res.Data.Runtimes.Edges))
140138
for i := range res.Data.Runtimes.Edges {
141139
runtimes[i] = *res.Data.Runtimes.Edges[i].Node
142140
}
143141

144-
if len(res.Errors) > 0 {
145-
return nil, graphqlErrorResponse{errors: res.Errors}
146-
}
147-
148142
return runtimes, nil
149143
}

0 commit comments

Comments
 (0)