Skip to content

Commit

Permalink
fix: unmask loading errors
Browse files Browse the repository at this point in the history
  • Loading branch information
thesayyn committed Apr 17, 2024
1 parent 56b620a commit 798335f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
1 change: 0 additions & 1 deletion bazel/container_structure_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ def _structure_test_impl(ctx):
if ctx.attr.driver != "docker":
fail("when the 'driver' attribute is not 'docker', then the image must be a .tar file")
fixed_args.extend(["--image-from-oci-layout", "$(rlocation %s)" % image_path])
fixed_args.extend(["--default-image-tag", "registry.structure_test.oci.local/image:$DIGEST"])

for arg in ctx.files.configs:
fixed_args.extend(["--config", "$(rlocation %s)" % to_rlocation_path(ctx, arg)])
Expand Down
12 changes: 11 additions & 1 deletion cmd/container-structure-test/app/cmd/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"io"
"os"
"runtime"

"github.com/GoogleContainerTools/container-structure-test/cmd/container-structure-test/app/cmd/test"
v1 "github.com/opencontainers/image-spec/specs-go/v1"

Expand Down Expand Up @@ -150,9 +151,18 @@ func run(out io.Writer) error {
logrus.Fatalf("could parse the default image tag %s: %v", opts.DefaultImageTag, err)
}
}
if _, err = daemon.Write(tag, img); err != nil {
var r string
if r, err = daemon.Write(tag, img); err != nil {
logrus.Fatalf("error loading oci layout into daemon: %v, %s", err)
}
// For some reason, daemon.Write doesn't return errors for some edge cases.
// We should always print what the daemon sent back so that errors are transparent.
fmt.Println("Loaded ", tag.String(), r)

_, err = daemon.Image(tag)
if err != nil {
logrus.Fatalf("error loading oci layout into daemon: %v", err)
}

opts.ImagePath = tag.String()
args.Image = tag.String()
Expand Down

0 comments on commit 798335f

Please sign in to comment.