github.com/secure-build/gitlab-runner@v12.5.0+incompatible/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  
    10  	"gitlab.com/gitlab-org/gitlab-runner/common"
    11  	"gitlab.com/gitlab-org/gitlab-runner/helpers/cli"
    12  	"gitlab.com/gitlab-org/gitlab-runner/log"
    13  
    14  	_ "gitlab.com/gitlab-org/gitlab-runner/cache/gcs"
    15  	_ "gitlab.com/gitlab-org/gitlab-runner/cache/s3"
    16  	_ "gitlab.com/gitlab-org/gitlab-runner/commands"
    17  	_ "gitlab.com/gitlab-org/gitlab-runner/commands/helpers"
    18  	_ "gitlab.com/gitlab-org/gitlab-runner/executors/custom"
    19  	_ "gitlab.com/gitlab-org/gitlab-runner/executors/docker"
    20  	_ "gitlab.com/gitlab-org/gitlab-runner/executors/docker/machine"
    21  	_ "gitlab.com/gitlab-org/gitlab-runner/executors/kubernetes"
    22  	_ "gitlab.com/gitlab-org/gitlab-runner/executors/parallels"
    23  	_ "gitlab.com/gitlab-org/gitlab-runner/executors/shell"
    24  	_ "gitlab.com/gitlab-org/gitlab-runner/executors/ssh"
    25  	_ "gitlab.com/gitlab-org/gitlab-runner/executors/virtualbox"
    26  	_ "gitlab.com/gitlab-org/gitlab-runner/shells"
    27  )
    28  
    29  func main() {
    30  	defer func() {
    31  		if r := recover(); r != nil {
    32  			// log panics forces exit
    33  			if _, ok := r.(*logrus.Entry); ok {
    34  				os.Exit(1)
    35  			}
    36  			panic(r)
    37  		}
    38  	}()
    39  
    40  	app := cli.NewApp()
    41  	app.Name = path.Base(os.Args[0])
    42  	app.Usage = "a GitLab Runner"
    43  	app.Version = common.AppVersion.ShortLine()
    44  	cli.VersionPrinter = common.AppVersion.Printer
    45  	app.Authors = []cli.Author{
    46  		{
    47  			Name:  "GitLab Inc.",
    48  			Email: "support@gitlab.com",
    49  		},
    50  	}
    51  	app.Commands = common.GetCommands()
    52  	app.CommandNotFound = func(context *cli.Context, command string) {
    53  		logrus.Fatalln("Command", command, "not found.")
    54  	}
    55  
    56  	cli_helpers.InitCli()
    57  	cli_helpers.LogRuntimePlatform(app)
    58  	cli_helpers.SetupCPUProfile(app)
    59  	cli_helpers.FixHOME(app)
    60  	cli_helpers.WarnOnBool(os.Args)
    61  
    62  	log.ConfigureLogging(app)
    63  
    64  	if err := app.Run(os.Args); err != nil {
    65  		logrus.Fatal(err)
    66  	}
    67  }