Skip to content

Commit

Permalink
fix inconsistent layer compression w/ image args
Browse files Browse the repository at this point in the history
previously, unpacking an image built with image_args could fail if (i
think!) the FROM image's layers were uncompressed. the added layers
would be compressed, and this would cause go-containerregistry to assume
all of them were, leading to an 'unexpected EOF' (or 'expected tar
header') error when trying to unpack the compressed layers.

i think this happened because I couldn't properly return a mediatype
from the registry indicating whether the layer blob was compressed or
decompressed, because GetBlob didn't return that information, so maybe
buildkit just trusted that it was compressed...?

just a guess though. this was kind of tricky to debug.

in any case, this is fixed by dropping github.com/containers/image and
using go-containerregistry directly for the registry implementation.
should have just used it directly in the first place tbh to avoid the
dependency. much tidier now!

Signed-off-by: Alex Suraci <suraci.alex@gmail.com>
  • Loading branch information
vito committed Jan 12, 2021
1 parent 38fb352 commit f4c893c
Show file tree
Hide file tree
Showing 6 changed files with 161 additions and 191 deletions.
7 changes: 2 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,17 @@ go 1.12

require (
github.com/BurntSushi/toml v0.3.1
github.com/VividCortex/ewma v1.1.1 // indirect
github.com/concourse/go-archive v1.0.1
github.com/containerd/stargz-snapshotter/estargz v0.0.0-20210105085455-7f45f7438617 // indirect
github.com/containers/image/v5 v5.9.0
github.com/docker/cli v20.10.2+incompatible // indirect
github.com/docker/docker v20.10.2+incompatible // indirect
github.com/fatih/color v1.10.0
github.com/golang/protobuf v1.4.3 // indirect
github.com/google/go-cmp v0.5.2 // indirect
github.com/google/go-containerregistry v0.3.0
github.com/julienschmidt/httprouter v1.3.0
github.com/klauspost/compress v1.11.6 // indirect
github.com/onsi/gomega v1.10.3 // indirect
github.com/opencontainers/go-digest v1.0.0
github.com/opencontainers/image-spec v1.0.2-0.20190823105129-775207bd45b6 // indirect
github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.7.0
github.com/stretchr/testify v1.6.1
Expand All @@ -27,7 +25,6 @@ require (
golang.org/x/net v0.0.0-20201224014010-6772e930b67b // indirect
golang.org/x/sys v0.0.0-20210108172913-0df2131ae363 // indirect
golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf // indirect
golang.org/x/text v0.3.4 // indirect
google.golang.org/protobuf v1.25.0 // indirect
gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
Expand Down
Loading

0 comments on commit f4c893c

Please sign in to comment.