Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.gitignore,vendor.conf,Makefile: use vndr to manage dependencies for testing. #240

Merged
merged 5 commits into from
Feb 25, 2017

Conversation

erikh
Copy link
Contributor

@erikh erikh commented Feb 21, 2017

This PR allows us to test against known versions in a vendor.conf provided by
https://github.com/LK4D4/vndr, which is incorporated into the Makefile for
installation and use.

The goal of this PR is to allow us to both test against a specific set of
controllable versions and also refer to this set of versions as a canonical
"this is what we support", without actually forcing the libraries on anyone who
might want to import this package.

Makefile Outdated
go get -u github.com/LK4D4/vndr
vndr

test: vndr
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we might want to remove test-skopeo? @mtrmac @cyphar wdyt?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the moment I don't think we have enough (read: any) integration tests for me to say we should drop the only proper integration tests we have. In the future we should drop it IMO.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original goal of test-skopeo was to stop us from constantly breaking test-skopeo with API changes, without even realizing that we broke it; I think that still very much applies.

(In principle, we could instead have some kind of public API list and just fail tests every time we break the API. But at least the two of us would end up using that test failure to update skopeo, so for us it amounts to the same thing; not sure about other contributors.)

@erikh
Copy link
Contributor Author

erikh commented Feb 21, 2017 via email

@erikh erikh force-pushed the temp-vendor branch 2 times, most recently from 6e4c0ff to 702d3ce Compare February 21, 2017 10:44
@erikh
Copy link
Contributor Author

erikh commented Feb 21, 2017

figures; gopkg.in is busted right now.

@erikh erikh force-pushed the temp-vendor branch 2 times, most recently from 76f7420 to e5d6ea9 Compare February 21, 2017 10:57
@erikh
Copy link
Contributor Author

erikh commented Feb 21, 2017

blocked by containers/skopeo#312 -- @runcom can you help me with this one?

@erikh erikh mentioned this pull request Feb 21, 2017
@mtrmac
Copy link
Collaborator

mtrmac commented Feb 21, 2017

This primarily seems blocked by the vendor mechanism breaking API compatibility, see distribution/distribution#2130 for a full explanation.

When test-skopeo copies containers/image into skopeo’s vendor subdirectory, it must not copy containers/image/vendor in there as well.

(Being dragged kicking and screaming towards containers/image vendoring anything at all, I would still like it if it were very easy to run tests against the current or latest versions, i.e. using a separate non-default directory and an explicit GOPATH override to run the tests. But I can live with this.)

Makefile Outdated
go get -u github.com/LK4D4/vndr
vndr

test: deps
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this strictly necessary? Slowing down the edit-test cycle is not all that attractive, and I currently tend to use go build ./... && make .gitvalidation test validate instead of make all to avoid the deps step.

make all will run deps anyway.

At the very least, the vndr target should be able to use a timestamp so that vndr gets rerun only when vendor.conf is updated.

Makefile Outdated
@out="$$(golint ./...)"; \
if [ -n "$$(golint ./...)" ]; then \
@out="$$(golint $(PACKAGES))"; \
if [ -n "$$(golint $(PACKAGES))" ]; then \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, we are running golint twice here? Please replace the second reference with $$out, perhaps as a separate commit.

@erikh
Copy link
Contributor Author

erikh commented Feb 22, 2017

here's a solution to the multi-vendor problem which I think also resolves your concerns about wanting to move away from the vendor directory when you need to.

If the vendor directory is populated at all in the repo, the vndr target will now quietly succeed without running, allowing for improved test times AND the ability to populate your own vendor directory without fear of having it wiped out.

Work for you? I also resolved the golint issues.

@mtrmac
Copy link
Collaborator

mtrmac commented Feb 22, 2017

Thanks, this does work for me.

Perhaps it would be possible to do

vendor: vendor.conf
	go get -u github.com/LK4D4/vndr && vndr

(or perhaps there would have to be a separate timestamp file, in case vndr runs but decides not to change anything?) to actually take advantage of make, in particular for a vendor.conf update to cause vndr to be run automatically — but I am perfectly happy with the current Makefile which runs vndr once on initial checkout, and requires manual reruns.

I guess containers/skopeo#304 would end up with decisions how to manage the dependency list, no need to rehash that here.

As for the current test failure:

When test-skopeo copies containers/image into skopeo’s vendor subdirectory, it must not copy containers/image/vendor in there as well.

@runcom
Copy link
Member

runcom commented Feb 23, 2017

we need this in order to bump image-spec to RC5 and adapt the code for the new ManifestIndex stuff (I'm already working on it but waiting to have these things settled before making a PR)

Makefile Outdated

# This is not run as part of (make all), but Travis CI does run this.
# Demonstarting a working version of skopeo (possibly with modified SKOPEO_REPO/SKOPEO_BRANCH, e.g.
# make test-skopeo SKOPEO_REPO=runcom/skopeo-1 SKOPEO_BRANCH=oci-3 SUDO=sudo
# ) is a requirement before merging; note that Travis will only test
# the master branch of the upstream repo.
test-skopeo:
test-skopeo: clean
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is extremely non-obvious why the clean here matters, and it is unintuitive that make test-something modifies the vendored libraries in the current directory.

At the very least this needs a detailed comment explaining why the “clean” here is essential and shouldn’t be removed; but I’d much prefer dropping this dependency, and doing rm -rf $${vendor_path} && cp -r . $${vendor_path} && rm -rf $${vendor_path}/vendor below.

@erikh
Copy link
Contributor Author

erikh commented Feb 23, 2017 via email

@erikh
Copy link
Contributor Author

erikh commented Feb 23, 2017 via email

@erikh
Copy link
Contributor Author

erikh commented Feb 23, 2017 via email

Copy link
Collaborator

@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@mtrmac
Copy link
Collaborator

mtrmac commented Feb 24, 2017

👍 for pullapprove

Approved with PullApprove

@runcom
Copy link
Member

runcom commented Feb 24, 2017

👍

Approved with PullApprove

@runcom
Copy link
Member

runcom commented Feb 24, 2017

Needs one last rebase

Erik Hollensbe added 2 commits February 25, 2017 02:15
@erikh
Copy link
Contributor Author

erikh commented Feb 25, 2017

it is done

@runcom runcom merged commit b968abc into containers:master Feb 25, 2017
@mtrmac
Copy link
Collaborator

mtrmac commented Feb 27, 2017

If the vendor directory is populated at all in the repo, the vndr target will now quietly succeed without running, allowing for improved test times AND the ability to populate your own vendor directory without fear of having it wiped out.

(This has somehow disappeared? Anyway, being dealt with in #242; I am just mildly curious what has happened.)

@erikh
Copy link
Contributor Author

erikh commented Feb 27, 2017

I'm confused too :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants