vendor latest buildah

Allow parallel copying from the blobcache.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
This commit is contained in:
Valentin Rothberg 2019-01-08 12:34:40 +01:00
parent faa24627bb
commit 454ad71fd4
3 changed files with 17 additions and 6 deletions

View file

@ -92,7 +92,7 @@ k8s.io/kube-openapi 275e2ce91dec4c05a4094a7b1daee5560b555ac9 https://github.com/
k8s.io/utils 258e2a2fa64568210fbd6267cf1d8fd87c3cb86e https://github.com/kubernetes/utils
github.com/mrunalp/fileutils master
github.com/varlink/go master
github.com/containers/buildah a4200ae6b590c4b08b223e45513b1894636d1d02
github.com/containers/buildah e7ca330f923701dba8859f5c014d0a9a3f7f0a49
github.com/Nvveen/Gotty master
github.com/fsouza/go-dockerclient master
github.com/openshift/imagebuilder master

View file

@ -517,6 +517,7 @@ func (b *Executor) Run(run imagebuilder.Run, config docker.Config) error {
Hostname: config.Hostname,
Runtime: b.runtime,
Args: b.runtimeArgs,
NoPivot: os.Getenv("BUILDAH_NOPIVOT") != "",
Mounts: convertMounts(b.transientMounts),
Env: config.Env,
User: config.User,

View file

@ -52,14 +52,18 @@ type BlobCache interface {
type blobCacheReference struct {
reference types.ImageReference
// WARNING: The contents of this directory may be accessed concurrently,
// both within this process and by multiple different processes
directory string
compress types.LayerCompression
}
type blobCacheSource struct {
reference *blobCacheReference
source types.ImageSource
sys types.SystemContext
reference *blobCacheReference
source types.ImageSource
sys types.SystemContext
// this mutex synchronizes the counters below
mu sync.Mutex
cacheHits int64
cacheMisses int64
cacheErrors int64
@ -219,7 +223,7 @@ func (s *blobCacheSource) GetManifest(ctx context.Context, instanceDigest *diges
}
func (s *blobCacheSource) HasThreadSafeGetBlob() bool {
return false
return s.source.HasThreadSafeGetBlob()
}
func (s *blobCacheSource) GetBlob(ctx context.Context, blobinfo types.BlobInfo, cache types.BlobInfoCache) (io.ReadCloser, int64, error) {
@ -232,16 +236,22 @@ func (s *blobCacheSource) GetBlob(ctx context.Context, blobinfo types.BlobInfo,
filename := filepath.Join(s.reference.directory, makeFilename(blobinfo.Digest, isConfig))
f, err := os.Open(filename)
if err == nil {
s.mu.Lock()
s.cacheHits++
s.mu.Unlock()
return f, size, nil
}
if !os.IsNotExist(err) {
s.mu.Lock()
s.cacheErrors++
s.mu.Unlock()
return nil, -1, errors.Wrapf(err, "error checking for cache file %q", filepath.Join(s.reference.directory, filename))
}
}
}
s.mu.Lock()
s.cacheMisses++
s.mu.Unlock()
rc, size, err := s.source.GetBlob(ctx, blobinfo, cache)
if err != nil {
return rc, size, errors.Wrapf(err, "error reading blob from source image %q", transports.ImageName(s.reference))
@ -403,7 +413,7 @@ func saveStream(wg *sync.WaitGroup, decompressReader io.ReadCloser, tempFile *os
}
func (s *blobCacheDestination) HasThreadSafePutBlob() bool {
return false
return s.destination.HasThreadSafePutBlob()
}
func (d *blobCacheDestination) PutBlob(ctx context.Context, stream io.Reader, inputInfo types.BlobInfo, cache types.BlobInfoCache, isConfig bool) (types.BlobInfo, error) {