Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion action/dashboard/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (c *Config) View(ctx context.Context, client *vela.Client) error {
return err
}

func outputDashboard(dashboard interface{}, c *Config) error {
func outputDashboard(dashboard any, c *Config) error {
// handle the output based off the provided configuration
switch c.Output {
case output.DriverDump:
Expand Down
31 changes: 16 additions & 15 deletions action/repo/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,22 @@ func (c *Config) Add(ctx context.Context, client *vela.Client) error {
//
// https://pkg.go.dev/github.com/go-vela/server/api/types?tab=doc#Repo
r := &api.Repo{
Org: vela.String(c.Org),
Name: vela.String(c.Name),
FullName: vela.String(fmt.Sprintf("%s/%s", c.Org, c.Name)),
Link: vela.String(c.Link),
Clone: vela.String(c.Clone),
Branch: vela.String(c.Branch),
BuildLimit: vela.Int32(c.BuildLimit),
Timeout: vela.Int32(c.Timeout),
Counter: vela.Int64(c.Counter),
Visibility: vela.String(c.Visibility),
Private: vela.Bool(c.Private),
Trusted: vela.Bool(c.Trusted),
Active: vela.Bool(c.Active),
PipelineType: vela.String(c.PipelineType),
ApproveBuild: vela.String(c.ApproveBuild),
Org: vela.String(c.Org),
Name: vela.String(c.Name),
FullName: vela.String(fmt.Sprintf("%s/%s", c.Org, c.Name)),
Link: vela.String(c.Link),
Clone: vela.String(c.Clone),
Branch: vela.String(c.Branch),
BuildLimit: vela.Int32(c.BuildLimit),
Timeout: vela.Int32(c.Timeout),
Counter: vela.Int64(c.Counter),
Visibility: vela.String(c.Visibility),
Private: vela.Bool(c.Private),
Trusted: vela.Bool(c.Trusted),
Active: vela.Bool(c.Active),
PipelineType: vela.String(c.PipelineType),
ApproveBuild: vela.String(c.ApproveBuild),
MergeQueueEvents: vela.Strings(c.MergeQueueEvents),
}

logrus.Tracef("adding repo %s/%s", c.Org, c.Name)
Expand Down
41 changes: 21 additions & 20 deletions action/repo/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,25 @@ import "github.com/go-vela/cli/internal/output"
// Config represents the configuration necessary
// to perform repository related requests with Vela.
type Config struct {
Action string
Org string
Name string
Branch string
Link string
Clone string
Visibility string
BuildLimit int32
Timeout int32
Counter int64
Private bool
Trusted bool
Active bool
Events []string
PipelineType string
ApproveBuild string
Page int
PerPage int
Output string
Color output.ColorOptions
Action string
Org string
Name string
Branch string
Link string
Clone string
Visibility string
BuildLimit int32
Timeout int32
Counter int64
Private bool
Trusted bool
Active bool
Events []string
MergeQueueEvents []string
PipelineType string
ApproveBuild string
Page int
PerPage int
Output string
Color output.ColorOptions
}
31 changes: 16 additions & 15 deletions action/repo/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,22 @@ func (c *Config) Update(ctx context.Context, client *vela.Client) error {
//
// https://pkg.go.dev/github.com/go-vela/server/api/types?tab=doc#Repo
r := &api.Repo{
Org: vela.String(c.Org),
Name: vela.String(c.Name),
FullName: vela.String(fmt.Sprintf("%s/%s", c.Org, c.Name)),
Link: vela.String(c.Link),
Clone: vela.String(c.Clone),
Branch: vela.String(c.Branch),
BuildLimit: vela.Int32(c.BuildLimit),
Timeout: vela.Int32(c.Timeout),
Counter: vela.Int64(c.Counter),
Visibility: vela.String(c.Visibility),
Private: vela.Bool(c.Private),
Trusted: vela.Bool(c.Trusted),
Active: vela.Bool(c.Active),
PipelineType: vela.String(c.PipelineType),
ApproveBuild: vela.String(c.ApproveBuild),
Org: vela.String(c.Org),
Name: vela.String(c.Name),
FullName: vela.String(fmt.Sprintf("%s/%s", c.Org, c.Name)),
Link: vela.String(c.Link),
Clone: vela.String(c.Clone),
Branch: vela.String(c.Branch),
BuildLimit: vela.Int32(c.BuildLimit),
Timeout: vela.Int32(c.Timeout),
Counter: vela.Int64(c.Counter),
Visibility: vela.String(c.Visibility),
Private: vela.Bool(c.Private),
Trusted: vela.Bool(c.Trusted),
Active: vela.Bool(c.Active),
PipelineType: vela.String(c.PipelineType),
ApproveBuild: vela.String(c.ApproveBuild),
MergeQueueEvents: vela.Strings(c.MergeQueueEvents),
}

if len(c.Events) > 0 {
Expand Down
4 changes: 2 additions & 2 deletions action/secret/secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ func (c *Config) setValue() error {

// check if the '@' character was provided signaling
// we should capture the value from a file
if strings.HasPrefix(c.Value, "@") {
if after, ok := strings.CutPrefix(c.Value, "@"); ok {
// capture the original path to the file by trimming the '@' character
path := strings.TrimPrefix(c.Value, "@")
path := after

logrus.Tracef("reading contents from %s", path)

Expand Down
43 changes: 25 additions & 18 deletions command/repo/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@ var CommandAdd = &cli.Command{
Aliases: []string{"events", "e"},
Usage: "webhook event(s) repository responds to",
},
&cli.StringSliceFlag{
Sources: cli.EnvVars("VELA_MERGE_QUEUE_EVENTS", "REPO_MERGE_QUEUE_EVENTS"),
Name: "merge-queue-event",
Aliases: []string{"merge-queue-events", "mqe"},
Usage: "event status contexts for merge queue to report to",
},
&cli.StringFlag{
Sources: cli.EnvVars("VELA_PIPELINE_TYPE", "PIPELINE_TYPE"),
Name: "pipeline-type",
Expand Down Expand Up @@ -177,24 +183,25 @@ func add(ctx context.Context, c *cli.Command) error {
//
// https://pkg.go.dev/github.com/go-vela/cli/action/repo?tab=doc#Config
r := &repo.Config{
Action: internal.ActionAdd,
Org: c.String(internal.FlagOrg),
Name: c.String(internal.FlagRepo),
Branch: c.String("branch"),
Link: c.String("link"),
Clone: c.String("clone"),
Visibility: c.String("visibility"),
BuildLimit: c.Int32("build.limit"),
Timeout: c.Int32("timeout"),
Counter: c.Int64("counter"),
Private: internal.StringToBool(c.String("private")),
Trusted: internal.StringToBool(c.String("trusted")),
Active: internal.StringToBool(c.String("active")),
Events: c.StringSlice("event"),
PipelineType: c.String("pipeline-type"),
ApproveBuild: c.String("approve-build"),
Output: c.String(internal.FlagOutput),
Color: output.ColorOptionsFromCLIContext(c),
Action: internal.ActionAdd,
Org: c.String(internal.FlagOrg),
Name: c.String(internal.FlagRepo),
Branch: c.String("branch"),
Link: c.String("link"),
Clone: c.String("clone"),
Visibility: c.String("visibility"),
BuildLimit: c.Int32("build.limit"),
Timeout: c.Int32("timeout"),
Counter: c.Int64("counter"),
Private: internal.StringToBool(c.String("private")),
Trusted: internal.StringToBool(c.String("trusted")),
Active: internal.StringToBool(c.String("active")),
Events: c.StringSlice("event"),
MergeQueueEvents: c.StringSlice("merge-queue-event"),
PipelineType: c.String("pipeline-type"),
ApproveBuild: c.String("approve-build"),
Output: c.String(internal.FlagOutput),
Color: output.ColorOptionsFromCLIContext(c),
}

// validate repo configuration
Expand Down
43 changes: 25 additions & 18 deletions command/repo/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@ var CommandUpdate = &cli.Command{
Aliases: []string{"events", "e"},
Usage: "webhook event(s) repository responds to",
},
&cli.StringSliceFlag{
Sources: cli.EnvVars("VELA_MERGE_QUEUE_EVENTS", "REPO_MERGE_QUEUE_EVENTS"),
Name: "merge-queue-event",
Aliases: []string{"merge-queue-events", "mqe"},
Usage: "event status contexts for merge queue to report to",
},
&cli.StringFlag{
Sources: cli.EnvVars("VELA_PIPELINE_TYPE", "PIPELINE_TYPE"),
Name: "pipeline-type",
Expand Down Expand Up @@ -175,24 +181,25 @@ func update(ctx context.Context, c *cli.Command) error {
//
// https://pkg.go.dev/github.com/go-vela/cli/action/repo?tab=doc#Config
r := &repo.Config{
Action: internal.ActionUpdate,
Org: c.String(internal.FlagOrg),
Name: c.String(internal.FlagRepo),
Branch: c.String("branch"),
Link: c.String("link"),
Clone: c.String("clone"),
Visibility: c.String("visibility"),
BuildLimit: c.Int32("build.limit"),
Timeout: c.Int32("timeout"),
Counter: c.Int64("counter"),
Private: internal.StringToBool(c.String("private")),
Trusted: internal.StringToBool(c.String("trusted")),
Active: internal.StringToBool(c.String("active")),
Events: c.StringSlice("event"),
PipelineType: c.String("pipeline-type"),
ApproveBuild: c.String("approve-build"),
Output: c.String(internal.FlagOutput),
Color: output.ColorOptionsFromCLIContext(c),
Action: internal.ActionUpdate,
Org: c.String(internal.FlagOrg),
Name: c.String(internal.FlagRepo),
Branch: c.String("branch"),
Link: c.String("link"),
Clone: c.String("clone"),
Visibility: c.String("visibility"),
BuildLimit: c.Int32("build.limit"),
Timeout: c.Int32("timeout"),
Counter: c.Int64("counter"),
Private: internal.StringToBool(c.String("private")),
Trusted: internal.StringToBool(c.String("trusted")),
Active: internal.StringToBool(c.String("active")),
Events: c.StringSlice("event"),
MergeQueueEvents: c.StringSlice("merge-queue-event"),
PipelineType: c.String("pipeline-type"),
ApproveBuild: c.String("approve-build"),
Output: c.String(internal.FlagOutput),
Color: output.ColorOptionsFromCLIContext(c),
}

// validate repo configuration
Expand Down
Loading
Loading