Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: set metadata when not provided #1189

Merged
merged 2 commits into from
Sep 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions compiler/native/compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
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"
Expand Down Expand Up @@ -61,6 +62,11 @@
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(),
Expand Down Expand Up @@ -326,7 +332,7 @@

if c.ModificationService.Endpoint != "" {
// send config to external endpoint for modification
p, err = c.modifyConfig(p, c.build, c.repo)

Check failure on line 335 in compiler/native/compile.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] compiler/native/compile.go#L335

Function `modifyConfig` should pass the context parameter (contextcheck)
Raw output
compiler/native/compile.go:335:26: Function `modifyConfig` should pass the context parameter (contextcheck)
		p, err = c.modifyConfig(p, c.build, c.repo)
		                       ^
if err != nil {
return nil, _pipeline, err
}
Expand Down Expand Up @@ -421,7 +427,7 @@

if c.ModificationService.Endpoint != "" {
// send config to external endpoint for modification
p, err = c.modifyConfig(p, c.build, c.repo)

Check failure on line 430 in compiler/native/compile.go

View workflow job for this annotation

GitHub Actions / golangci

[golangci] compiler/native/compile.go#L430

Function `modifyConfig` should pass the context parameter (contextcheck)
Raw output
compiler/native/compile.go:430:26: Function `modifyConfig` should pass the context parameter (contextcheck)
		p, err = c.modifyConfig(p, c.build, c.repo)
		                       ^
if err != nil {
return nil, _pipeline, err
}
Expand Down
Loading