Skip to content

strict mode does not fail for "cannot find package" error #62

@ijc

Description

@ijc

I noticed that a project (moby/buildkit as it happens) was missing a dependency (you can see it here). I patched the check (./hack/validate-vendor and hack/dockerfiles/vendor.Dockerfile) thinking it would cause the check to fail but it did not:

$ git diff
diff --git a/hack/dockerfiles/vendor.Dockerfile b/hack/dockerfiles/vendor.Dockerfile
index 64cd656..ac82dfe 100644
--- a/hack/dockerfiles/vendor.Dockerfile
+++ b/hack/dockerfiles/vendor.Dockerfile
@@ -7,4 +7,4 @@ RUN go get -d github.com/LK4D4/vndr \
        && go install ./
 WORKDIR /go/src/github.com/moby/buildkit
 COPY . .
-RUN vndr --verbose
\ No newline at end of file
+RUN vndr --verbose --strict
[...]
$ ./hack/validate-vendor 
[...]
+ docker build --build-arg VNDR_VERSION=48ac2669d9d1bcacd3163650ef911edca2ec3b42 --iidfile /tmp/docker-iidfile.9obqMoTlAJ -f ./hack/dockerfiles/vendor.Dockerfile --force-rm .
[...]Step 7/7 : RUN vndr --verbose --strict
 ---> Running in 1c252b10149d
2018/03/08 14:26:15 Collecting initial packages
2018/03/08 14:26:15 Download dependencies
[...]
2018/03/08 14:27:11 Dependencies downloaded. Download time: 55.205977209s
2018/03/08 14:27:11 Collecting all dependencies
2018/03/08 14:27:13 	WARNING(verbose) github.com/tonistiigi/llb-gobuild: cannot find package "github.com/tonistiigi/llb-gobuild" in any of:
	/go/src/github.com/moby/buildkit/vendor/github.com/tonistiigi/llb-gobuild (vendor tree)
	/go/src/github.com/moby/buildkit/vendor/github.com/tonistiigi/llb-gobuild
	/usr/local/go/src/github.com/tonistiigi/llb-gobuild (from $GOROOT)
	/go/src/github.com/tonistiigi/llb-gobuild (from $GOPATH)
2018/03/08 14:27:14 Clean vendor dir from unused packages
2018/03/08 14:27:14 Success
2018/03/08 14:27:14 Running time: 59.498826306s
Removing intermediate container 1c252b10149d
 ---> cf2f4a83aad9
Successfully built cf2f4a83aad9
++ cat /tmp/docker-iidfile.9obqMoTlAJ
+ iid=sha256:cf2f4a83aad9c24e1e16e2ff5dc6fde8265d4872dbe1f6f91cc12bb7abded0e1
++ docker run sha256:cf2f4a83aad9c24e1e16e2ff5dc6fde8265d4872dbe1f6f91cc12bb7abded0e1 git status --porcelain -- vendor
+ diffs=
+ '[' '' ']'
+ echo 'Congratulations! All vendoring changes are done the right way.'
Congratulations! All vendoring changes are done the right way.
+ rm -f /tmp/docker-iidfile.9obqMoTlAJ

I think this should have failed.

The above is with 48ac266 but I have also reproduced with b57c579 which is the most recent master.

In fact with the most recent master it seems the WARNING has gone, even though llb-gobuild is still used -- the usage is in a example command (so a main package, but a few levels down in the source tree) so perhaps that got missed?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions