mirror of
https://github.com/containers/podman.git
synced 2025-06-20 17:13:43 +08:00
vendor latest buildah
Allow parallel copying from the blobcache. Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
This commit is contained in:
@ -92,7 +92,7 @@ k8s.io/kube-openapi 275e2ce91dec4c05a4094a7b1daee5560b555ac9 https://github.com/
|
|||||||
k8s.io/utils 258e2a2fa64568210fbd6267cf1d8fd87c3cb86e https://github.com/kubernetes/utils
|
k8s.io/utils 258e2a2fa64568210fbd6267cf1d8fd87c3cb86e https://github.com/kubernetes/utils
|
||||||
github.com/mrunalp/fileutils master
|
github.com/mrunalp/fileutils master
|
||||||
github.com/varlink/go master
|
github.com/varlink/go master
|
||||||
github.com/containers/buildah a4200ae6b590c4b08b223e45513b1894636d1d02
|
github.com/containers/buildah e7ca330f923701dba8859f5c014d0a9a3f7f0a49
|
||||||
github.com/Nvveen/Gotty master
|
github.com/Nvveen/Gotty master
|
||||||
github.com/fsouza/go-dockerclient master
|
github.com/fsouza/go-dockerclient master
|
||||||
github.com/openshift/imagebuilder master
|
github.com/openshift/imagebuilder master
|
||||||
|
1
vendor/github.com/containers/buildah/imagebuildah/build.go
generated
vendored
1
vendor/github.com/containers/buildah/imagebuildah/build.go
generated
vendored
@ -517,6 +517,7 @@ func (b *Executor) Run(run imagebuilder.Run, config docker.Config) error {
|
|||||||
Hostname: config.Hostname,
|
Hostname: config.Hostname,
|
||||||
Runtime: b.runtime,
|
Runtime: b.runtime,
|
||||||
Args: b.runtimeArgs,
|
Args: b.runtimeArgs,
|
||||||
|
NoPivot: os.Getenv("BUILDAH_NOPIVOT") != "",
|
||||||
Mounts: convertMounts(b.transientMounts),
|
Mounts: convertMounts(b.transientMounts),
|
||||||
Env: config.Env,
|
Env: config.Env,
|
||||||
User: config.User,
|
User: config.User,
|
||||||
|
14
vendor/github.com/containers/buildah/pkg/blobcache/blobcache.go
generated
vendored
14
vendor/github.com/containers/buildah/pkg/blobcache/blobcache.go
generated
vendored
@ -52,6 +52,8 @@ type BlobCache interface {
|
|||||||
|
|
||||||
type blobCacheReference struct {
|
type blobCacheReference struct {
|
||||||
reference types.ImageReference
|
reference types.ImageReference
|
||||||
|
// WARNING: The contents of this directory may be accessed concurrently,
|
||||||
|
// both within this process and by multiple different processes
|
||||||
directory string
|
directory string
|
||||||
compress types.LayerCompression
|
compress types.LayerCompression
|
||||||
}
|
}
|
||||||
@ -60,6 +62,8 @@ type blobCacheSource struct {
|
|||||||
reference *blobCacheReference
|
reference *blobCacheReference
|
||||||
source types.ImageSource
|
source types.ImageSource
|
||||||
sys types.SystemContext
|
sys types.SystemContext
|
||||||
|
// this mutex synchronizes the counters below
|
||||||
|
mu sync.Mutex
|
||||||
cacheHits int64
|
cacheHits int64
|
||||||
cacheMisses int64
|
cacheMisses int64
|
||||||
cacheErrors int64
|
cacheErrors int64
|
||||||
@ -219,7 +223,7 @@ func (s *blobCacheSource) GetManifest(ctx context.Context, instanceDigest *diges
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *blobCacheSource) HasThreadSafeGetBlob() bool {
|
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) {
|
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))
|
filename := filepath.Join(s.reference.directory, makeFilename(blobinfo.Digest, isConfig))
|
||||||
f, err := os.Open(filename)
|
f, err := os.Open(filename)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
s.mu.Lock()
|
||||||
s.cacheHits++
|
s.cacheHits++
|
||||||
|
s.mu.Unlock()
|
||||||
return f, size, nil
|
return f, size, nil
|
||||||
}
|
}
|
||||||
if !os.IsNotExist(err) {
|
if !os.IsNotExist(err) {
|
||||||
|
s.mu.Lock()
|
||||||
s.cacheErrors++
|
s.cacheErrors++
|
||||||
|
s.mu.Unlock()
|
||||||
return nil, -1, errors.Wrapf(err, "error checking for cache file %q", filepath.Join(s.reference.directory, filename))
|
return nil, -1, errors.Wrapf(err, "error checking for cache file %q", filepath.Join(s.reference.directory, filename))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
s.mu.Lock()
|
||||||
s.cacheMisses++
|
s.cacheMisses++
|
||||||
|
s.mu.Unlock()
|
||||||
rc, size, err := s.source.GetBlob(ctx, blobinfo, cache)
|
rc, size, err := s.source.GetBlob(ctx, blobinfo, cache)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return rc, size, errors.Wrapf(err, "error reading blob from source image %q", transports.ImageName(s.reference))
|
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 {
|
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) {
|
func (d *blobCacheDestination) PutBlob(ctx context.Context, stream io.Reader, inputInfo types.BlobInfo, cache types.BlobInfoCache, isConfig bool) (types.BlobInfo, error) {
|
||||||
|
Reference in New Issue
Block a user