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

feat(EvaluateVariables): Support complex objects in EvaluateVariables stage #3232

Conversation

christopherthielen
Copy link
Contributor

You can create an adhoc spel expression that resolves to a complex object...

Screen Shot 2019-10-16 at 8 35 03 PM

... and we will happily expand the entire object.

Screen Shot 2019-10-16 at 8 33 54 PM

However, if you try to do the same thing in Evaluate Variables stage, you get an error:

java.lang.IllegalArgumentException: Unable to map context to class com.netflix.spinnaker.orca.pipeline.EvaluateVariablesStage$EvaluateVariablesStageContext
...
Caused by: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `java.lang.String` out of START_ARRAY token
 at [Source: UNKNOWN; line: -1, column: -1] (through reference chain: com.netflix.spinnaker.orca.pipeline.EvaluateVariablesStage$EvaluateVariablesStageContext[\"variables\"]

This PR changes Variable type from [ key: string, value: string ] to [key: string, value: object]

Copy link
Contributor

@marchello2000 marchello2000 left a comment

Choose a reason for hiding this comment

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

thanks, surprised this hasn't come up earlier

@cfieber
Copy link
Contributor

cfieber commented Oct 17, 2019

This is a good change - I wonder how many people are working around the stringyness of the current implementation elsewhere and if any of those spots might bust as a result

@christopherthielen
Copy link
Contributor Author

@cfieber If users are currently working around this, they're coercing their expression to a string in Evaluate Expressions stage already. I wouldn't expect this change to break since strings are still supported. Unless I'm overlooking some other possibility...

@christopherthielen christopherthielen merged commit 31e5229 into spinnaker:master Oct 17, 2019
@christopherthielen christopherthielen deleted the evaluate-variables-support-nested-objects branch October 17, 2019 17:39
@emjburns
Copy link
Contributor

Nice! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants