|
|
|
|
@ -8,6 +8,11 @@ import (
|
|
|
|
|
tfe "github.com/hashicorp/go-tfe"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
taskStageBackoffMin = 4000.0
|
|
|
|
|
taskStageBackoffMax = 12000.0
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type taskStages map[tfe.Stage]*tfe.TaskStage
|
|
|
|
|
|
|
|
|
|
type taskStageSummarizer interface {
|
|
|
|
|
@ -67,7 +72,7 @@ func (b *Cloud) runTaskStage(ctx *IntegrationContext, output IntegrationOutputWr
|
|
|
|
|
summarizers = append(summarizers, s)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ctx.Poll(func(i int) (bool, error) {
|
|
|
|
|
return ctx.Poll(taskStageBackoffMin, taskStageBackoffMax, func(i int) (bool, error) {
|
|
|
|
|
options := tfe.TaskStageReadOptions{
|
|
|
|
|
Include: []tfe.TaskStageIncludeOpt{tfe.TaskStageTaskResults},
|
|
|
|
|
}
|
|
|
|
|
@ -88,14 +93,14 @@ func (b *Cloud) runTaskStage(ctx *IntegrationContext, output IntegrationOutputWr
|
|
|
|
|
errs.Append(err)
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if !cont {
|
|
|
|
|
return false, nil
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// cont is true and we must continue to poll
|
|
|
|
|
if msg != nil {
|
|
|
|
|
if i%4 == 0 && i > 0 {
|
|
|
|
|
output.OutputElapsed(*msg, len(*msg)) // Up to 2 digits are allowed by the max message allocation
|
|
|
|
|
}
|
|
|
|
|
output.OutputElapsed(*msg, len(*msg)) // Up to 2 digits are allowed by the max message allocation
|
|
|
|
|
}
|
|
|
|
|
return true, nil
|
|
|
|
|
}
|
|
|
|
|
|