Skip to content

Dont execute jq filters or templates when api requests are not successful#5088

Merged
samcoe merged 1 commit intotrunkfrom
api-error-response-handling
Jan 29, 2022
Merged

Dont execute jq filters or templates when api requests are not successful#5088
samcoe merged 1 commit intotrunkfrom
api-error-response-handling

Conversation

@samcoe
Copy link
Contributor

@samcoe samcoe commented Jan 24, 2022

This PR changes the behavior of the api command to no longer attempt to filter or execute templates when the API request was not successful, now the API error message will be displayed instead of failure messages from the filter or template.

Closes #4255

@samcoe samcoe requested a review from a team as a code owner January 24, 2022 13:04
@samcoe samcoe self-assigned this Jan 24, 2022
@samcoe samcoe requested review from vilmibm and removed request for a team January 24, 2022 13:04
Copy link
Contributor

@mislav mislav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@samcoe samcoe merged commit e68aa12 into trunk Jan 29, 2022
@samcoe samcoe deleted the api-error-response-handling branch January 29, 2022 07:32
@chadwhitacre
Copy link

@mislav
Copy link
Contributor

mislav commented Feb 15, 2022

@chadwhitacre Sorry about that! For what it's worth, the original behavior was a bug: the jq filter should have never been applied to the HTTP 404 response (and thus mask the error response). The new behavior of dumping error JSON output to stdout isn't great either; I'll open an issue about this.

jimmidyson added a commit to mesosphere/kind-docker-image-automation that referenced this pull request Sep 18, 2022
Since cli/cli#5088, `gh` no longer passes error output to jq filter so instead pass the
stdout to a jq invocation. This prevents triggering image builds for invalid tags.
jimmidyson added a commit to mesosphere/kind-docker-image-automation that referenced this pull request Sep 18, 2022
Since cli/cli#5088, `gh` no longer passes error output to jq filter so instead pass the
stdout to a jq invocation. This prevents triggering image builds for invalid tags.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Template should not be evaluated in case of errored API responses

3 participants