forked from gitlabhq/gitlab-runner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
72 lines (62 loc) · 2 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package main
import (
"os"
"path/filepath"
"github.com/sirupsen/logrus"
"github.com/urfave/cli"
"gitlab.com/gitlab-org/gitlab-runner/boring"
"gitlab.com/gitlab-org/gitlab-runner/common"
cli_helpers "gitlab.com/gitlab-org/gitlab-runner/helpers/cli"
"gitlab.com/gitlab-org/gitlab-runner/log"
_ "gitlab.com/gitlab-org/gitlab-runner/cache/azure"
_ "gitlab.com/gitlab-org/gitlab-runner/cache/gcs"
_ "gitlab.com/gitlab-org/gitlab-runner/cache/s3"
_ "gitlab.com/gitlab-org/gitlab-runner/commands"
_ "gitlab.com/gitlab-org/gitlab-runner/commands/helpers"
_ "gitlab.com/gitlab-org/gitlab-runner/executors/custom"
_ "gitlab.com/gitlab-org/gitlab-runner/executors/docker"
_ "gitlab.com/gitlab-org/gitlab-runner/executors/docker/machine"
_ "gitlab.com/gitlab-org/gitlab-runner/executors/kubernetes"
_ "gitlab.com/gitlab-org/gitlab-runner/executors/parallels"
_ "gitlab.com/gitlab-org/gitlab-runner/executors/shell"
_ "gitlab.com/gitlab-org/gitlab-runner/executors/ssh"
_ "gitlab.com/gitlab-org/gitlab-runner/executors/virtualbox"
_ "gitlab.com/gitlab-org/gitlab-runner/helpers/secrets/resolvers/vault"
_ "gitlab.com/gitlab-org/gitlab-runner/shells"
)
func main() {
defer func() {
if r := recover(); r != nil {
// log panics forces exit
if _, ok := r.(*logrus.Entry); ok {
os.Exit(1)
}
panic(r)
}
}()
boring.CheckBoring()
app := cli.NewApp()
app.Name = filepath.Base(os.Args[0])
app.Usage = "a GitLab Runner"
app.Version = common.AppVersion.ShortLine()
cli.VersionPrinter = common.AppVersion.Printer
app.Authors = []cli.Author{
{
Name: "GitLab Inc.",
Email: "[email protected]",
},
}
app.Commands = common.GetCommands()
app.CommandNotFound = func(context *cli.Context, command string) {
logrus.Fatalln("Command", command, "not found.")
}
cli_helpers.InitCli()
cli_helpers.LogRuntimePlatform(app)
cli_helpers.SetupCPUProfile(app)
cli_helpers.FixHOME(app)
cli_helpers.WarnOnBool(os.Args)
log.ConfigureLogging(app)
if err := app.Run(os.Args); err != nil {
logrus.Fatal(err)
}
}