Skip to content

Commit

Permalink
add log info messages
Browse files Browse the repository at this point in the history
  • Loading branch information
gsquared94 committed Apr 8, 2021
1 parent 189edbe commit cff5987
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions pkg/skaffold/build/builder_mux.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ import (
"context"
"fmt"
"io"
"reflect"

"github.com/sirupsen/logrus"

"github.com/GoogleContainerTools/skaffold/pkg/skaffold/graph"
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/schema/latest"
Expand All @@ -45,7 +48,7 @@ func NewBuilderMux(cfg Config, store ArtifactStore, builder func(p latest.Pipeli
m := make(map[string]PipelineBuilder)
var pb []PipelineBuilder
minConcurrency := -1
for _, p := range pipelines {
for i, p := range pipelines {
b, err := builder(p)
if err != nil {
return nil, fmt.Errorf("creating builder: %w", err)
Expand All @@ -55,13 +58,19 @@ func NewBuilderMux(cfg Config, store ArtifactStore, builder func(p latest.Pipeli
m[a.ImageName] = b
}
concurrency := b.Concurrency()
if minConcurrency < 0 {
// set mux concurrency to be the minimum of all builders' concurrency. (concurrency = 0 means unlimited)
switch {
case minConcurrency < 0:
minConcurrency = concurrency
} else if concurrency > 0 && (minConcurrency == 0 || concurrency < minConcurrency) {
// set mux concurrency to be the minimum of all builders' concurrency. (concurrency = 0 means unlimited)
logrus.Infof("build concurrency first set to %d parsed from %s[%d]", minConcurrency, reflect.TypeOf(b).String(), i)
case concurrency > 0 && (minConcurrency == 0 || concurrency < minConcurrency):
minConcurrency = concurrency
logrus.Infof("build concurrency updated to %d parsed from %s[%d]", minConcurrency, reflect.TypeOf(b).String(), i)
default:
logrus.Infof("build concurrency value %d parsed from %s[%d] is ignored since it's not less than previously set value %d", concurrency, reflect.TypeOf(b).String(), i, minConcurrency)
}
}
logrus.Infof("final build concurrency value is %d", minConcurrency)

return &BuilderMux{builders: pb, byImageName: m, store: store, concurrency: minConcurrency}, nil
}
Expand Down

0 comments on commit cff5987

Please sign in to comment.