Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

milindcq/gh-84: pipelineID resolution fix for multi/mixed pipeline stages #83

Merged
merged 2 commits into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pkg/backend/spinnaker/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,12 +249,12 @@ func (s *SpinClient) savePipeline(pipelineJSON string) (string, *http.Response,
return pipelineID, nil, wrappedErr
}

s.log.Info("Pipeline %q not found in application %q", pipelineName, application)
s.log.Infof("Pipeline %q not found in application %q", pipelineName, application)
}

// pipeline found, let's use Spinnaker's known Pipeline ID, otherwise we'll get one created for us
if len(foundPipeline) > 0 {
s.log.Info("Pipeline %q found with ID %q", foundPipeline["name"], foundPipeline["id"], application)
s.log.Infof("Pipeline %q found with ID %q in application %q", foundPipeline["name"], foundPipeline["id"], application)

pipeline["id"] = foundPipeline["id"].(string)
pipelineID = foundPipeline["id"].(string)
Expand Down Expand Up @@ -748,7 +748,7 @@ func (s *SpinClient) saveNestedPipeline(stages interface{}, pipeline map[string]
for _, stage := range childPipelineStages.([]interface{}) {
innerStage := stage.(map[string]interface{})

if !hasChildPipelines && mapContainsKey(innerStage, "application") && mapContainsKey(innerStage, "pipeline") && reflect.TypeOf(innerStage["pipeline"]).Kind() == reflect.String {
if mapContainsKey(innerStage, "application") && mapContainsKey(innerStage, "pipeline") && reflect.TypeOf(innerStage["pipeline"]).Kind() == reflect.String {
if response, result := s.findAndReplacePipelineNameWithFoundID(innerStage); response {
stage = result
}
Expand Down
3 changes: 2 additions & 1 deletion pkg/backend/spinnaker/backend_mocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ func (a *MockApplicationControllerAPI) GetPipelineConfigUsingGET(ctx context.Con
res = map[string]interface{}{}
} else {
res = map[string]interface{}{
"id": "1234",
"name": pipelineName,
"id": "1234",
}
}

Expand Down
Loading