Skip to content

Commit 0d8619b

Browse files
authored
CR-21047-helm-migrate (#457)
* added migrateRuntime mutation * removed (deprecated) ResetSharedConfigRepo
1 parent 5c71e84 commit 0d8619b

File tree

4 files changed

+153
-31
lines changed

4 files changed

+153
-31
lines changed

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.57.1
1+
0.58.0

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

+73-20
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/codefresh/model/models_gen.go

+56-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/codefresh/runtime_v2.go

+23-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package codefresh
22

33
import (
44
"context"
5-
"errors"
65
"fmt"
76

87
"github.com/codefresh-io/go-sdk/pkg/codefresh/model"
@@ -17,7 +16,7 @@ type (
1716
Delete(ctx context.Context, runtimeName string) (int, error)
1817
DeleteManaged(ctx context.Context, runtimeName string) (int, error)
1918
SetSharedConfigRepo(ctx context.Context, suggestedSharedConfigRepo string) (string, error)
20-
ResetSharedConfigRepo(ctx context.Context) error
19+
MigrateRuntime(ctx context.Context, runtimeName string) error
2120
}
2221

2322
argoRuntime struct {
@@ -318,6 +317,26 @@ func (r *argoRuntime) SetSharedConfigRepo(ctx context.Context, suggestedSharedCo
318317
return res.Data.SuggestIscRepo, nil
319318
}
320319

321-
func (r *argoRuntime) ResetSharedConfigRepo(ctx context.Context) error {
322-
return errors.New("DEPRECATED: use UpdateCsdpSettings instead")
320+
func (r *argoRuntime) MigrateRuntime(ctx context.Context, runtimeName string) error {
321+
jsonData := map[string]interface{}{
322+
"query": `
323+
mutation migrateRuntime($runtimeName: String!) {
324+
migrateRuntime(runtimeName: $runtimeName)
325+
}
326+
`,
327+
"variables": map[string]interface{}{
328+
"runtimeName": runtimeName,
329+
},
330+
}
331+
res := &graphqlVoidResponse{}
332+
err := r.codefresh.graphqlAPI(ctx, jsonData, res)
333+
if err != nil {
334+
return fmt.Errorf("failed making a graphql API call to migrate runtime: %w", err)
335+
}
336+
337+
if len(res.Errors) > 0 {
338+
return graphqlErrorResponse{errors: res.Errors}
339+
}
340+
341+
return nil
323342
}

0 commit comments

Comments
 (0)