From f31811890bd4bbd455ad1001afee243e24813b75 Mon Sep 17 00:00:00 2001 From: dave vader <48764154+plyr4@users.noreply.github.com> Date: Fri, 20 Sep 2024 08:44:29 -0500 Subject: [PATCH] fix: set metadata when not provided (#1189) --- compiler/native/compile.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/compiler/native/compile.go b/compiler/native/compile.go index f73ff505e..1b630c2e0 100644 --- a/compiler/native/compile.go +++ b/compiler/native/compile.go @@ -17,6 +17,7 @@ import ( yml "gopkg.in/yaml.v3" api "github.com/go-vela/server/api/types" + "github.com/go-vela/server/internal" "github.com/go-vela/types/constants" "github.com/go-vela/types/library" "github.com/go-vela/types/pipeline" @@ -61,6 +62,11 @@ func (c *client) Compile(ctx context.Context, v interface{}) (*pipeline.Build, * event = event + ":" + action } + // populate metadata when not provided using compiler.WithMetadata + if c.metadata == nil { + c.metadata = &internal.Metadata{Database: &internal.Database{}, Queue: &internal.Queue{}, Source: &internal.Source{}, Vela: &internal.Vela{}} + } + // create the ruledata to purge steps r := &pipeline.RuleData{ Branch: c.build.GetBranch(),