-
Notifications
You must be signed in to change notification settings - Fork 215
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
Support complex types as parameter set values #3340
Conversation
- Add support for numbers, objects, arrays and booleans in parameter set `value` sources. - Convert complex values to JSON string representation during parameter set unmarshalling. Signed-off-by: Erik Cederberg <[email protected]>
Signed-off-by: Erik Cederberg <[email protected]>
if err != nil { | ||
return err | ||
} | ||
s.Hint = value | ||
} else { | ||
s.Hint = fmt.Sprintf("%v", s.Hint) |
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.
I am a bit confused by this, as the hint should be an empty string at this point? I left it in nonetheless.
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.
Yeah, you're right, it would be empty here. 🤷🏻♀️ Not needed, but not harmful (yet) I assume
@erikced Thanks for the PR. This is not the part the I'm most familiar with, maybe @schristoff has some more insights. But I have a few questions. |
Add integration test vaidating parameter value conversions for command line params, "stringified" params in a parameter set and native params in a parameter set. Signed-off-by: Erik Cederberg <[email protected]>
Signed-off-by: Erik Cederberg <[email protected]>
Signed-off-by: Erik Cederberg <[email protected]>
This MR should not change anything related to command line parameter usage.
Added missing documentation of the updated format.
I have added an integration test validating the handling of parameter set / command line parameter to finalized parameter. It is not a full integration test though, please let me know if you think it is sufficient or if a full e2e test is required. |
Signed-off-by: Erik Cederberg <[email protected]>
2c732b3
to
eea2a17
Compare
@erikced Looks good to me. Am I correct when I think the new format will technically also work in version 1.0.1 of the parameter file, but it will fail schema validation if it is validated? |
@kichristensen yes, that should be the case. As a side note, I am unsure whether the version should be 1.1.0 or 1.0.2, from a semver-like perspective it should probably be 1.1.0 since it is an extension of the functionality and not a patch (whatever that may be for a document) but other document versioning standards would probably treat it as 1.0.2 since all valid 1.0.0/1.0.1 documents are still valid. |
I like |
What does this change
This change updates the parameter sets to support
number
,object
,array
andboolean
values forvalue
sources, e.g.so that the parameter set value can be of the same type as the bundle parameter.
Currently this is only supported by manually converting the values to their JSON representation, which is less intuitive
It is implemented by updating the unmarsalling code for
Source
so that when parameter with thevalue
strategy is encountered and the hint is not astring
, it is converted to its corresponding JSON string representation.What issue does it fix
Closes #3331
Notes for the reviewer
Since the unmarshalling - and hence value transformation - is performed before the parameter set is stored in the parameter store the value stored will not necessarily match the input parameter set when running
porter parameters apply
, which might not be desirable(?). Even though porter will not itself write values that are not strings to the parameter store, it can read such values from the store as the BSON is converted to JSON and then unmarshalled in the same way as parameter sets from file.Checklist