Remove unnecessary log alias for logrus inport

Some time ago [we had a discussion](!934 (comment 91891281))
about why we're aliasing some of the imports of `github.com/sirupsen/logrus`
package with a `log` alias.

At that moment we've been doing that in 17 from 68 cases when logrus
was imported in Runners codebase.

The conclusion was this aliasing is unnecessary, because:
- we relay on logrus interface so much that moving to another logging
  library will be not so simple as switching the import name;
- we're totally not consistent in the alias usage which makes the code
  even more messy.

Three GitLab Runner maintainers agreeded hat there is no reason to use
the aliasing and that we should just use `logrus` everywhere.

But no action was don since then. The cleanup was left for a future.

Unfortunately, because GitLab Runner is one of our biggest projects in
Go, for some people it becomes a source of suggestions of how certain
things should be handled. For example here is a discussion in a new
project that creates a go-based tool for our Serverless integration:

gitlabktl!9 (comment 152472275)

The most important statement is:

> perhaps we could leave it as is since it is how we are exposing
  logrus in the runner project

Because we already know that it should be changed and others start to
look on Runner's code to find good patterns, let's finally cleanup
the `log` aliasing mess.
parent 11926882
Pipeline #53045768 passed with stages
in 50 minutes and 23 seconds
package commands package commands
import ( import (
log "github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"github.com/urfave/cli" "github.com/urfave/cli"
"gitlab.com/gitlab-org/gitlab-runner/common" "gitlab.com/gitlab-org/gitlab-runner/common"
) )
...@@ -13,16 +14,16 @@ type ListCommand struct { ...@@ -13,16 +14,16 @@ type ListCommand struct {
func (c *ListCommand) Execute(context *cli.Context) { func (c *ListCommand) Execute(context *cli.Context) {
err := c.loadConfig() err := c.loadConfig()
if err != nil { if err != nil {
log.Warningln(err) logrus.Warningln(err)
return return
} }
log.WithFields(log.Fields{ logrus.WithFields(logrus.Fields{
"ConfigFile": c.ConfigFile, "ConfigFile": c.ConfigFile,
}).Println("Listing configured runners") }).Println("Listing configured runners")
for _, runner := range c.config.Runners { for _, runner := range c.config.Runners {
log.WithFields(log.Fields{ logrus.WithFields(logrus.Fields{
"Executor": runner.RunnerSettings.Executor, "Executor": runner.RunnerSettings.Executor,
"Token": runner.RunnerCredentials.Token, "Token": runner.RunnerCredentials.Token,
"URL": runner.RunnerCredentials.URL, "URL": runner.RunnerCredentials.URL,
......
...@@ -6,7 +6,7 @@ import ( ...@@ -6,7 +6,7 @@ import (
"os/signal" "os/signal"
"strings" "strings"
log "github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"github.com/urfave/cli" "github.com/urfave/cli"
"gitlab.com/gitlab-org/gitlab-runner/common" "gitlab.com/gitlab-org/gitlab-runner/common"
...@@ -69,7 +69,7 @@ func (s *RegisterCommand) ask(key, prompt string, allowEmptyOptional ...bool) st ...@@ -69,7 +69,7 @@ func (s *RegisterCommand) ask(key, prompt string, allowEmptyOptional ...bool) st
if s.NonInteractive || prompt == "" { if s.NonInteractive || prompt == "" {
if result == "" && !allowEmpty { if result == "" && !allowEmpty {
log.Panicln("The", key, "needs to be entered") logrus.Panicln("The", key, "needs to be entered")
} }
return result return result
} }
...@@ -94,9 +94,9 @@ func (s *RegisterCommand) askExecutor() { ...@@ -94,9 +94,9 @@ func (s *RegisterCommand) askExecutor() {
message := "Invalid executor specified" message := "Invalid executor specified"
if s.NonInteractive { if s.NonInteractive {
log.Panicln(message) logrus.Panicln(message)
} else { } else {
log.Errorln(message) logrus.Errorln(message)
} }
} }
} }
...@@ -143,10 +143,10 @@ func (s *RegisterCommand) askRunner() { ...@@ -143,10 +143,10 @@ func (s *RegisterCommand) askRunner() {
s.URL = s.ask("url", "Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com/):") s.URL = s.ask("url", "Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com/):")
if s.Token != "" { if s.Token != "" {
log.Infoln("Token specified trying to verify runner...") logrus.Infoln("Token specified trying to verify runner...")
log.Warningln("If you want to register use the '-r' instead of '-t'.") logrus.Warningln("If you want to register use the '-r' instead of '-t'.")
if !s.network.VerifyRunner(s.RunnerCredentials) { if !s.network.VerifyRunner(s.RunnerCredentials) {
log.Panicln("Failed to verify this runner. Perhaps you are having network problems") logrus.Panicln("Failed to verify this runner. Perhaps you are having network problems")
} }
} else { } else {
// we store registration token as token, since we pass that to RunnerCredentials // we store registration token as token, since we pass that to RunnerCredentials
...@@ -169,7 +169,7 @@ func (s *RegisterCommand) askRunner() { ...@@ -169,7 +169,7 @@ func (s *RegisterCommand) askRunner() {
result := s.network.RegisterRunner(s.RunnerCredentials, parameters) result := s.network.RegisterRunner(s.RunnerCredentials, parameters)
if result == nil { if result == nil {
log.Panicln("Failed to register this runner. Perhaps you are having network problems") logrus.Panicln("Failed to register this runner. Perhaps you are having network problems")
} }
s.Token = result.Token s.Token = result.Token
...@@ -275,7 +275,7 @@ func (s *RegisterCommand) Execute(context *cli.Context) { ...@@ -275,7 +275,7 @@ func (s *RegisterCommand) Execute(context *cli.Context) {
s.context = context s.context = context
err := s.loadConfig() err := s.loadConfig()
if err != nil { if err != nil {
log.Panicln(err) logrus.Panicln(err)
} }
s.askRunner() s.askRunner()
...@@ -298,12 +298,12 @@ func (s *RegisterCommand) Execute(context *cli.Context) { ...@@ -298,12 +298,12 @@ func (s *RegisterCommand) Execute(context *cli.Context) {
go func() { go func() {
signal := <-signals signal := <-signals
s.network.UnregisterRunner(s.RunnerCredentials) s.network.UnregisterRunner(s.RunnerCredentials)
log.Fatalf("RECEIVED SIGNAL: %v", signal) logrus.Fatalf("RECEIVED SIGNAL: %v", signal)
}() }()
} }
if s.config.Concurrent < s.Limit { if s.config.Concurrent < s.Limit {
log.Warningf("Specified limit (%d) larger then current concurrent limit (%d). Concurrent limit will not be enlarged.", s.Limit, s.config.Concurrent) logrus.Warningf("Specified limit (%d) larger then current concurrent limit (%d). Concurrent limit will not be enlarged.", s.Limit, s.config.Concurrent)
} }
s.askExecutor() s.askExecutor()
...@@ -312,7 +312,7 @@ func (s *RegisterCommand) Execute(context *cli.Context) { ...@@ -312,7 +312,7 @@ func (s *RegisterCommand) Execute(context *cli.Context) {
s.prepareCache() s.prepareCache()
s.saveConfig() s.saveConfig()
log.Printf("Runner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded!") logrus.Printf("Runner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded!")
} }
func getHostname() string { func getHostname() string {
......
...@@ -6,7 +6,7 @@ import ( ...@@ -6,7 +6,7 @@ import (
"syscall" "syscall"
"time" "time"
log "github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"github.com/tevino/abool" "github.com/tevino/abool"
"github.com/urfave/cli" "github.com/urfave/cli"
...@@ -38,11 +38,11 @@ func waitForInterrupts(finished *abool.AtomicBool, abortSignal chan os.Signal, d ...@@ -38,11 +38,11 @@ func waitForInterrupts(finished *abool.AtomicBool, abortSignal chan os.Signal, d
// request stop, but wait for force exit // request stop, but wait for force exit
for interrupt == syscall.SIGQUIT { for interrupt == syscall.SIGQUIT {
log.Warningln("Requested quit, waiting for builds to finish") logrus.Warningln("Requested quit, waiting for builds to finish")
interrupt = <-interruptSignals interrupt = <-interruptSignals
} }
log.Warningln("Requested exit:", interrupt) logrus.Warningln("Requested exit:", interrupt)
go func() { go func() {
for { for {
...@@ -52,9 +52,9 @@ func waitForInterrupts(finished *abool.AtomicBool, abortSignal chan os.Signal, d ...@@ -52,9 +52,9 @@ func waitForInterrupts(finished *abool.AtomicBool, abortSignal chan os.Signal, d
select { select {
case newSignal := <-interruptSignals: case newSignal := <-interruptSignals:
log.Fatalln("forced exit:", newSignal) logrus.Fatalln("forced exit:", newSignal)
case <-time.After(common.ShutdownTimeout * time.Second): case <-time.After(common.ShutdownTimeout * time.Second):
log.Fatalln("shutdown timed out") logrus.Fatalln("shutdown timed out")
case <-doneSignal: case <-doneSignal:
} }
} }
...@@ -70,7 +70,7 @@ func (r *RunSingleCommand) postBuild() { ...@@ -70,7 +70,7 @@ func (r *RunSingleCommand) postBuild() {
func (r *RunSingleCommand) processBuild(data common.ExecutorData, abortSignal chan os.Signal) (err error) { func (r *RunSingleCommand) processBuild(data common.ExecutorData, abortSignal chan os.Signal) (err error) {
jobData, healthy := r.network.RequestJob(r.RunnerConfig, nil) jobData, healthy := r.network.RequestJob(r.RunnerConfig, nil)
if !healthy { if !healthy {
log.Println("Runner is not healthy!") logrus.Println("Runner is not healthy!")
select { select {
case <-time.After(common.NotHealthyCheckInterval * time.Second): case <-time.After(common.NotHealthyCheckInterval * time.Second):
case <-abortSignal: case <-abortSignal:
...@@ -108,11 +108,11 @@ func (r *RunSingleCommand) processBuild(data common.ExecutorData, abortSignal ch ...@@ -108,11 +108,11 @@ func (r *RunSingleCommand) processBuild(data common.ExecutorData, abortSignal ch
func (r *RunSingleCommand) checkFinishedConditions() { func (r *RunSingleCommand) checkFinishedConditions() {
if r.MaxBuilds < 1 && !r.runForever { if r.MaxBuilds < 1 && !r.runForever {
log.Println("This runner has processed its build limit, so now exiting") logrus.Println("This runner has processed its build limit, so now exiting")
r.finished.Set() r.finished.Set()
} }
if r.WaitTimeout > 0 && int(time.Since(r.lastBuild).Seconds()) > r.WaitTimeout { if r.WaitTimeout > 0 && int(time.Since(r.lastBuild).Seconds()) > r.WaitTimeout {
log.Println("This runner has not received a job in", r.WaitTimeout, "seconds, so now exiting") logrus.Println("This runner has not received a job in", r.WaitTimeout, "seconds, so now exiting")
r.finished.Set() r.finished.Set()
} }
return return
...@@ -120,21 +120,21 @@ func (r *RunSingleCommand) checkFinishedConditions() { ...@@ -120,21 +120,21 @@ func (r *RunSingleCommand) checkFinishedConditions() {
func (r *RunSingleCommand) Execute(c *cli.Context) { func (r *RunSingleCommand) Execute(c *cli.Context) {
if len(r.URL) == 0 { if len(r.URL) == 0 {
log.Fatalln("Missing URL") logrus.Fatalln("Missing URL")
} }
if len(r.Token) == 0 { if len(r.Token) == 0 {
log.Fatalln("Missing Token") logrus.Fatalln("Missing Token")
} }
if len(r.Executor) == 0 { if len(r.Executor) == 0 {
log.Fatalln("Missing Executor") logrus.Fatalln("Missing Executor")
} }
executorProvider := common.GetExecutor(r.Executor) executorProvider := common.GetExecutor(r.Executor)
if executorProvider == nil { if executorProvider == nil {
log.Fatalln("Unknown executor:", r.Executor) logrus.Fatalln("Unknown executor:", r.Executor)
} }
log.Println("Starting runner for", r.URL, "with token", r.ShortDescription(), "...") logrus.Println("Starting runner for", r.URL, "with token", r.ShortDescription(), "...")
r.finished = abool.New() r.finished = abool.New()
abortSignal := make(chan os.Signal) abortSignal := make(chan os.Signal)
...@@ -148,12 +148,12 @@ func (r *RunSingleCommand) Execute(c *cli.Context) { ...@@ -148,12 +148,12 @@ func (r *RunSingleCommand) Execute(c *cli.Context) {
for !r.finished.IsSet() { for !r.finished.IsSet() {
data, err := executorProvider.Acquire(&r.RunnerConfig) data, err := executorProvider.Acquire(&r.RunnerConfig)
if err != nil { if err != nil {
log.Warningln("Executor update:", err) logrus.Warningln("Executor update:", err)
} }
pErr := r.processBuild(data, abortSignal) pErr := r.processBuild(data, abortSignal)
if pErr != nil { if pErr != nil {
log.WithError(pErr).Error("Failed to process build") logrus.WithError(pErr).Error("Failed to process build")
} }
r.checkFinishedConditions() r.checkFinishedConditions()
......
package commands package commands
import ( import (
"github.com/sirupsen/logrus"
"github.com/urfave/cli" "github.com/urfave/cli"
log "github.com/sirupsen/logrus"
"gitlab.com/gitlab-org/gitlab-runner/common" "gitlab.com/gitlab-org/gitlab-runner/common"
"gitlab.com/gitlab-org/gitlab-runner/network" "gitlab.com/gitlab-org/gitlab-runner/network"
) )
...@@ -17,10 +17,10 @@ type UnregisterCommand struct { ...@@ -17,10 +17,10 @@ type UnregisterCommand struct {
} }
func (c *UnregisterCommand) unregisterAllRunners() (runners []*common.RunnerConfig) { func (c *UnregisterCommand) unregisterAllRunners() (runners []*common.RunnerConfig) {
log.Warningln("Unregistering all runners") logrus.Warningln("Unregistering all runners")
for _, r := range c.config.Runners { for _, r := range c.config.Runners {
if !c.network.UnregisterRunner(r.RunnerCredentials) { if !c.network.UnregisterRunner(r.RunnerCredentials) {
log.Errorln("Failed to unregister runner", r.Name) logrus.Errorln("Failed to unregister runner", r.Name)
//If unregister fails, leave the runner in the config //If unregister fails, leave the runner in the config
runners = append(runners, r) runners = append(runners, r)
} }
...@@ -32,14 +32,14 @@ func (c *UnregisterCommand) unregisterSingleRunner() (runners []*common.RunnerCo ...@@ -32,14 +32,14 @@ func (c *UnregisterCommand) unregisterSingleRunner() (runners []*common.RunnerCo
if len(c.Name) > 0 { // Unregister when given a name if len(c.Name) > 0 { // Unregister when given a name
runnerConfig, err := c.RunnerByName(c.Name) runnerConfig, err := c.RunnerByName(c.Name)
if err != nil { if err != nil {
log.Fatalln(err) logrus.Fatalln(err)
} }
c.RunnerCredentials = runnerConfig.RunnerCredentials c.RunnerCredentials = runnerConfig.RunnerCredentials
} }
// Unregister given Token and URL of the runner // Unregister given Token and URL of the runner
if !c.network.UnregisterRunner(c.RunnerCredentials) { if !c.network.UnregisterRunner(c.RunnerCredentials) {
log.Fatalln("Failed to unregister runner", c.Name) logrus.Fatalln("Failed to unregister runner", c.Name)
} }
for _, otherRunner := range c.config.Runners { for _, otherRunner := range c.config.Runners {
...@@ -56,7 +56,7 @@ func (c *UnregisterCommand) Execute(context *cli.Context) { ...@@ -56,7 +56,7 @@ func (c *UnregisterCommand) Execute(context *cli.Context) {
err := c.loadConfig() err := c.loadConfig()
if err != nil { if err != nil {
log.Fatalln(err) logrus.Fatalln(err)
return return
} }
...@@ -77,9 +77,9 @@ func (c *UnregisterCommand) Execute(context *cli.Context) { ...@@ -77,9 +77,9 @@ func (c *UnregisterCommand) Execute(context *cli.Context) {
// save config file // save config file
err = c.saveConfig() err = c.saveConfig()
if err != nil { if err != nil {
log.Fatalln("Failed to update", c.ConfigFile, err) logrus.Fatalln("Failed to update", c.ConfigFile, err)
} }
log.Println("Updated", c.ConfigFile) logrus.Println("Updated", c.ConfigFile)
} }
func init() { func init() {
......
...@@ -3,7 +3,7 @@ package commands ...@@ -3,7 +3,7 @@ package commands
import ( import (
"errors" "errors"
log "github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"github.com/urfave/cli" "github.com/urfave/cli"
"gitlab.com/gitlab-org/gitlab-runner/common" "gitlab.com/gitlab-org/gitlab-runner/common"
...@@ -23,14 +23,14 @@ func (c *VerifyCommand) Execute(context *cli.Context) { ...@@ -23,14 +23,14 @@ func (c *VerifyCommand) Execute(context *cli.Context) {
err := c.loadConfig() err := c.loadConfig()
if err != nil { if err != nil {
log.Fatalln(err) logrus.Fatalln(err)
return return
} }
// check if there's something to verify // check if there's something to verify
toVerify, okRunners, err := c.selectRunners() toVerify, okRunners, err := c.selectRunners()
if err != nil { if err != nil {
log.Fatalln(err) logrus.Fatalln(err)
return return
} }
...@@ -47,7 +47,7 @@ func (c *VerifyCommand) Execute(context *cli.Context) { ...@@ -47,7 +47,7 @@ func (c *VerifyCommand) Execute(context *cli.Context) {
} }
if !c.DeleteNonExisting { if !c.DeleteNonExisting {
log.Fatalln("Failed to verify runners") logrus.Fatalln("Failed to verify runners")
return return
} }
...@@ -56,9 +56,9 @@ func (c *VerifyCommand) Execute(context *cli.Context) { ...@@ -56,9 +56,9 @@ func (c *VerifyCommand) Execute(context *cli.Context) {
// save config file // save config file
err = c.saveConfig() err = c.saveConfig()
if err != nil { if err != nil {
log.Fatalln("Failed to update", c.ConfigFile, err) logrus.Fatalln("Failed to update", c.ConfigFile, err)
} }
log.Println("Updated", c.ConfigFile) logrus.Println("Updated", c.ConfigFile)
} }
func (c *VerifyCommand) selectRunners() (toVerify []*common.RunnerConfig, okRunners []*common.RunnerConfig, err error) { func (c *VerifyCommand) selectRunners() (toVerify []*common.RunnerConfig, okRunners []*common.RunnerConfig, err error) {
......
package common package common
import ( import (
log "github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"github.com/urfave/cli" "github.com/urfave/cli"
"gitlab.com/ayufan/golang-cli-helpers" "gitlab.com/ayufan/golang-cli-helpers"
) )
...@@ -13,7 +13,7 @@ type Commander interface { ...@@ -13,7 +13,7 @@ type Commander interface {
} }
func RegisterCommand(command cli.Command) { func RegisterCommand(command cli.Command) {
log.Debugln("Registering", command.Name, "command...") logrus.Debugln("Registering", command.Name, "command...")
commands = append(commands, command) commands = append(commands, command)
} }
......
...@@ -16,7 +16,7 @@ import ( ...@@ -16,7 +16,7 @@ import (
"github.com/BurntSushi/toml" "github.com/BurntSushi/toml"
"github.com/docker/go-units" "github.com/docker/go-units"
log "github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
api "k8s.io/api/core/v1" api "k8s.io/api/core/v1"
"gitlab.com/gitlab-org/gitlab-runner/helpers" "gitlab.com/gitlab-org/gitlab-runner/helpers"
...@@ -323,13 +323,13 @@ type Config struct { ...@@ -323,13 +323,13 @@ type Config struct {
func getDeprecatedStringSetting(setting string, tomlField string, envVariable string, tomlReplacement string, envReplacement string) string { func getDeprecatedStringSetting(setting string, tomlField string, envVariable string, tomlReplacement string, envReplacement string) string {
if setting != "" { if setting != "" {
log.Warningf("%s setting is deprecated and will be removed in GitLab Runner 12.0. Please use %s instead", tomlField, tomlReplacement) logrus.Warningf("%s setting is deprecated and will be removed in GitLab Runner 12.0. Please use %s instead", tomlField, tomlReplacement)
return setting return setting
} }
value := os.Getenv(envVariable) value := os.Getenv(envVariable)
if value != "" { if value != "" {
log.Warningf("%s environment variables is deprecated and will be removed in GitLab Runner 12.0. Please use %s instead", envVariable, envReplacement) logrus.Warningf("%s environment variables is deprecated and will be removed in GitLab Runner 12.0. Please use %s instead", envVariable, envReplacement)
} }
return value return value
...@@ -337,13 +337,13 @@ func getDeprecatedStringSetting(setting string, tomlField string, envVariable st ...@@ -337,13 +337,13 @@ func getDeprecatedStringSetting(setting string, tomlField string, envVariable st
func getDeprecatedBoolSetting(setting bool, tomlField string, envVariable string, tomlReplacement string, envReplacement string) bool { func getDeprecatedBoolSetting(setting bool, tomlField string, envVariable string, tomlReplacement string, envReplacement string) bool {
if setting { if setting {
log.Warningf("%s setting is deprecated and will be removed in GitLab Runner 12.0. Please use %s instead", tomlField, tomlReplacement) logrus.Warningf("%s setting is deprecated and will be removed in GitLab Runner 12.0. Please use %s instead", tomlField, tomlReplacement)
return setting return setting
} }
value, _ := strconv.ParseBool(os.Getenv(envVariable)) value, _ := strconv.ParseBool(os.Getenv(envVariable))
if value { if value {
log.Warningf("%s environment variables is deprecated and will be removed in GitLab Runner 12.0. Please use %s instead", envVariable, envReplacement) logrus.Warningf("%s environment variables is deprecated and will be removed in GitLab Runner 12.0. Please use %s instead", envVariable, envReplacement)
} }
return value return value
...@@ -360,7 +360,7 @@ func (c *CacheConfig) GetPath() string { ...@@ -360,7 +360,7 @@ func (c *CacheConfig) GetPath() string {
// TODO: Remove in 12.0 // TODO: Remove in 12.0
if c.S3CachePath != "" { if c.S3CachePath != "" {
log.Warning("'--cache-s3-cache-path' command line option and `$S3_CACHE_PATH` environment variables are deprecated and will be removed in GitLab Runner 12.0. Please use '--cache-path' or '$CACHE_PATH' instead") logrus.Warning("'--cache-s3-cache-path' command line option and `$S3_CACHE_PATH` environment variables are deprecated and will be removed in GitLab Runner 12.0. Please use '--cache-path' or '$CACHE_PATH' instead")
} }
return c.S3CachePath return c.S3CachePath
...@@ -373,7 +373,7 @@ func (c *CacheConfig) GetShared() bool { ...@@ -373,7 +373,7 @@ func (c *CacheConfig) GetShared() bool {
// TODO: Remove in 12.0 // TODO: Remove in 12.0
if c.CacheShared { if c.CacheShared {
log.Warning("'--cache-cache-shared' command line is deprecated and will be removed in GitLab Runner 12.0. Please use '--cache-shared' instead") logrus.Warning("'--cache-cache-shared' command line is deprecated and will be removed in GitLab Runner 12.0. Please use '--cache-shared' instead")
} }
return c.CacheShared return c.CacheShared
...@@ -475,7 +475,7 @@ func (c *DockerConfig) getMemoryBytes(size string, fieldName string) int64 { ...@@ -475,7 +475,7 @@ func (c *DockerConfig) getMemoryBytes(size string, fieldName string) int64 {
bytes, err := units.RAMInBytes(size) bytes, err := units.RAMInBytes(size)
if err != nil { if err != nil {
log.Fatalf("Error parsing docker %s: %s", fieldName, err) logrus.Fatalf("Error parsing docker %s: %s", fieldName, err)
} }
return bytes return bytes
...@@ -613,11 +613,11 @@ func (c *RunnerCredentials) UniqueID() string { ...@@ -613,11 +613,11 @@ func (c *RunnerCredentials) UniqueID() string {
return c.URL + c.Token return c.URL + c.Token
} }
func (c *RunnerCredentials) Log() *log.Entry { func (c *RunnerCredentials) Log() *logrus.Entry {
if c.ShortDescription() != "" { if c.ShortDescription() != "" {
return log.WithField("runner", c.ShortDescription()) return logrus.WithField("runner", c.ShortDescription())
} }
return log.WithFields(log.Fields{}) return logrus.WithFields(logrus.Fields{})
} }
func (c *RunnerCredentials) SameAs(other *RunnerCredentials) bool { func (c *RunnerCredentials) SameAs(other *RunnerCredentials) bool {
...@@ -717,7 +717,7 @@ func (c *Config) SaveConfig(configFile string) error { ...@@ -717,7 +717,7 @@ func (c *Config) SaveConfig(configFile string) error {
newBuffer := bufio.NewWriter(&newConfig) newBuffer := bufio.NewWriter(&newConfig)
if err := toml.NewEncoder(newBuffer).Encode(c); err != nil { if err := toml.NewEncoder(newBuffer).Encode(c); err != nil {
log.Fatalf("Error encoding TOML: %s", err) logrus.Fatalf("Error encoding TOML: %s", err)
return err return err
} }
...@@ -751,7 +751,7 @@ func (c *Config) ListenOrServerMetricAddress() string { ...@@ -751,7 +751,7 @@ func (c *Config) ListenOrServerMetricAddress() string {
// TODO: Remove in 12.0 // TODO: Remove in 12.0
if c.MetricsServerAddress != "" { if c.MetricsServerAddress != "" {
log.Warnln("'metrics_server' configuration entry is deprecated and will be removed in one of future releases; please use 'listen_address' instead") logrus.Warnln("'metrics_server' configuration entry is deprecated and will be removed in one of future releases; please use 'listen_address' instead")
} }
return c.MetricsServerAddress return c.MetricsServerAddress
......
...@@ -5,7 +5,7 @@ import ( ...@@ -5,7 +5,7 @@ import (
"errors" "errors"
"fmt" "fmt"
log "github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
) )
type ExecutorData interface{} type ExecutorData interface{}
...@@ -85,7 +85,7 @@ func validateExecutorProvider(provider ExecutorProvider) error { ...@@ -85,7 +85,7 @@ func validateExecutorProvider(provider ExecutorProvider) error {
} }
func RegisterExecutor(executor string, provider ExecutorProvider) { func RegisterExecutor(executor string, provider ExecutorProvider) {
log.Debugln("Registering", executor, "executor...") logrus.Debugln("Registering", executor, "executor...")
if err := validateExecutorProvider(provider); err != nil { if err := validateExecutorProvider(provider); err != nil {
panic("Executor cannot be registered: " + err.Error()) panic("Executor cannot be registered: " + err.Error())
......
...@@ -3,7 +3,7 @@ package common ...@@ -3,7 +3,7 @@ package common
import ( import (
"fmt" "fmt"
log "github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"gitlab.com/gitlab-org/gitlab-runner/helpers" "gitlab.com/gitlab-org/gitlab-runner/helpers"
) )
...@@ -59,7 +59,7 @@ type Shell interface { ...@@ -59,7 +59,7 @@ type Shell interface {
var shells map[string]Shell var shells map[string]Shell
func RegisterShell(shell Shell) { func RegisterShell(shell Shell) {
log.Debugln("Registering", shell.GetName(), "shell...") logrus.Debugln("Registering", shell.GetName(), "shell...")
if shells == nil { if shells == nil {
shells = make(map[string]Shell) shells = make(map[string]Shell)
......
...@@ -2,13 +2,13 @@ package service_helpers ...@@ -2,13 +2,13 @@ package service_helpers
import ( import (
"github.com/ayufan/golang-kardianos-service" "github.com/ayufan/golang-kardianos-service"
log "github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
) )
func New(i service.Interface, c *service.Config) (service.Service, error) { func New(i service.Interface, c *service.Config) (service.Service, error) {
s, err := service.New(i, c) s, err := service.New(i, c)
if err == service.ErrNoServiceSystemDetected { if err == service.ErrNoServiceSystemDetected {
log.Warningln("No service system detected. Some features may not work!") logrus.Warningln("No service system detected. Some features may not work!")
return &SimpleService{ return &SimpleService{
i: i, i: i,
......
...@@ -4,13 +4,14 @@ import ( ...@@ -4,13 +4,14 @@ import (
"bytes" "bytes"
"errors" "errors"
"fmt" "fmt"
log "github.com/sirupsen/logrus"