Skip to content

Commit 8ced243

Browse files
author
SurbhiAgarwal1
committed
fix: propagate InitCELEnvironment errors
1 parent 88706d9 commit 8ced243

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

commands/fn/render/cmdrender.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,11 @@ type Runner struct {
8686
func (r *Runner) InitDefaults() {
8787
r.RunnerOptions.InitDefaults(runneroptions.GHCRImagePrefix)
8888
// Initialize CEL environment for condition evaluation
89-
// Ignore error as conditions are optional; if CEL init fails, conditions will error at runtime
90-
_ = r.RunnerOptions.InitCELEnvironment()
89+
// Fail early if initialization does not succeed because we might
90+
// need CEL to evaluate conditions
91+
if err := r.RunnerOptions.InitCELEnvironment(); err != nil {
92+
fmt.Fprintf(os.Stderr, "failed to initialize CEL environment: %v\n", err)
93+
}
9194
}
9295

9396
func (r *Runner) preRunE(_ *cobra.Command, args []string) error {

thirdparty/cmdconfig/commands/cmdeval/cmdeval.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,11 @@ type EvalFnRunner struct {
171171
func (r *EvalFnRunner) InitDefaults() {
172172
r.RunnerOptions.InitDefaults(runneroptions.GHCRImagePrefix)
173173
// Initialize CEL environment for condition evaluation
174-
// Ignore error as conditions are optional; if CEL init fails, conditions will error at runtime
175-
_ = r.RunnerOptions.InitCELEnvironment()
174+
// Fail early if initialization does not succeed because we might
175+
// need CEL to evaluate conditions
176+
if err := r.RunnerOptions.InitCELEnvironment(); err != nil {
177+
fmt.Fprintf(os.Stderr, "failed to initialize CEL environment: %v\n", err)
178+
}
176179
}
177180

178181
func (r *EvalFnRunner) runE(c *cobra.Command, _ []string) error {

0 commit comments

Comments
 (0)