*: rename user local run to user direct run

This commit is contained in:
Simone Gotti 2019-06-11 12:09:57 +02:00
parent 98c2f76f5d
commit cff6b8d531
4 changed files with 24 additions and 24 deletions

View File

@ -18,11 +18,11 @@ import (
"github.com/spf13/cobra"
)
var cmdLocalRun = &cobra.Command{
Use: "localrun",
Short: "localrun",
var cmdDirectRun = &cobra.Command{
Use: "directrun",
Short: "directrun",
}
func init() {
cmdAgola.AddCommand(cmdLocalRun)
cmdAgola.AddCommand(cmdDirectRun)
}

View File

@ -25,17 +25,17 @@ import (
"github.com/spf13/cobra"
)
var cmdLocalRunStart = &cobra.Command{
var cmdDirectRunStart = &cobra.Command{
Use: "start",
Run: func(cmd *cobra.Command, args []string) {
if err := localRunStart(cmd, args); err != nil {
if err := directRunStart(cmd, args); err != nil {
log.Fatalf("err: %v", err)
}
},
Short: "executes a run from a local repository",
Short: "executes a run from a local git repository",
}
type localRunStartOptions struct {
type directRunStartOptions struct {
statusFilter []string
labelFilter []string
limit int
@ -44,22 +44,22 @@ type localRunStartOptions struct {
ignored bool
}
var localRunStartOpts localRunStartOptions
var directRunStartOpts directRunStartOptions
func init() {
flags := cmdLocalRunStart.PersistentFlags()
flags := cmdDirectRunStart.PersistentFlags()
flags.StringSliceVarP(&localRunStartOpts.statusFilter, "status", "s", nil, "filter runs matching the provided status. This option can be repeated multiple times")
flags.StringArrayVarP(&localRunStartOpts.labelFilter, "label", "l", nil, "filter runs matching the provided label. This option can be repeated multiple times, in this case only runs matching all the labels will be returned")
flags.IntVar(&localRunStartOpts.limit, "limit", 10, "max number of runs to show")
flags.StringVar(&localRunStartOpts.start, "start", "", "starting run id (excluded) to fetch")
flags.BoolVar(&localRunStartOpts.untracked, "untracked", true, "push untracked files")
flags.BoolVar(&localRunStartOpts.ignored, "ignored", false, "push ignored files")
flags.StringSliceVarP(&directRunStartOpts.statusFilter, "status", "s", nil, "filter runs matching the provided status. This option can be repeated multiple times")
flags.StringArrayVarP(&directRunStartOpts.labelFilter, "label", "l", nil, "filter runs matching the provided label. This option can be repeated multiple times, in this case only runs matching all the labels will be returned")
flags.IntVar(&directRunStartOpts.limit, "limit", 10, "max number of runs to show")
flags.StringVar(&directRunStartOpts.start, "start", "", "starting run id (excluded) to fetch")
flags.BoolVar(&directRunStartOpts.untracked, "untracked", true, "push untracked files")
flags.BoolVar(&directRunStartOpts.ignored, "ignored", false, "push ignored files")
cmdLocalRun.AddCommand(cmdLocalRunStart)
cmdDirectRun.AddCommand(cmdDirectRunStart)
}
func localRunStart(cmd *cobra.Command, args []string) error {
func directRunStart(cmd *cobra.Command, args []string) error {
gwclient := api.NewClient(gatewayURL, token)
user, _, err := gwclient.GetCurrentUser(context.TODO())
@ -68,13 +68,13 @@ func localRunStart(cmd *cobra.Command, args []string) error {
}
gs := gitsave.NewGitSave(logger, &gitsave.GitSaveConfig{
AddUntracked: localRunStartOpts.untracked,
AddIgnored: localRunStartOpts.ignored,
AddUntracked: directRunStartOpts.untracked,
AddIgnored: directRunStartOpts.ignored,
})
branch := "gitsavebranch-" + uuid.NewV4().String()
if err := gs.Save("agola local run", branch); err != nil {
if err := gs.Save("agola direct run", branch); err != nil {
log.Fatalf("err: %v", err)
}

View File

@ -188,7 +188,7 @@ func (h *ActionHandler) CanGetRun(ctx context.Context, runGroup string) (bool, e
ownerID = p.OwnerID
visibility = p.GlobalVisibility
case common.GroupTypeUser:
// user local runs
// user direct runs
ownerType = types.ConfigTypeUser
ownerID = groupID
visibility = types.VisibilityPrivate
@ -224,7 +224,7 @@ func (h *ActionHandler) CanDoRunActions(ctx context.Context, runGroup string) (b
ownerType = p.OwnerType
ownerID = p.OwnerID
case common.GroupTypeUser:
// user local runs
// user direct runs
ownerType = types.ConfigTypeUser
ownerID = groupID
}

View File

@ -62,7 +62,7 @@ func (n *NotificationService) updateCommitStatus(ctx context.Context, ev *rstype
return err
}
// ignore user local runs
// ignore user direct runs
if groupType == common.GroupTypeUser {
return nil
}