Repository navigation
fix(cel): register kro's hash, IP, CIDR and semver CEL libraries - #129
Open
sarankumar1325 wants to merge 1 commit into
Open
sarankumar1325 wants to merge 1 commit into
sarankumar1325 wants to merge 1 commit into
Conversation
function-kro pins kro v0.9.2, but the vendored CEL environment was copied from v0.9.0 and never picked up the libraries upstream added since. Any expression that uses hash.sha256/hash.fnv64a/hash.md5 failed at graph build with "references unknown identifiers: [hash]", and ip(), cidr() and semver() were also unavailable. Vendor pkg/cel/library/hash.go and hash_test.go from kro v0.9.2 unchanged and register library.Hash(), k8scellib.IP(), k8scellib.CIDR() and k8scellib.SemverLib() in BaseDeclarations, so the list now matches upstream v0.9.2. Add environment tests for the new functions. Fixes crossplane-contrib#127 Assisted-by: Grok Bot Signed-off-by: sarankumar1325 <120080287+sarankumar1325@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of your changes
function-kro pins kro v0.9.2 in
go.mod. The vendoredkro/celpackage still has the v0.9.0 environment, though, so it is missing the CEL libraries upstream added after that. Any expression that useshash.sha256,hash.fnv64aorhash.md5fails at graph build withreferences unknown identifiers: [hash].ip(),cidr()andsemver()don't work either.This PR:
pkg/cel/library/hash.goandhash_test.gofrom kro v0.9.2 intokro/cel/library/without changes (they need no import-path fixes)library.Hash(),k8scellib.IP(),k8scellib.CIDR()andk8scellib.SemverLib()inBaseDeclarations(). The declaration list now matches upstream v0.9.2 exactly, soenvironment.godrifts less from upstream.ip,cidrandsemvercases toTestDefaultEnvironment_KubernetesLibraries, and addshash.fnv64a,hash.sha256andhash.md5toTest_CELEnvHasFunction. Both tests fail without theenvironment.gochange.Checked locally with
go build ./...,go test ./...(all packages pass) andgolangci-lint run ./kro/cel/...(0 issues).Fixes #127
I have:
AI disclosure: I made this change with help from an AI assistant (Grok Bot). I reviewed the diff and ran the tests above.