github.com/alloyci/alloy-runner@v1.0.1-0.20180222164613-925503ccafd6/main.go (about) 1 package main 2 3 import ( 4 "os" 5 "path" 6 7 "github.com/Sirupsen/logrus" 8 "github.com/urfave/cli" 9 "gitlab.com/gitlab-org/gitlab-runner/common" 10 "gitlab.com/gitlab-org/gitlab-runner/helpers/cli" 11 "gitlab.com/gitlab-org/gitlab-runner/helpers/formatter" 12 13 _ "gitlab.com/gitlab-org/gitlab-runner/commands" 14 _ "gitlab.com/gitlab-org/gitlab-runner/commands/helpers" 15 _ "gitlab.com/gitlab-org/gitlab-runner/executors/docker" 16 _ "gitlab.com/gitlab-org/gitlab-runner/executors/docker/machine" 17 _ "gitlab.com/gitlab-org/gitlab-runner/executors/kubernetes" 18 _ "gitlab.com/gitlab-org/gitlab-runner/executors/parallels" 19 _ "gitlab.com/gitlab-org/gitlab-runner/executors/shell" 20 _ "gitlab.com/gitlab-org/gitlab-runner/executors/ssh" 21 _ "gitlab.com/gitlab-org/gitlab-runner/executors/virtualbox" 22 _ "gitlab.com/gitlab-org/gitlab-runner/shells" 23 ) 24 25 func main() { 26 defer func() { 27 if r := recover(); r != nil { 28 // log panics forces exit 29 if _, ok := r.(*logrus.Entry); ok { 30 os.Exit(1) 31 } 32 panic(r) 33 } 34 }() 35 36 formatter.SetRunnerFormatter() 37 38 app := cli.NewApp() 39 app.Name = path.Base(os.Args[0]) 40 app.Usage = "an Alloy Runner" 41 app.Version = common.AppVersion.ShortLine() 42 cli.VersionPrinter = common.AppVersion.Printer 43 app.Authors = []cli.Author{ 44 { 45 Name: "Patricio Cano", 46 Email: "admin@alloy-ci.com", 47 }, 48 } 49 cli_helpers.LogRuntimePlatform(app) 50 cli_helpers.SetupLogLevelOptions(app) 51 cli_helpers.SetupCPUProfile(app) 52 cli_helpers.FixHOME(app) 53 app.Commands = common.GetCommands() 54 app.CommandNotFound = func(context *cli.Context, command string) { 55 logrus.Fatalln("Command", command, "not found.") 56 } 57 58 if err := app.Run(os.Args); err != nil { 59 logrus.Fatal(err) 60 } 61 }