func (c *configOptions) loadConfig() error { config := common.NewConfig() err := config.LoadConfig(c.ConfigFile) if err != nil { return err } c.config = config return nil }
func (r *RunSingleCommand) processBuild(data common.ExecutorData, abortSignal chan os.Signal) (err error) { buildData, healthy := r.network.GetBuild(r.RunnerConfig) if !healthy { log.Println("Runner is not healthy!") select { case <-time.After(common.NotHealthyCheckInterval * time.Second): case <-abortSignal: } return } if buildData == nil { select { case <-time.After(common.CheckInterval): case <-abortSignal: } return } config := common.NewConfig() newBuild := common.Build{ GetBuildResponse: *buildData, Runner: &r.RunnerConfig, SystemInterrupt: abortSignal, ExecutorData: data, } buildCredentials := &common.BuildCredentials{ ID: buildData.ID, Token: buildData.Token, } trace := r.network.ProcessBuild(r.RunnerConfig, buildCredentials) defer trace.Fail(err) err = newBuild.Run(config, trace) return }
func runServiceInstall(s service.Service, c *cli.Context) error { if user := c.String("user"); user == "" && os.Getuid() == 0 { logrus.Fatal("Please specify user that will run gitlab-runner service") } if configFile := c.String("config"); configFile != "" { // try to load existing config config := common.NewConfig() err := config.LoadConfig(configFile) if err != nil { return err } // save config for the first time if !config.Loaded { err = config.SaveConfig(configFile) if err != nil { return err } } } return service.Control(s, "install") }