Skip to content

Commit

Permalink
fix: [ASSMT-435]: support for all parameters in config file (#122)
Browse files Browse the repository at this point in the history
Co-authored-by: Edgar Garcia <[email protected]>
  • Loading branch information
danielGz and edgarulg authored Jun 13, 2024
1 parent 7eff8f6 commit b5f0f10
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
15 changes: 12 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ var migrationReq = struct {
Cert string `survey:"cert"`
Key string `survey:"key"`
Auth64 string `survey:"auth64"`
Insecure bool `survey:"insecure"`
}{}

func getReqBody(entityType EntityType, filter Filter) RequestBody {
Expand Down Expand Up @@ -150,7 +149,7 @@ func logSpinnakerMigrationDetails(authMethod string) {
migrationReq.SpinnakerAppName,
migrationReq.PipelineName,
authMethod,
migrationReq.Insecure,
migrationReq.AllowInsecureReq,
)

// Log the formatted message
Expand Down Expand Up @@ -362,6 +361,16 @@ func main() {
Usage: "Specifies Spinnaker Application from which pipelines to be migrated.",
Destination: &migrationReq.SpinnakerAppName,
}),
altsrc.NewStringFlag(&cli.StringFlag{
Name: "cert",
Usage: "x509 cert location for authenticating with spinnaker",
Destination: &migrationReq.Cert,
}),
altsrc.NewStringFlag(&cli.StringFlag{
Name: "key",
Usage: "x509 key location for authenticating with spinnaker",
Destination: &migrationReq.Key,
}),
}
app := &cli.App{
Name: "harness-upgrade",
Expand Down Expand Up @@ -595,7 +604,7 @@ func main() {
&cli.BoolFlag{
Name: "insecure",
Usage: "Weteher to validate the TLS certificate or not",
Destination: &migrationReq.Insecure,
Destination: &migrationReq.AllowInsecureReq,
},
&cli.StringFlag{
Name: "key",
Expand Down
6 changes: 3 additions & 3 deletions pipelines.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ func addDependentPipelineRecursive(pipelines []map[string]interface{}, pipelineS

i, p, err := findPipelineIndexById(pipelines, pipelineId)

if err == nil {
if true {

if p == nil {
var appName = pipelineStage["application"].(string)
Expand Down Expand Up @@ -331,7 +331,7 @@ func findPipelineIdByName(pipelines []PipelineDetails, name string) string {
}

func getAllPipelines(authMethod string, appName string) ([]byte, error) {
return GetWithAuth(migrationReq.SpinnakerHost, "applications/"+appName+"/pipelineConfigs", authMethod, migrationReq.Auth64, migrationReq.Cert, migrationReq.Key, migrationReq.Insecure)
return GetWithAuth(migrationReq.SpinnakerHost, "applications/"+appName+"/pipelineConfigs", authMethod, migrationReq.Auth64, migrationReq.Cert, migrationReq.Key, migrationReq.AllowInsecureReq)
}

// this is because there's no endpoint in gate to fetch pipeline config based on a pipeline id
Expand Down Expand Up @@ -369,7 +369,7 @@ func findPipelineIndexById(pipelines []map[string]interface{}, pipelineId string
}

func getSinglePipeline(authMethod string, name string) ([]byte, error) {
return GetWithAuth(migrationReq.SpinnakerHost, "applications/"+migrationReq.SpinnakerAppName+"/pipelineConfigs/"+name, authMethod, migrationReq.Auth64, migrationReq.Cert, migrationReq.Key, migrationReq.Insecure)
return GetWithAuth(migrationReq.SpinnakerHost, "applications/"+migrationReq.SpinnakerAppName+"/pipelineConfigs/"+name, authMethod, migrationReq.Auth64, migrationReq.Cert, migrationReq.Key, migrationReq.AllowInsecureReq)
}

func createSpinnakerPipelines(pipelines interface{}) (reqId string, err error) {
Expand Down

0 comments on commit b5f0f10

Please sign in to comment.