build: add experimental support for print flag

Print flag can be used to make additional information
requests about the build and print their results.

Currently Dockerfile supports: outline, targets, subrequests.describe

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
Tonis Tiigi
2022-05-04 18:48:50 -07:00
parent 17dc0e1108
commit eefa8188e1
98 changed files with 8536 additions and 3339 deletions

View File

@ -14,6 +14,10 @@ import (
"github.com/pkg/errors"
)
// MaxRetryBackoff is the maximum backoff time before giving up. This is a
// variable so that code which embeds BuildKit can override the default value.
var MaxRetryBackoff = 8 * time.Second
func New(f images.HandlerFunc, logger func([]byte)) images.HandlerFunc {
return func(ctx context.Context, desc ocispecs.Descriptor) ([]ocispecs.Descriptor, error) {
backoff := time.Second
@ -35,7 +39,7 @@ func New(f images.HandlerFunc, logger func([]byte)) images.HandlerFunc {
return descs, nil
}
// backoff logic
if backoff >= 8*time.Second {
if backoff >= MaxRetryBackoff {
return nil, err
}
if logger != nil {