list.go 759 Bytes
Newer Older
1 2 3
package commands

import (
4
	"github.com/sirupsen/logrus"
5
	"github.com/urfave/cli"
6

7
	"gitlab.com/gitlab-org/gitlab-runner/common"
8 9 10 11 12 13 14 15 16
)

type ListCommand struct {
	configOptions
}

func (c *ListCommand) Execute(context *cli.Context) {
	err := c.loadConfig()
	if err != nil {
17
		logrus.Warningln(err)
18 19 20
		return
	}

21
	logrus.WithFields(logrus.Fields{
22 23 24 25
		"ConfigFile": c.ConfigFile,
	}).Println("Listing configured runners")

	for _, runner := range c.config.Runners {
26
		logrus.WithFields(logrus.Fields{
27 28 29 30 31 32 33 34 35 36
			"Executor": runner.RunnerSettings.Executor,
			"Token":    runner.RunnerCredentials.Token,
			"URL":      runner.RunnerCredentials.URL,
		}).Println(runner.Name)
	}
}

func init() {
	common.RegisterCommand2("list", "List all configured runners", &ListCommand{})
}