feat: introduce conversions between API versions - #4823
Conversation
Codecov Report❌ Patch coverage is
🚀 New features to boost your workflow:
|
✅ Deploy Preview for zarf-docs canceled.
|
Signed-off-by: Austin Abro <austinabro321@gmail.com>
cfef0e1 to
54d2861
Compare
Signed-off-by: Austin Abro <austinabro321@gmail.com>
Signed-off-by: Austin Abro <austinabro321@gmail.com>
Signed-off-by: Austin Abro <austinabro321@gmail.com>
Signed-off-by: Austin Abro <austinabro321@gmail.com>
Signed-off-by: Austin Abro <austinabro321@gmail.com>
soltysh
left a comment
There was a problem hiding this comment.
A few comments/questions, the reflection-based round tripping tests should help us uncover eventual missing bits. Those few I've pointed out are b/c AI told me 😅
| Name: c.Name, | ||
| Description: c.Description, | ||
| Optional: c.Optional, | ||
| Service: string(c.Service), |
There was a problem hiding this comment.
Here, the opposite, so Required: !c.Optional, to ensure that the generic struct has all the fields filled in.
There was a problem hiding this comment.
I have not filled in every field in the generic struct, but rather let the conversion logic handle it so long as there is no information missing by filling out the newer, canonical field. In this case since required would always be nil, the conversion logic fallsback to using optional.
Signed-off-by: Austin Abro <austinabro321@gmail.com>
Signed-off-by: Austin Abro <austinabro321@gmail.com>
Signed-off-by: Austin Abro <austinabro321@gmail.com>
Signed-off-by: Austin Abro <austinabro321@gmail.com>
Signed-off-by: Austin Abro <austinabro321@gmail.com>
Signed-off-by: Austin Abro <austinabro321@gmail.com>
Signed-off-by: Austin Abro <austinabro321@gmail.com>
Signed-off-by: Austin Abro <austinabro321@gmail.com>
Signed-off-by: Austin Abro <austinabro321@gmail.com>
Signed-off-by: Austin Abro <austinabro321@gmail.com>
Signed-off-by: Austin Abro <austinabro321@gmail.com>
Signed-off-by: Austin Abro <austinabro321@gmail.com>
Signed-off-by: Austin Abro <austinabro321@gmail.com>
Signed-off-by: Austin Abro <austinabro321@gmail.com>
Signed-off-by: Austin Abro <austinabro321@gmail.com>
Signed-off-by: Austin Abro <austinabro321@gmail.com>
Signed-off-by: Austin Abro <austinabro321@gmail.com>
brandtkeller
left a comment
There was a problem hiding this comment.
Adding some thoughts as I get time to test.
| Group: c.DeprecatedGroup, | ||
| DataInjections: dataInjectionsToGeneric(c.DataInjections), | ||
| HealthChecks: healthChecksToGeneric(c.HealthChecks), | ||
| DeprecatedScripts: scriptsToGeneric(c.DeprecatedScripts), |
There was a problem hiding this comment.
Are we consuming DeprecatedScripts anywhere to perform the migration to actions?
There was a problem hiding this comment.
Yes in the pkgcfg package, It should always be migrated right as v1alpha1 is parsed, and so technically not be needed in the migration logic, but I think it's still better to have the converter convert everything.
| func actionSetToGeneric(s v1alpha1.ZarfComponentActionSet) types.ComponentActionSet { | ||
| defaults := types.ComponentActionDefaults{ | ||
| Silent: s.Defaults.Mute, | ||
| MaxTotalSeconds: int32(s.Defaults.MaxTotalSeconds), |
There was a problem hiding this comment.
seems negligible but do we need to add safe migrations from int to int32?
There was a problem hiding this comment.
I'm not concerned about that honestly
Signed-off-by: Austin Abro <austinabro321@gmail.com>
Signed-off-by: Austin Abro <austinabro321@gmail.com>
Description
I had previously discussed the possibility of moving the deprecated types into their internal package, but I decided against this as I believe we want SDK users to be able to fully inspect the contents of their package. While variables are set for instance, we should let SDK users examine them.
relates to #3433
Checklist before merging