Skip to content

Commit f7caef3

Browse files
savitaashturechmouel
authored andcommitted
Bump CEL version to 0.12.5 and updated functions
1 parent b81079a commit f7caef3

File tree

32 files changed

+2285
-355
lines changed

32 files changed

+2285
-355
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ require (
1111
github.com/fvbommel/sortorder v1.0.1
1212
github.com/gfleury/go-bitbucket-v1 v0.0.0-20220418082332-711d7d5e805f
1313
github.com/gobwas/glob v0.2.3
14-
github.com/google/cel-go v0.11.3
14+
github.com/google/cel-go v0.12.5
1515
github.com/google/go-cmp v0.5.9
1616
github.com/google/go-github/scrape v0.0.0-20220919195828-182338c7045a
1717
github.com/google/go-github/v47 v47.1.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,8 +311,8 @@ github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Z
311311
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
312312
github.com/google/btree v1.0.1/go.mod h1:xXMiIv4Fb/0kKde4SpL7qlzvu5cMJDRkFDxJfI9uaxA=
313313
github.com/google/cel-go v0.9.0/go.mod h1:U7ayypeSkw23szu4GaQTPJGx66c20mx8JklMSxrmI1w=
314-
github.com/google/cel-go v0.11.3 h1:MnUpbcMtr/eA8vRTEYSru+fyCAgGUYLrY/49vUvphbI=
315-
github.com/google/cel-go v0.11.3/go.mod h1:Av7CU6r6X3YmcHR9GXqVDaEJYfEtSxl6wvIjUQTriCw=
314+
github.com/google/cel-go v0.12.5 h1:DmzaiSgoaqGCjtpPQWl26/gND+yRpim56H1jCVev6d8=
315+
github.com/google/cel-go v0.12.5/go.mod h1:Jk7ljRzLBhkmiAwBoUxB1sZSCVBAzkqPF25olK/iRDw=
316316
github.com/google/cel-spec v0.6.0/go.mod h1:Nwjgxy5CbjlPrtCWjeDjUyKMl8w41YBYGjsyDdqk0xA=
317317
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
318318
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=

pkg/matcher/cel.go

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,12 @@ import (
55
"fmt"
66

77
"github.com/gobwas/glob"
8-
"github.com/google/cel-go/common/types"
9-
"github.com/google/cel-go/interpreter/functions"
10-
"github.com/openshift-pipelines/pipelines-as-code/pkg/provider"
11-
exprpb "google.golang.org/genproto/googleapis/api/expr/v1alpha1"
12-
138
"github.com/google/cel-go/cel"
149
"github.com/google/cel-go/checker/decls"
10+
"github.com/google/cel-go/common/types"
1511
"github.com/google/cel-go/common/types/ref"
1612
"github.com/openshift-pipelines/pipelines-as-code/pkg/params/info"
13+
"github.com/openshift-pipelines/pipelines-as-code/pkg/provider"
1714
)
1815

1916
func celEvaluate(ctx context.Context, expr string, event *info.Event, vcx provider.Interface) (ref.Val, error) {
@@ -69,14 +66,7 @@ type celPac struct {
6966
}
7067

7168
func (t celPac) ProgramOptions() []cel.ProgramOption {
72-
return []cel.ProgramOption{
73-
cel.Functions(
74-
&functions.Overload{
75-
Operator: "pathChanged",
76-
Unary: t.pathChanged,
77-
},
78-
),
79-
}
69+
return []cel.ProgramOption{}
8070
}
8171

8272
func (t celPac) pathChanged(vals ref.Val) ref.Val {
@@ -98,12 +88,10 @@ func (t celPac) pathChanged(vals ref.Val) ref.Val {
9888
return match
9989
}
10090

101-
func (celPac) CompileOptions() []cel.EnvOption {
91+
func (t celPac) CompileOptions() []cel.EnvOption {
10292
return []cel.EnvOption{
103-
cel.Declarations(
104-
decls.NewFunction("pathChanged",
105-
decls.NewInstanceOverload("pathChanged",
106-
[]*exprpb.Type{decls.String}, decls.Bool)),
107-
),
93+
cel.Function("pathChanged",
94+
cel.MemberOverload("pathChanged", []*cel.Type{cel.StringType}, cel.BoolType,
95+
cel.UnaryBinding(t.pathChanged))),
10896
}
10997
}

vendor/github.com/google/cel-go/cel/BUILD.bazel

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)