Skip to content

Commit 61bd849

Browse files
authored
fix: unmask loading errors (#434)
1 parent 52e5d8e commit 61bd849

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

bazel/container_structure_test.bzl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ def _structure_test_impl(ctx):
5454
if ctx.attr.driver != "docker":
5555
fail("when the 'driver' attribute is not 'docker', then the image must be a .tar file")
5656
fixed_args.extend(["--image-from-oci-layout", "$(rlocation %s)" % image_path])
57-
fixed_args.extend(["--default-image-tag", "registry.structure_test.oci.local/image:$DIGEST"])
5857

5958
for arg in ctx.files.configs:
6059
fixed_args.extend(["--config", "$(rlocation %s)" % to_rlocation_path(ctx, arg)])

cmd/container-structure-test/app/cmd/test.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
"io"
2020
"os"
2121
"runtime"
22+
2223
"github.com/GoogleContainerTools/container-structure-test/cmd/container-structure-test/app/cmd/test"
2324
v1 "github.com/opencontainers/image-spec/specs-go/v1"
2425

@@ -150,9 +151,18 @@ func run(out io.Writer) error {
150151
logrus.Fatalf("could parse the default image tag %s: %v", opts.DefaultImageTag, err)
151152
}
152153
}
153-
if _, err = daemon.Write(tag, img); err != nil {
154+
var r string
155+
if r, err = daemon.Write(tag, img); err != nil {
154156
logrus.Fatalf("error loading oci layout into daemon: %v, %s", err)
155157
}
158+
// For some reason, daemon.Write doesn't return errors for some edge cases.
159+
// We should always print what the daemon sent back so that errors are transparent.
160+
fmt.Println("Loaded ", tag.String(), r)
161+
162+
_, err = daemon.Image(tag)
163+
if err != nil {
164+
logrus.Fatalf("error loading oci layout into daemon: %v", err)
165+
}
156166

157167
opts.ImagePath = tag.String()
158168
args.Image = tag.String()

0 commit comments

Comments
 (0)