diff --git a/compiler/native/compile.go b/compiler/native/compile.go index a525a53f8..088dbca15 100644 --- a/compiler/native/compile.go +++ b/compiler/native/compile.go @@ -20,7 +20,6 @@ import ( "github.com/go-vela/server/compiler/types/pipeline" "github.com/go-vela/server/compiler/types/raw" "github.com/go-vela/server/compiler/types/yaml" - "github.com/go-vela/server/internal" "github.com/go-vela/types/constants" ) @@ -61,22 +60,21 @@ 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(), - Comment: c.comment, - Event: event, - Path: c.files, - Repo: c.repo.GetFullName(), - Tag: strings.TrimPrefix(c.build.GetRef(), "refs/tags/"), - Target: c.build.GetDeploy(), - Label: c.labels, - Instance: c.metadata.Vela.Address, + Branch: c.build.GetBranch(), + Comment: c.comment, + Event: event, + Path: c.files, + Repo: c.repo.GetFullName(), + Tag: strings.TrimPrefix(c.build.GetRef(), "refs/tags/"), + Target: c.build.GetDeploy(), + Label: c.labels, + } + + // add instance when we have the metadata (local exec will not) + if c.metadata != nil && c.metadata.Vela != nil { + r.Instance = c.metadata.Vela.Address } switch {