Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cmd/convertor/builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,9 @@ func (b *graphBuilder) buildOne(ctx context.Context, src v1.Descriptor, tag bool
engineBase.reserve = b.Reserve
engineBase.noUpload = b.NoUpload
engineBase.dumpManifest = b.DumpManifest
if _, ok := b.Resolver.(*FileBasedResolver); ok {
engineBase.tarExport = true
}

var engine builderEngine
switch b.Engine {
Expand Down
6 changes: 4 additions & 2 deletions cmd/convertor/builder/builder_engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ type builderEngineBase struct {
noUpload bool
dumpManifest bool
referrer bool
tarExport bool
}

func (e *builderEngineBase) isGzipLayer(ctx context.Context, idx int) (bool, error) {
Expand Down Expand Up @@ -171,6 +172,7 @@ func (e *builderEngineBase) mediaTypeImageLayer() string {
}

func (e *builderEngineBase) uploadManifestAndConfig(ctx context.Context) (specs.Descriptor, error) {
shouldUploadBlob := !e.noUpload || e.tarExport
cbuf, err := json.Marshal(e.config)
if err != nil {
return specs.Descriptor{}, err
Expand All @@ -180,7 +182,7 @@ func (e *builderEngineBase) uploadManifestAndConfig(ctx context.Context) (specs.
Digest: digest.FromBytes(cbuf),
Size: (int64)(len(cbuf)),
}
if !e.noUpload {
if shouldUploadBlob {
if err = uploadBytes(ctx, e.pusher, e.manifest.Config, cbuf); err != nil {
return specs.Descriptor{}, errors.Wrapf(err, "failed to upload config")
}
Expand All @@ -204,7 +206,7 @@ func (e *builderEngineBase) uploadManifestAndConfig(ctx context.Context) (specs.
Digest: digest.FromBytes(cbuf),
Size: (int64)(len(cbuf)),
}
if !e.noUpload {
if shouldUploadBlob {
if err = uploadBytes(ctx, e.pusher, manifestDesc, cbuf); err != nil {
return specs.Descriptor{}, errors.Wrapf(err, "failed to upload manifest")
}
Expand Down
6 changes: 4 additions & 2 deletions cmd/convertor/builder/overlaybd_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ func (e *overlaybdBuilderEngine) UploadLayer(ctx context.Context, idx int) error
label.OverlayBDBlobSize: fmt.Sprintf("%d", desc.Size),
label.OverlayBDBlobFsType: e.fstype,
}
if !e.noUpload {
shouldUploadBlob := !e.noUpload || e.tarExport
if shouldUploadBlob {
if err := uploadBlob(ctx, e.pusher, path.Join(layerDir, commitFile), desc); err != nil {
return errors.Wrapf(err, "failed to upload layer %d", idx)
}
Expand Down Expand Up @@ -467,7 +468,8 @@ func (e *overlaybdBuilderEngine) uploadBaseLayer(ctx context.Context) (specs.Des
label.OverlayBDBlobFsType: e.fstype,
},
}
if !e.noUpload {
shouldUploadBlob := !e.noUpload || e.tarExport
if shouldUploadBlob {
if err = uploadBlob(ctx, e.pusher, tarFile, baseDesc); err != nil {
return specs.Descriptor{}, errors.Wrapf(err, "failed to upload baselayer")
}
Expand Down
Loading