| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 1ec8679 commit d9b01db
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -30,6 +30,13 @@ func (f *Function) RunFunction(_ context.Context, req *fnv1.RunFunctionRequest) | |||
| 30 | 30 | f.log.Info("Running function", "tag", req.GetMeta().GetTag()) | |
| 31 | 31 | ||
| 32 | 32 | rsp := response.To(req, response.DefaultTTL) | |
| 33 | + fctx := req.GetContext() | ||
| 34 | + if len(fctx.AsMap()) == 0 { | ||
| 35 | + // init map | ||
| 36 | + fctx.Fields = make(map[string]*structpb.Value) | ||
| 37 | + } | ||
| 38 | + fctx.Fields["ops.upbound.io/ignored-resource"] = structpb.NewBoolValue(true) | ||
| 39 | + rsp.Context = fctx | ||
| 33 | 40 | ||
| 34 | 41 | in := &v1alpha1.Input{} | |
| 35 | 42 | if err := request.GetInput(req, in); err != nil { | |
@@ -80,13 +87,6 @@ func (f *Function) RunFunction(_ context.Context, req *fnv1.RunFunctionRequest) | |||
| 80 | 87 | ||
| 81 | 88 | if !match(in, e) { | |
| 82 | 89 | f.log.Info("doesn't match", "event", fmt.Sprintf("%+v", e)) | |
| 83 | - fctx := req.GetContext() | ||
| 84 | - if len(fctx.AsMap()) == 0 { | ||
| 85 | - // init map | ||
| 86 | - fctx.Fields = make(map[string]*structpb.Value) | ||
| 87 | - } | ||
| 88 | - fctx.Fields["ops.upbound.io/ignored-resource"] = structpb.NewBoolValue(true) | ||
| 89 | - rsp.Context = fctx | ||
| 90 | 90 | ||
| 91 | 91 | response.ConditionTrue(rsp, "FunctionSuccess", "Success").TargetCompositeAndClaim() | |
| 92 | 92 | response.Normal(rsp, fmt.Sprintf("not interested in the given event %s, skipping", types.NamespacedName{Name: e.GetName(), Namespace: e.GetNamespace()})) | |
@@ -99,6 +99,10 @@ func (f *Function) RunFunction(_ context.Context, req *fnv1.RunFunctionRequest) | |||
| 99 | 99 | response.ConditionTrue(rsp, "FunctionSuccess", "Success").TargetCompositeAndClaim() | |
| 100 | 100 | response.Normal(rsp, "passing along given event") | |
| 101 | 101 | f.log.Info("matches", "event", fmt.Sprintf("%+v", e)) | |
| 102 | + | ||
| 103 | + fctx.Fields["ops.upbound.io/ignored-resource"] = structpb.NewBoolValue(false) | ||
| 104 | + rsp.Context = fctx | ||
| 105 | + | ||
| 102 | 106 | return rsp, nil | |
| 103 | 107 | } | |
| 104 | 108 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments