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

fix(webhook): Don't try to deserialize fields we don't really need #3202

Merged
merged 4 commits into from
Oct 2, 2019

Conversation

marchello2000
Copy link
Contributor

An assumption was made that body is a can be jackon parsed into a JSON object.
But that's not always the case, in fact, we actually account for it in the original parse:
https://github.com/spinnaker/orca/blob/master/orca-webhook/src/main/groovy/com/netflix/spinnaker/orca/webhook/tasks/CreateWebhookTask.groovy#L71
But then disregard it in StageContext mapping

This change removes those fields from being parsed since we don't actually need them for anything
inside the stage (they were added in the attempt to be fully typed)

@marchello2000
Copy link
Contributor Author

Fixes spinnaker/spinnaker#4881

An assumption was made that body is a can be jackon parsed into a JSON object.
But that's not always the case, in fact, we actually account for it in the original parse:
https://github.com/spinnaker/orca/blob/master/orca-webhook/src/main/groovy/com/netflix/spinnaker/orca/webhook/tasks/CreateWebhookTask.groovy#L71
But then disregard it in StageContext mapping

This change removes those fields from being parsed since we don't actually need them for anything
inside the stage (they were added in the attempt to be fully typed)
Copy link
Contributor

@gal-yardeni gal-yardeni left a comment

Choose a reason for hiding this comment

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

LGTM - should we just delete these fields?

WebhookMonitorResponseStageData monitor
String error

// NOTE: The fields below exist in the context because they are inserted by the CreateWebhookTask but they aren't
Copy link
Contributor

Choose a reason for hiding this comment

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

😆

@emjburns
Copy link
Contributor

emjburns commented Oct 1, 2019

What do you mean "they aren't consumed by spinnaker" - did they used to be?

@marchello2000
Copy link
Contributor Author

What do you mean "they aren't consumed by spinnaker" - did they used to be?

We don't ever "read" them in orca (or anywhere) we store them for the user/deck to observe in the context. In my previous change, i wanted to be complete and define everything in the stagecontext for webhook, but body can be a string or a map so it's kinda annoying to parse out... (and causes exceptions) hence i just commented them out.

I think there is some marginal value in having them there... even if they are commented out... but i am happy to also remove them

@emjburns
Copy link
Contributor

emjburns commented Oct 2, 2019

I'd say leave them for now. I like having as much information as possible when you're in orca trying to fix a stage.

@emjburns
Copy link
Contributor

emjburns commented Oct 2, 2019

LGTM

@ethanfrogers
Copy link
Contributor

@marchello2000 is this okay to merge?

@geojaz
Copy link

geojaz commented Oct 2, 2019

We'd love to get this one in and cut 1.16.3 asap :)

@marchello2000
Copy link
Contributor Author

@ethanfrogers yes, thank you! feel free to merge when tRavis does it's thing... or I can if I see it finish first

@kevinawoo kevinawoo merged commit 695d6a2 into spinnaker:master Oct 2, 2019
@kevinawoo
Copy link
Member

@spinnakerbot cherry-pick 1.16

@kevinawoo
Copy link
Member

fyi, I merged/cherry-picked because @ethanfrogers told me to since he was ✈️ ing.

@marchello2000
Copy link
Contributor Author

Thanks, @kevinawoo !!!, CC: @louisjimenez as FYI that this should go to 1.16.3

@marchello2000 marchello2000 deleted the mark/issue_4881 branch October 2, 2019 21:50
spinnakerbot pushed a commit that referenced this pull request Oct 2, 2019
* fix(webhook): Don't try to deserialize fields we don't really need

An assumption was made that body is a can be jackon parsed into a JSON object.
But that's not always the case, in fact, we actually account for it in the original parse:
https://github.com/spinnaker/orca/blob/master/orca-webhook/src/main/groovy/com/netflix/spinnaker/orca/webhook/tasks/CreateWebhookTask.groovy#L71
But then disregard it in StageContext mapping

This change removes those fields from being parsed since we don't actually need them for anything
inside the stage (they were added in the attempt to be fully typed)

* fixup! fix(webhook): Don't try to deserialize fields we don't really need


Co-authored-by: Emily Burns <emjeburns@gmail.com>
Co-authored-by: Ethan Rogers <ethanfrogers@users.noreply.github.com>
@spinnakerbot
Copy link
Contributor

Cherry pick successful: #3207

louisjimenez pushed a commit that referenced this pull request Oct 3, 2019
…) (#3207)

* fix(webhook): Don't try to deserialize fields we don't really need

An assumption was made that body is a can be jackon parsed into a JSON object.
But that's not always the case, in fact, we actually account for it in the original parse:
https://github.com/spinnaker/orca/blob/master/orca-webhook/src/main/groovy/com/netflix/spinnaker/orca/webhook/tasks/CreateWebhookTask.groovy#L71
But then disregard it in StageContext mapping

This change removes those fields from being parsed since we don't actually need them for anything
inside the stage (they were added in the attempt to be fully typed)

* fixup! fix(webhook): Don't try to deserialize fields we don't really need


Co-authored-by: Emily Burns <emjeburns@gmail.com>
Co-authored-by: Ethan Rogers <ethanfrogers@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants