Skip to content

Commit

Permalink
Silence "using cache" to ensure -q is fully quiet
Browse files Browse the repository at this point in the history
  + Add a helper function inside of `(s *StageExecutor) Execute()` to
handle "using cache" messages

Signed-off-by: Tyler Ramer <[email protected]>

---
Addresses #1897
  • Loading branch information
tylarb committed Oct 16, 2019
1 parent d6f11ba commit e87aa86
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion imagebuildah/stage_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,12 @@ func (s *StageExecutor) Execute(ctx context.Context, stage imagebuilder.Stage, b
s.executor.log(commitMessage)
}
}
logCacheHit := func(cacheID string) {
if !s.executor.quiet {
cacheHitMessage := "--> Using cache"
fmt.Fprintf(s.executor.out, "%s %s\n", cacheHitMessage, cacheID)
}
}
logImageID := func(imgID string) {
if s.executor.iidfile == "" {
fmt.Fprintf(s.executor.out, "%s\n", imgID)
Expand Down Expand Up @@ -909,7 +915,7 @@ func (s *StageExecutor) Execute(ctx context.Context, stage imagebuilder.Stage, b
}
if cacheID != "" {
// Note the cache hit.
fmt.Fprintf(s.executor.out, "--> Using cache %s\n", cacheID)
logCacheHit(cacheID)
} else {
// We're not going to find any more cache hits.
checkForLayers = false
Expand Down

0 comments on commit e87aa86

Please sign in to comment.