Skip to content

Carry #27834 — Do not require .git in the build context#30290

Merged
thaJeztah merged 4 commits intomoby:masterfrom
vdemeester:carry-pr-27834
Feb 5, 2017
Merged

Carry #27834 — Do not require .git in the build context#30290
thaJeztah merged 4 commits intomoby:masterfrom
vdemeester:carry-pr-27834

Conversation

@vdemeester
Copy link
Copy Markdown
Member

Carry #27834 and hopefully fixes builds 👼.

  • Add .git to .dockerignore
  • export DOCKER_GITCOMMIT in the Makefile
  • prioritize DOCKER_GITCOMMIT against the git command in
    ./hack/make.sh
  • Also add integration-cli/bundles to gitignore (it's generated when
    using integration-cli shell)

Note that, on my laptop for example, I'm sending 30M of context with this, and 150M without 🙀, so I really think this can be a huge win 👼

/cc @tianon @jhowardmsft @icecrime @thaJeztah @cpuguy83

🐸

@vdemeester
Copy link
Copy Markdown
Member Author

Had to re-open because I force-pushed the branch before re-opening the PR... 😅
Now that 1.13.0 is out, I'll update the Janky builds to take care of that

@thaJeztah thaJeztah added the status/failing-ci Indicates that the PR in its current state fails the test suite label Jan 19, 2017
@lowenna
Copy link
Copy Markdown
Member

lowenna commented Jan 20, 2017

@vdemeester - Think I've got all the remaining bits for Windows done. Can you cherry-pick microsoft@e969eab from https://github.com/Microsoft/docker/tree/jjh/gitignore?

I am just doing the final validations to the CI script itself so that it works in the current mode (with .git present in the docker image) and this new mode (without .git in the docker image). Once I've done that, I'll update production Jenkins and things should be good :)

@GordonTheTurtle GordonTheTurtle added the dco/no Automatically set by a bot when one of the commits lacks proper signature label Jan 24, 2017
John Howard and others added 3 commits January 24, 2017 14:42
Signed-off-by: John Howard <jhoward@microsoft.com>
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
- export DOCKER_GITCOMMIT in the Makefile
- prioritize DOCKER_GITCOMMIT against the `git` command in
  `./hack/make.sh`
- Also add `integration-cli/bundles` to gitignore (it's generated when
  using integration-cli shell)

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Signed-off-by: John Howard jhoward@microsoft.com
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
@GordonTheTurtle GordonTheTurtle removed the dco/no Automatically set by a bot when one of the commits lacks proper signature label Jan 24, 2017
@vdemeester
Copy link
Copy Markdown
Member Author

Updated.. Something bad though, is that some of the validate scripts (lots) are using git to validate only changes 😓 I wonder what to do there /cc @tiborvass @tianon

@dnephin
Copy link
Copy Markdown
Member

dnephin commented Jan 24, 2017

Bind mount .git! Really we should be bind mounting . I think.

@vdemeester
Copy link
Copy Markdown
Member Author

Ok so it's green, I did 2 things:

  • On the CI, I am binding .git when validate (and only when validate)
  • On the Makefile I always bind .git (not a huge fan be…) — this means validation won't work if remote daemon. I should probably make it "conditionnal" but …

@vdemeester vdemeester removed the status/failing-ci Indicates that the PR in its current state fails the test suite label Jan 30, 2017
Copy link
Copy Markdown
Member

@dnephin dnephin left a comment

Choose a reason for hiding this comment

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

LGTM

Bind mounts are necessary.

Copy link
Copy Markdown
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

tested this, and looks to all work, so LGM

but, would like to have @tianon @andrewhsu @cpuguy83 @tiborvass double check if there's possible issues with bind-mounting

.dockerignore Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I thought this is already gone via #29121 ...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ah you are right 👼 I'll update 😉

Makefile Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This line could be written more concisely by taking the second -v part completely out of the $(if...), ie:

DOCKER_MOUNT := $(if $(DOCKER_MOUNT),$(DOCKER_MOUNT),-v /go/src/github.com/docker/docker/bundles) -v $(CURDIR)/.git:/go/src/github.com/docker/docker/.git

I'm definitely concerned about what this might mean for remote daemons (since DOCKER_MOUNT already takes DOCKER_HOST into account), but I'm not sure that there's a good solution for that. Perhaps it'd be fine if those validate scripts simply are not supported with a remote daemon unless one explictly removes .git from the .dockerignore?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

ah right. Yeah we might print a warning if validate is called on a remote daemon, wdyt ?

hack/make.sh Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This line already exists above (line 72) -- any reason it needs to be repeated here? (we need BUILDTIME set regardless, so I think the one up on line 72 is correct)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Hum, I don't think there is a reason for that, I'll remove 👼

@tianon
Copy link
Copy Markdown
Member

tianon commented Feb 3, 2017 via email

@LK4D4
Copy link
Copy Markdown
Contributor

LK4D4 commented Feb 3, 2017

ping @cpuguy83

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Copy link
Copy Markdown
Member

@cpuguy83 cpuguy83 left a comment

Choose a reason for hiding this comment

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

LGTM

This actually works out well because now I can build with separate worktrees (git worktree add ../other-docker my_branch)

@thaJeztah
Copy link
Copy Markdown
Member

I'll go ahead and merge this, looks like we have enough LGTM's 🏎 🐎

@thaJeztah thaJeztah merged commit 4af2555 into moby:master Feb 5, 2017
@GordonTheTurtle GordonTheTurtle added this to the 1.14.0 milestone Feb 5, 2017
@vdemeester vdemeester deleted the carry-pr-27834 branch February 5, 2017 07:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants