opencontainers / image-tools

OCI Image Tooling
https://opencontainers.org
Apache License 2.0
266 stars 82 forks source link

Unable to install using instructions #241

Open anoronh4 opened 4 months ago

anoronh4 commented 4 months ago

I am attempting to install image-tools on my MacOS, and I am not super familiar with go, to be honest. My goal is to validate images before pushing to a registry.

following your instructions, i am able to get the following working

$ go get -d github.com/opencontainers/image-tools/cmd/oci-image-tool

but the cd command doesn't work because it seems to go to a different path. here's the Makefiles i found in my GOPATH:

./pkg/mod/github.com/cpuguy83/go-md2man/v2@v2.0.2/Makefile
./pkg/mod/github.com/opencontainers/image-tools@v0.3.0/Makefile
./pkg/mod/github.com/opencontainers/runtime-spec@v1.2.0/Makefile
./pkg/mod/github.com/opencontainers/runtime-spec@v1.2.0/schema/Makefile
./pkg/mod/github.com/opencontainers/image-spec@v1.1.0/Makefile
./pkg/mod/github.com/pkg/errors@v0.9.1/Makefile

so i changed directory to the image-tools one. but when I run make all i have the following error:

$ make all
go build -ldflags "-X main.gitCommit=" -o oci-image-tool ./cmd/oci-image-tool
cmd/oci-image-tool/main.go:21:2: cannot find package "github.com/Sirupsen/logrus" in any of:
    /usr/local/Cellar/go/1.22.1/libexec/src/github.com/Sirupsen/logrus (from $GOROOT)
    /Users/noronhaa/Documents/rungo/src/github.com/Sirupsen/logrus (from $GOPATH)
cmd/oci-image-tool/validate.go:23:2: cannot find package "github.com/opencontainers/image-spec/schema" in any of:
    /usr/local/Cellar/go/1.22.1/libexec/src/github.com/opencontainers/image-spec/schema (from $GOROOT)
    /Users/noronhaa/Documents/rungo/src/github.com/opencontainers/image-spec/schema (from $GOPATH)
cmd/oci-image-tool/create.go:21:2: cannot find package "github.com/opencontainers/image-tools/image" in any of:
    /usr/local/Cellar/go/1.22.1/libexec/src/github.com/opencontainers/image-tools/image (from $GOROOT)
    /Users/noronhaa/Documents/rungo/src/github.com/opencontainers/image-tools/image (from $GOPATH)
cmd/oci-image-tool/main.go:22:2: cannot find package "github.com/opencontainers/image-tools/version" in any of:
    /usr/local/Cellar/go/1.22.1/libexec/src/github.com/opencontainers/image-tools/version (from $GOROOT)
    /Users/noronhaa/Documents/rungo/src/github.com/opencontainers/image-tools/version (from $GOPATH)
cmd/oci-image-tool/validate.go:25:2: cannot find package "github.com/pkg/errors" in any of:
    /usr/local/Cellar/go/1.22.1/libexec/src/github.com/pkg/errors (from $GOROOT)
    /Users/noronhaa/Documents/rungo/src/github.com/pkg/errors (from $GOPATH)
cmd/oci-image-tool/create.go:22:2: cannot find package "github.com/urfave/cli" in any of:
    /usr/local/Cellar/go/1.22.1/libexec/src/github.com/urfave/cli (from $GOROOT)
    /Users/noronhaa/Documents/rungo/src/github.com/urfave/cli (from $GOPATH)
make: *** [tool] Error 1

I still get the logrus error even after installing that package. Seems like go or the Makefile wants to find files and installations at very specific locations but my paths are all messed up. Can you provide guidance on this?

coolljt0725 commented 4 months ago

This project is not actively maintainerd, you can try alternative project: https://github.com/opencontainers/umoci

anoronh4 commented 3 months ago

it doesn't seem like umoci can perform validation according to this issue: https://github.com/opencontainers/umoci/issues/361

cyphar commented 3 months ago

Indeed, I haven't yet sat down to do that (it will require a fairly significant rework because a missing feature of image-tools is to allow you to validate multiple versions of the spec -- the inability to do this makes it hard to update both upstream and downstream). image-tools also cannot validate modern images, which is making it difficult to update umoci to use a newer version of the spec...