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

Fork dockerfile #125

Merged
merged 5 commits into from
Mar 8, 2019
Merged

Fork dockerfile #125

merged 5 commits into from
Mar 8, 2019

Conversation

vrothberg
Copy link
Member

@vrothberg vrothberg commented Mar 7, 2019

commit 7629533 (HEAD -> fork-dockerfile, master)
Author: Valentin Rothberg [email protected]
Date: Thu Mar 7 13:25:53 2019 +0100

fork github.com/docker/docker/builder/dockerfile                     

The package has been changed upstream quite a bit.  As imagebuilder  
relies on the old API, it is incompatible with newer versions of     
Moby.  This enforces users of imagebuilder to use an outdated version
of Moby.

Fork github.com/docker/docker/builder/dockerfile to overcome the     
incompatibility issue and to allow us to fix potential issues        
independently.

All code has been copied from github.docker/docker, so we need to    
mention that.  As the files don't have license headers, adding a     
NOTICE files seems like a suitable alternative.                      

Fixes: #116
Signed-off-by: Valentin Rothberg <[email protected]>               

commit 81424bf
Author: Valentin Rothberg [email protected]
Date: Thu Mar 7 13:10:38 2019 +0100

make test: don't recurse into vendor directory                       

Signed-off-by: Valentin Rothberg <[email protected]>               

commit 279dc3b
Author: Valentin Rothberg [email protected]
Date: Thu Mar 7 12:13:11 2019 +0100

use `vndr` for dependency management

Signed-off-by: Valentin Rothberg <[email protected]>               

@openshift-ci-robot openshift-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Mar 7, 2019
@vrothberg
Copy link
Member Author

@rhatdan @nalind @TomSweeneyRedHat PTAL (Cc @siretart)

The project seems to be using glide and godeps for dependency management. Do you think it's possible to move over to vndr?

@vrothberg
Copy link
Member Author

The PR requires some more work to untangle Docker. I will give vndr a shot to see what we can do.

@vrothberg vrothberg changed the title Fork dockerfile WIP - Fork dockerfile Mar 7, 2019
@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 7, 2019
Signed-off-by: Valentin Rothberg <[email protected]>
The package has been changed upstream quite a bit.  As imagebuilder
relies on the old API, it is incompatible with newer versions of
Moby.  This enforces users of imagebuilder to use an outdated version
of Moby.

Fork github.com/docker/docker/builder/dockerfile to overcome the
incompatibility issue and to allow us to fix potential issues
independently.

All code has been copied from github.docker/docker, so we need to
mention that.  As the files don't have license headers, adding a
NOTICE files seems like a suitable alternative.

Fixes: #116
Signed-off-by: Valentin Rothberg <[email protected]>
@openshift-ci-robot openshift-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Mar 7, 2019
Signed-off-by: Valentin Rothberg <[email protected]>
vrothberg added a commit to vrothberg/buildah that referenced this pull request Mar 7, 2019
@vrothberg
Copy link
Member Author

Things are green now but I opened containers/buildah#1390 to increase confidence.

vrothberg added a commit to vrothberg/buildah that referenced this pull request Mar 7, 2019
vrothberg added a commit to vrothberg/buildah that referenced this pull request Mar 7, 2019
@vrothberg vrothberg changed the title WIP - Fork dockerfile Fork dockerfile Mar 7, 2019
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 7, 2019
vrothberg added a commit to vrothberg/buildah that referenced this pull request Mar 7, 2019
vrothberg added a commit to vrothberg/buildah that referenced this pull request Mar 7, 2019
@vrothberg
Copy link
Member Author

containers/buildah#1390 is green besides a gofmt complaint.

@rhatdan @TomSweeneyRedHat PTAL

@rhatdan
Copy link
Contributor

rhatdan commented Mar 7, 2019

LGTM

vendor.conf Outdated
@@ -0,0 +1,21 @@
github.com/Azure/go-ansiterm d6e3b3328b783f23731bc4d058875b0371ff8109
github.com/containerd/continuity 004b46473808b3e7a4a3049c20e4376c91eb966d
github.com/docker/docker 86f080cff0914e9694068ed78d503701667c4c00
Copy link
Contributor

Choose a reason for hiding this comment

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

OK, this is likely a question that will lead to Go learning for me. How did you pick this commit? It seems to be a couple years old now, is that the one that was in play currently prior to adding vendor.conf?

@TomSweeneyRedHat
Copy link
Contributor

Probably more GoLang learnings for me, but here goes. So I'm curios as to why you forked /moby/builder/dockerfile into imagebuilder instead of vendoring it too? Would vendoring it give us headaches given we fork all of Docker already? Can/should we add a README.md file to the new dockerfile directory listing the date and commitID that had been forked?

I'd like a head nod from @nalind too.

vrothberg added a commit to vrothberg/buildah that referenced this pull request Mar 8, 2019
@vrothberg
Copy link
Member Author

vrothberg commented Mar 8, 2019

Probably more GoLang learnings for me, but here goes. So I'm curios as to why you forked /moby/builder/dockerfile into imagebuilder instead of vendoring it too? Would vendoring it give us headaches given we fork all of Docker already?

The problem we had prior to this PR is that imagebuilder is using the dockerfile package from Docker. But over time, the dockerfile package has been changed upstream so that imagebuilder won't compile with any recent version of github.com/docker/docker. This is why Buildah and Podman vendor a very old version of docker/docker: they depend on imagebuilder which just won't compile.

@siretart mentioned this issue again recently as he is looking into the Debian packaging where all vendored dependencies must be put into their own, separate package. Since there is already a Docker package (including sources) in Debian it would be extremely unfortunate to have another Docker package just because some dependency of Podman/Buildah is incompatible. Actually, I am certain that the Debian packaging reviews would claim that upstream is broken and that it should be fixed there.

The fix in this PR is to "fork" the dockerfile package by bascically just copying the files from a known working state. However, imagebuilder itself is still limited with respect to using newer versions of docker/docker as it does not vendor upstream github.com/fsouza/go-dockerclient but a downstream one with the following patch which is (again) incompatible with newer versions of Docker: https://github.com/openshift/go-dockerclient/commits/openshift-4.0

Note that Buildah and Podman can use a newer version of docker/docker as we don't need the patch mentioned above (I also updated the Buildah PR to demonstrate that) as we can just update to a newer version of github.com/fsouza/go-dockerclient (we don't need the patch). But I cannot put enough emphasis on the fact that anybody who is trying to use imagebuilder or buildah or libpod - no matter if it's for integration or for packaging - has to go through this hairy ball of dependencies. Also, we cannot update the vendored libraries to fetch (bug) fixes which is a bit scary.

I think such situations should be future blockers from adding any dependency to our tools and libraries as we inherit the problems and pass them on to the users.

Can/should we add a README.md file to the new dockerfile directory listing the date and commitID that had been forked?

That's a good idea but I will add it to dockerfile/NOTICE.

That's the version used in the dockerfile fork.  Also mention in
dockerfile/NOTICE that b68221c37ee597950364788204546f9c9d0e46a1
is the commit we used for the fork.

Signed-off-by: Valentin Rothberg <[email protected]>
@rhatdan
Copy link
Contributor

rhatdan commented Mar 8, 2019

/approve
/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Mar 8, 2019
@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rhatdan, siretart, vrothberg

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 8, 2019
@openshift-merge-robot openshift-merge-robot merged commit 705fe92 into openshift:master Mar 8, 2019
@TomSweeneyRedHat
Copy link
Contributor

@vrothberg thank you very much for the very thorough reply. Sounds a bit scary to me, we may want to set up a card (epic) in jira to really scrub this out at some point.

@vrothberg vrothberg deleted the fork-dockerfile branch March 8, 2019 15:26
vrothberg added a commit to vrothberg/buildah that referenced this pull request Mar 12, 2019
openshift/imagebuilder had a dependency on a deprecated package that is
now forked into imagebuilder to allow using more recent versions of
docker/docker.

Also vendor the latest docker/docker to a) demonstrate that imagebuilder
does not force using an old version docker/docker and to b) pull in
fixes and updates to our dependencies on docker/docker.

See openshift/imagebuilder#125 for more details
on the imagebuilder change.

Signed-off-by: Valentin Rothberg <[email protected]>
rh-atomic-bot pushed a commit to containers/buildah that referenced this pull request Mar 12, 2019
openshift/imagebuilder had a dependency on a deprecated package that is
now forked into imagebuilder to allow using more recent versions of
docker/docker.

Also vendor the latest docker/docker to a) demonstrate that imagebuilder
does not force using an old version docker/docker and to b) pull in
fixes and updates to our dependencies on docker/docker.

See openshift/imagebuilder#125 for more details
on the imagebuilder change.

Signed-off-by: Valentin Rothberg <[email protected]>

Closes: #1390
Approved by: rhatdan
@siretart
Copy link

Valentin, I'm still running into issues with compiling this revision:

	cd obj-x86_64-linux-gnu && go install -gcflags=all=\"-trimpath=/<<BUILDDIR>>/golang-github-openshift-imagebuilder-1.0\+git20190308.705fe92/obj-x86_64-linux-gnu/src\" -asmflags=all=\"-trimpath=/<<BUILDDIR>>/golang-github-openshift-imagebuilder-1.0\+git20190308.705fe92/obj-x86_64-linux-gnu/src\" -v -p 4 github.com/openshift/imagebuilder github.com/openshift/imagebuilder/cmd/imagebuilder github.com/openshift/imagebuilder/dockerclient github.com/openshift/imagebuilder/dockerfile github.com/openshift/imagebuilder/dockerfile/command github.com/openshift/imagebuilder/dockerfile/parser github.com/openshift/imagebuilder/dockerfile/parser/dumper github.com/openshift/imagebuilder/imageprogress github.com/openshift/imagebuilder/signal github.com/openshift/imagebuilder/strslice
src/github.com/openshift/imagebuilder/dockerfile/builder.go:16:2: cannot find package "github.com/docker/docker/builder/dockerfile/command" in any of:
	/usr/lib/go-1.11/src/github.com/docker/docker/builder/dockerfile/command (from $GOROOT)
	/<<BUILDDIR>>/golang-github-openshift-imagebuilder-1.0+git20190308.705fe92/obj-x86_64-linux-gnu/src/github.com/docker/docker/builder/dockerfile/command (from $GOPATH)
src/github.com/openshift/imagebuilder/dockerfile/builder.go:17:2: cannot find package "github.com/docker/docker/builder/dockerfile/parser" in any of:
	/usr/lib/go-1.11/src/github.com/docker/docker/builder/dockerfile/parser (from $GOROOT)
	/<<BUILDDIR>>/golang-github-openshift-imagebuilder-1.0+git20190308.705fe92/obj-x86_64-linux-gnu/src/github.com/docker/docker/builder/dockerfile/parser (from $GOPATH)
src/github.com/docker/docker/container/container.go:22:2: cannot find package "github.com/docker/docker/daemon/exec" in any of:
	/<<BUILDDIR>>/golang-github-openshift-imagebuilder-1.0+git20190308.705fe92/obj-x86_64-linux-gnu/src/github.com/docker/docker/vendor/github.com/docker/docker/daemon/exec (vendor tree)
	/usr/lib/go-1.11/src/github.com/docker/docker/daemon/exec (from $GOROOT)
	/<<BUILDDIR>>/golang-github-openshift-imagebuilder-1.0+git20190308.705fe92/obj-x86_64-linux-gnu/src/github.com/docker/docker/daemon/exec (from $GOPATH)
src/github.com/docker/docker/container/container.go:23:2: cannot find package "github.com/docker/docker/daemon/logger" in any of:
	/<<BUILDDIR>>/golang-github-openshift-imagebuilder-1.0+git20190308.705fe92/obj-x86_64-linux-gnu/src/github.com/docker/docker/vendor/github.com/docker/docker/daemon/logger (vendor tree)
	/usr/lib/go-1.11/src/github.com/docker/docker/daemon/logger (from $GOROOT)
	/<<BUILDDIR>>/golang-github-openshift-imagebuilder-1.0+git20190308.705fe92/obj-x86_64-linux-gnu/src/github.com/docker/docker/daemon/logger (from $GOPATH)
src/github.com/docker/docker/container/container.go:24:2: cannot find package "github.com/docker/docker/daemon/logger/jsonfilelog" in any of:
	/<<BUILDDIR>>/golang-github-openshift-imagebuilder-1.0+git20190308.705fe92/obj-x86_64-linux-gnu/src/github.com/docker/docker/vendor/github.com/docker/docker/daemon/logger/jsonfilelog (vendor tree)
	/usr/lib/go-1.11/src/github.com/docker/docker/daemon/logger/jsonfilelog (from $GOROOT)
	/<<BUILDDIR>>/golang-github-openshift-imagebuilder-1.0+git20190308.705fe92/obj-x86_64-linux-gnu/src/github.com/docker/docker/daemon/logger/jsonfilelog (from $GOPATH)
src/github.com/docker/docker/container/container.go:25:2: cannot find package "github.com/docker/docker/daemon/logger/local" in any of:
	/<<BUILDDIR>>/golang-github-openshift-imagebuilder-1.0+git20190308.705fe92/obj-x86_64-linux-gnu/src/github.com/docker/docker/vendor/github.com/docker/docker/daemon/logger/local (vendor tree)
	/usr/lib/go-1.11/src/github.com/docker/docker/daemon/logger/local (from $GOROOT)
	/<<BUILDDIR>>/golang-github-openshift-imagebuilder-1.0+git20190308.705fe92/obj-x86_64-linux-gnu/src/github.com/docker/docker/daemon/logger/local (from $GOPATH)
[...]

And many similar instances. I notice that https://github.com/openshift/imagebuilder/blob/master/dockerfile/builder.go still references github.com/docker/docker/builder/dockerfile/* imports. Is that intentional or an oversight? Wasn't the goal to avoid the dependency on the github.com/docker/docker/builder/* imports?

BTW, I notice that http://github.com/docker/docker is redirecting to https://github.com/moby/moby. Doesn't that also imply that every import of anything underneath github.com/docker/docker would need updating? - I'm a bit confused right now.

@vrothberg
Copy link
Member Author

And many similar instances. I notice that https://github.com/openshift/imagebuilder/blob/master/dockerfile/builder.go still references github.com/docker/docker/builder/dockerfile/* imports. Is that intentional or an oversight? Wasn't the goal to avoid the dependency on the github.com/docker/docker/builder/* imports?

That was pretty big oversight. Thanks for bringing this up! I'll have another shot.

BTW, I notice that http://github.com/docker/docker is redirecting to https://github.com/moby/moby. Doesn't that also imply that every import of anything underneath github.com/docker/docker would need updating? - I'm a bit confused right now.

Docker is redirecting to Moby while all packages in Moby are still using the "old" docker/docker references. Imagebuilder, however, is still trapped on an ancient version of Docker as mentioned in #125 (comment).

@vrothberg
Copy link
Member Author

Here's a PR aiming at cleaning up the remaining bits in dockerfile: #127

I deleted all the files that we don't need in imagebuilder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants