本文整理汇总了Golang中gitlab.com/gitlab-org/gitlab-ci-multi-runner/common.RunnerConfig.ShortDescription方法的典型用法代码示例。如果您正苦于以下问题:Golang RunnerConfig.ShortDescription方法的具体用法?Golang RunnerConfig.ShortDescription怎么用?Golang RunnerConfig.ShortDescription使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gitlab.com/gitlab-org/gitlab-ci-multi-runner/common.RunnerConfig
的用法示例。
在下文中一共展示了RunnerConfig.ShortDescription方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: requestBuild
func (mr *MultiRunner) requestBuild(runner *common.RunnerConfig) *common.Build {
if runner == nil {
return nil
}
if !mr.isHealthy(runner) {
return nil
}
count := mr.buildsForRunner(runner)
limit := helpers.NonZeroOrDefault(runner.Limit, math.MaxInt32)
if count >= limit {
return nil
}
buildData, healthy := common.GetBuild(*runner)
if healthy {
mr.makeHealthy(runner)
} else {
mr.makeUnhealthy(runner)
}
if buildData == nil {
return nil
}
mr.debugln("Received new build for", runner.ShortDescription(), "build", buildData.ID)
newBuild := &common.Build{
GetBuildResponse: *buildData,
Runner: runner,
BuildAbort: mr.abortBuilds,
}
return newBuild
}
示例2: makeUnhealthy
func (mr *MultiRunner) makeUnhealthy(runner *common.RunnerConfig) {
health := mr.getHealth(runner)
health.failures++
if health.failures >= common.HealthyChecks {
mr.errorln("Runner", runner.ShortDescription(), "is not healthy and will be disabled!")
}
}
示例3: isHealthy
func (mr *MultiRunner) isHealthy(runner *common.RunnerConfig) bool {
health := mr.getHealth(runner)
if health.failures < common.HealthyChecks {
return true
}
if time.Since(health.lastCheck) > common.HealthCheckInterval*time.Second {
mr.errorln("Runner", runner.ShortDescription(), "is not healthy, but will be checked!")
health.failures = 0
health.lastCheck = time.Now()
return true
}
return false
}
示例4: runSingle
func runSingle(c *cli.Context) {
buildsDir := c.String("builds-dir")
shell := c.String("shell")
config := common.NewConfig()
runner := common.RunnerConfig{
URL: c.String("url"),
Token: c.String("token"),
Executor: c.String("executor"),
BuildsDir: &buildsDir,
Shell: &shell,
}
if len(runner.URL) == 0 {
log.Fatalln("Missing URL")
}
if len(runner.Token) == 0 {
log.Fatalln("Missing Token")
}
if len(runner.Executor) == 0 {
log.Fatalln("Missing Executor")
}
go runServer(c.String("addr"))
go runHerokuURL(c.String("heroku-url"))
signals := make(chan os.Signal)
signal.Notify(signals, os.Interrupt, syscall.SIGTERM)
log.Println("Starting runner for", runner.URL, "with token", runner.ShortDescription(), "...")
finished := false
abortSignal := make(chan os.Signal)
doneSignal := make(chan int, 1)
go func() {
interrupt := <-signals
log.Warningln("Requested exit:", interrupt)
finished = true
go func() {
for {
abortSignal <- interrupt
}
}()
select {
case newSignal := <-signals:
log.Fatalln("forced exit:", newSignal)
case <-time.After(common.ShutdownTimeout * time.Second):
log.Fatalln("shutdown timedout")
case <-doneSignal:
}
}()
for !finished {
buildData, healthy := common.GetBuild(runner)
if !healthy {
log.Println("Runner is not healthy!")
select {
case <-time.After(common.NotHealthyCheckInterval * time.Second):
case <-abortSignal:
}
continue
}
if buildData == nil {
select {
case <-time.After(common.CheckInterval * time.Second):
case <-abortSignal:
}
continue
}
newBuild := common.Build{
GetBuildResponse: *buildData,
Runner: &runner,
BuildAbort: abortSignal,
}
newBuild.AssignID()
newBuild.Run(config)
}
doneSignal <- 0
}