Skip to content

Commit

Permalink
Revert "fix: [ASSMT-476]: include Spinnaker credentialsInfo in the pa… (
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarulg authored Jul 17, 2024
1 parent d79a3b9 commit b52f02f
Showing 1 changed file with 1 addition and 22 deletions.
23 changes: 1 addition & 22 deletions pipelines.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ func migrateSpinnakerPipelines() error {
}
var jsonBody []byte
var pipelines []map[string]interface{}
var credentials []map[string]interface{}
var err error
if len(migrationReq.PipelineName) > 0 {
jsonBody, err = getSinglePipeline(authMethod, migrationReq.PipelineName)
Expand All @@ -107,11 +106,7 @@ func migrateSpinnakerPipelines() error {
if err != nil {
return err
}
credentials, err = getCredentialsInfo(authMethod)
if err != nil {
return err
}
payload := map[string][]map[string]interface{}{"pipelines": pipelines, "credentials": credentials}
payload := map[string][]map[string]interface{}{"pipelines": pipelines}
_, err = createSpinnakerPipelines(payload)
return err
}
Expand Down Expand Up @@ -339,22 +334,6 @@ func getAllPipelines(authMethod string, appName string) ([]byte, error) {
return GetWithAuth(migrationReq.SpinnakerHost, "applications/"+appName+"/pipelineConfigs", authMethod, migrationReq.Auth64, migrationReq.Cert, migrationReq.Key, migrationReq.AllowInsecureReq)
}

func getCredentialsInfo(authMethod string) ([]map[string]interface{}, error) {
jsonBody, err := GetWithAuth(migrationReq.SpinnakerHost, "credentials", authMethod, migrationReq.Auth64, migrationReq.Cert, migrationReq.Key, migrationReq.AllowInsecureReq)
if err != nil {
return nil, err
}
credentials, err := normalizeJsonArray(jsonBody)
if err != nil {
return nil, err
}
filtered := make([]map[string]interface{}, 0)
for _, credential := range credentials {
filtered = append(filtered, map[string]interface{}{"name": credential["name"], "type": credential["type"]})
}
return filtered, nil
}

// this is because there's no endpoint in gate to fetch pipeline config based on a pipeline id
func findPipelineById(authMethod string, appName string, pipelineId string) (map[string]interface{}, error) {

Expand Down

0 comments on commit b52f02f

Please sign in to comment.