From 29e12dd4e9278d0391e4fe3e58cb3ed0ddd12fbc Mon Sep 17 00:00:00 2001 From: davidvader Date: Thu, 19 Sep 2024 11:42:31 -0500 Subject: [PATCH] fix: set metadata when not provided --- 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(),