-
Notifications
You must be signed in to change notification settings - Fork 184
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
return execution id on pipeline execute command #264
Open
suhrud-kumar
wants to merge
2
commits into
spinnaker:master
Choose a base branch
from
suhrud-kumar:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -578,12 +578,13 @@ func (a *PipelineControllerApiService) GetPipelineUsingGET(ctx context.Context, | |
@param optional (nil or map[string]interface{}) with one or more of: | ||
@param "trigger" (interface{}) trigger | ||
@return */ | ||
func (a *PipelineControllerApiService) InvokePipelineConfigUsingPOST1(ctx context.Context, application string, pipelineNameOrId string, localVarOptionals map[string]interface{}) ( *http.Response, error) { | ||
func (a *PipelineControllerApiService) InvokePipelineConfigUsingPOST1(ctx context.Context, application string, pipelineNameOrId string, localVarOptionals map[string]interface{}) (interface{}, *http.Response, error) { | ||
var ( | ||
localVarHttpMethod = strings.ToUpper("Post") | ||
localVarPostBody interface{} | ||
localVarFileName string | ||
localVarFileBytes []byte | ||
localVarPostBody interface{} | ||
localVarFileName string | ||
localVarFileBytes []byte | ||
successPayload interface{} | ||
) | ||
|
||
// create path and map variables | ||
|
@@ -595,9 +596,8 @@ func (a *PipelineControllerApiService) InvokePipelineConfigUsingPOST1(ctx contex | |
localVarQueryParams := url.Values{} | ||
localVarFormParams := url.Values{} | ||
|
||
|
||
// to determine the Content-Type header | ||
localVarHttpContentTypes := []string{ "application/json", } | ||
localVarHttpContentTypes := []string{"application/json"} | ||
|
||
// set Content-Type header | ||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) | ||
|
@@ -608,7 +608,7 @@ func (a *PipelineControllerApiService) InvokePipelineConfigUsingPOST1(ctx contex | |
// to determine the Accept header | ||
localVarHttpHeaderAccepts := []string{ | ||
"*/*", | ||
} | ||
} | ||
|
||
// set Accept header | ||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) | ||
|
@@ -621,20 +621,24 @@ func (a *PipelineControllerApiService) InvokePipelineConfigUsingPOST1(ctx contex | |
} | ||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) | ||
if err != nil { | ||
return nil, err | ||
return successPayload, nil, err | ||
} | ||
|
||
localVarHttpResponse, err := a.client.callAPI(r) | ||
if err != nil || localVarHttpResponse == nil { | ||
return localVarHttpResponse, err | ||
return successPayload, localVarHttpResponse, err | ||
} | ||
defer localVarHttpResponse.Body.Close() | ||
if localVarHttpResponse.StatusCode >= 300 { | ||
bodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body) | ||
return localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) | ||
return successPayload, localVarHttpResponse, reportError("Status: %v, Body: %s", localVarHttpResponse.Status, bodyBytes) | ||
} | ||
|
||
return localVarHttpResponse, err | ||
if err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil { | ||
return successPayload, localVarHttpResponse, err | ||
} | ||
Comment on lines
+637
to
+639
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this can be moved to |
||
|
||
return successPayload, localVarHttpResponse, err | ||
} | ||
|
||
/* PipelineControllerApiService Trigger a pipeline execution | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of doing the JSON decoding in the generated file, why not attempt a JSON decode of the response body
resp
here?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like it might be better to use the newer Gate API
options.GateClient.PipelineControllerApi.InvokePipelineConfigViaEchoUsingPOST
instead.This returns an
interface{}
which we can marshal into a new struct, e.g:type executedPipelines struct {...}
and then log out.The struct will hold a list of executed pipelines because a single trigger (
spin
's POST) can invoke multiple pipelines.See Gate groovy returned object which would land in the Go empty interface.
Per: https://github.com/spinnaker/gate/blob/6e751aa7d7c9a4f116b85b6f4b73d5203d902ce7/gate-web/src/main/groovy/com/netflix/spinnaker/gate/services/PipelineService.groovy#L94-L116