github.com/secure-build/gitlab-runner@v12.5.0+incompatible/helpers/cli/runtime_platform.go (about)

     1  package cli_helpers
     2  
     3  import (
     4  	"os"
     5  	"runtime"
     6  
     7  	"github.com/sirupsen/logrus"
     8  	"github.com/urfave/cli"
     9  
    10  	"gitlab.com/gitlab-org/gitlab-runner/common"
    11  )
    12  
    13  func LogRuntimePlatform(app *cli.App) {
    14  	appBefore := app.Before
    15  	app.Before = func(c *cli.Context) error {
    16  		fields := logrus.Fields{
    17  			"os":       runtime.GOOS,
    18  			"arch":     runtime.GOARCH,
    19  			"version":  common.VERSION,
    20  			"revision": common.REVISION,
    21  			"pid":      os.Getpid(),
    22  		}
    23  
    24  		logrus.WithFields(fields).Info("Runtime platform")
    25  
    26  		if appBefore != nil {
    27  			return appBefore(c)
    28  		}
    29  		return nil
    30  	}
    31  
    32  }