crossplane-contrib / function-patch-and-transform

A patch & transform composition function
https://crossplane.io
Apache License 2.0
23 stars 24 forks source link

fix: Add back support for To|FromEnvironmentFieldPath type in environment patches #125

Closed truongnht closed 3 months ago

truongnht commented 3 months ago

Resolves #123

truongnht commented 3 months ago

I did run the tests with the result

Running tool: /opt/homebrew/bin/go test -timeout 30s -run ^TestRunFunction$ github.com/crossplane-contrib/function-patch-and-transform

=== RUN   TestRunFunction
=== RUN   TestRunFunction/PatchToCompositeWithEnvironmentPatches
--- PASS: TestRunFunction/PatchToCompositeWithEnvironmentPatches (0.00s)
=== RUN   TestRunFunction/ExtractCompositeConnectionDetails
--- PASS: TestRunFunction/ExtractCompositeConnectionDetails (0.00s)
=== RUN   TestRunFunction/OptionalFieldPathNotFound
--- PASS: TestRunFunction/OptionalFieldPathNotFound (0.00s)
=== RUN   TestRunFunction/EnvironmentPatchRequiredNotFoundError
--- PASS: TestRunFunction/EnvironmentPatchRequiredNotFoundError (0.00s)
=== RUN   TestRunFunction/PatchComposedResourceFromEnvironmentShadowedNotSet
--- PASS: TestRunFunction/PatchComposedResourceFromEnvironmentShadowedNotSet (0.00s)
=== RUN   TestRunFunction/ReplaceDesiredResource
--- PASS: TestRunFunction/ReplaceDesiredResource (0.00s)
=== RUN   TestRunFunction/DesiredResourcesArePassedThrough
--- PASS: TestRunFunction/DesiredResourcesArePassedThrough (0.00s)
=== RUN   TestRunFunction/RequiredFieldPathNotFound
--- PASS: TestRunFunction/RequiredFieldPathNotFound (0.00s)
=== RUN   TestRunFunction/ObservedResourceKeepsItsName
--- PASS: TestRunFunction/ObservedResourceKeepsItsName (0.00s)
=== RUN   TestRunFunction/EnvironmentPatchSupportsToEnvironmentFieldPath
--- PASS: TestRunFunction/EnvironmentPatchSupportsToEnvironmentFieldPath (0.00s)
=== RUN   TestRunFunction/PatchComposedResourceFromEnvironment
--- PASS: TestRunFunction/PatchComposedResourceFromEnvironment (0.00s)
=== RUN   TestRunFunction/NoInput
--- PASS: TestRunFunction/NoInput (0.00s)
=== RUN   TestRunFunction/PatchBaseTemplate
--- PASS: TestRunFunction/PatchBaseTemplate (0.00s)
=== RUN   TestRunFunction/PatchDesiredResource
--- PASS: TestRunFunction/PatchDesiredResource (0.00s)
=== RUN   TestRunFunction/NothingToPatch
--- PASS: TestRunFunction/NothingToPatch (0.00s)
=== RUN   TestRunFunction/PatchErrorIsFatal
--- PASS: TestRunFunction/PatchErrorIsFatal (0.00s)
=== RUN   TestRunFunction/PatchToComposite
--- PASS: TestRunFunction/PatchToComposite (0.00s)
=== RUN   TestRunFunction/EnvironmentPatchToEnvironment
--- PASS: TestRunFunction/EnvironmentPatchToEnvironment (0.00s)
=== RUN   TestRunFunction/PatchToCompositeSupportsFromEnvironmentFieldPath
--- PASS: TestRunFunction/PatchToCompositeSupportsFromEnvironmentFieldPath (0.00s)
=== RUN   TestRunFunction/RenderBaseTemplateWithoutPatches
--- PASS: TestRunFunction/RenderBaseTemplateWithoutPatches (0.00s)
=== RUN   TestRunFunction/PatchComposedResourceFromEnvironmentShadowedSet
--- PASS: TestRunFunction/PatchComposedResourceFromEnvironmentShadowedSet (0.00s)
=== RUN   TestRunFunction/OnlyEnvironmentPatchesIsAllowed
--- PASS: TestRunFunction/OnlyEnvironmentPatchesIsAllowed (0.00s)
=== RUN   TestRunFunction/EnvironmentPatchOptionalNotFoundSkipped
--- PASS: TestRunFunction/EnvironmentPatchOptionalNotFoundSkipped (0.00s)
--- PASS: TestRunFunction (0.01s)
PASS
ok      github.com/crossplane-contrib/function-patch-and-transform      0.246s
phisco commented 3 months ago

can you also update https://github.com/crossplane-contrib/function-patch-and-transform/blob/901f6a0222e1fab63fafe941801fe380e15bbe20/input/v1beta1/resources_patches.go#L112?

marcofranssen commented 3 months ago

This is great. That would allow us to upgrade.