Skip to content
Snippets Groups Projects
Select Git revision
  • main default protected
  • create-k8s-init-objects-dynamically-with-spec-patch
  • ajwalker/fix-depth
  • avonbertoldi/clean-up-ubi-images
  • 16-0-stable
  • update-and-cleanup-git-lfs-install
  • vshushlin/emply-runner-registration-token
  • fneill-move-troubleshooting-to-new-page
  • renovate/golang-1.x
  • renovate/alpine-3.x
  • 31047-don-t-use-docker-links-for-user-defined-networks
  • vshushlin/issue-templates
  • 16-1-stable
  • 16-2-stable
  • fix-job-log-collapsible-sections
  • ajwalker/upgrade-fleeting-latest
  • add-check-interval-metric
  • sh-fix-fips-shell-executor
  • avonbertoldi/29944/revisit-alpine-image-creation-2
  • kballon-main-patch-23985
  • v16.0.3
  • v16.2.1
  • v16.1.1
  • v16.2.0
  • v16.1.0
  • v16.0.2
  • v15.11.1
  • v16.0.1
  • v16.0.0
  • v15.11.0
  • v15.10.1
  • v15.10.0
  • v15.9.1
  • v15.9.0
  • v15.8.3
  • v15.8.2
  • v15.8.1
  • v15.7.4
  • v15.5.2
  • v15.8.0
40 results

main.go

Forked from GitLab.org / gitlab-runner
9376 commits behind, 2 commits ahead of the upstream repository.
main.go 1.71 KiB
package main

import (
	"os"
	"path"

	"github.com/sirupsen/logrus"
	"github.com/urfave/cli"

	"gitlab.com/gitlab-org/gitlab-runner/common"
	"gitlab.com/gitlab-org/gitlab-runner/helpers/cli"
	"gitlab.com/gitlab-org/gitlab-runner/log"

	_ "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/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/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)
		}
	}()

	app := cli.NewApp()
	app.Name = path.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: "support@gitlab.com",
		},
	}
	app.Commands = common.GetCommands()
	app.CommandNotFound = func(context *cli.Context, command string) {
		logrus.Fatalln("Command", command, "not found.")
	}

	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)
	}
}