Skip to content

Commit 10b6687

Browse files
mergify[bot]Ganesh Sapkal
and
Ganesh Sapkal
authored
fix(pipelineSave): Fixed issue for pipeline save with spinnaker 1.21.x (spinnaker#287)
With latest spinnaker version The ApplicationControllerApi.GetPipelineConfigUsingGET returns 404 for non-existing pipeline. Updated pipeline save to check for status http.StatusOK and foundPipeline both. (cherry picked from commit f971df5) Co-authored-by: Ganesh Sapkal <[email protected]>
1 parent 605a4dd commit 10b6687

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

cmd/pipeline/save.go

+1-5
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,9 @@ func savePipeline(cmd *cobra.Command, options *saveOptions) error {
8585

8686
foundPipeline, queryResp, _ := options.GateClient.ApplicationControllerApi.GetPipelineConfigUsingGET(options.GateClient.Context, application, pipelineName)
8787

88-
if queryResp.StatusCode != http.StatusOK {
89-
return fmt.Errorf("Encountered an error querying pipeline, status code: %d\n", queryResp.StatusCode)
90-
}
91-
9288
_, exists := pipelineJson["id"].(string)
9389
var foundPipelineId string
94-
if len(foundPipeline) > 0 {
90+
if queryResp.StatusCode == http.StatusOK && len(foundPipeline) > 0 {
9591
foundPipelineId = foundPipeline["id"].(string)
9692
}
9793
if !exists && foundPipelineId != "" {

0 commit comments

Comments
 (0)