Feature: --no-cache takes a regexp to ignore matching lines in Dockerfile#4322
Feature: --no-cache takes a regexp to ignore matching lines in Dockerfile#4322timruffles wants to merge 1 commit intomoby:masterfrom
Conversation
|
pull request for #1996 |
|
I fear this deserves an example, also, which regexp's are you supporting? ( http://en.wikipedia.org/wiki/Regular_expression#Standards ) |
|
@SvenDowideit good points. Added an example, and specified that it's a golang regexp |
|
oh gosh - for an awful lot of people saying 'golang regexp' will make them groan, both as it implies that golang hasn't implemented one of the standard regexp syntax's, and worse, isn't used by enough people that use the horrid corners of regexp. Going off and reading the regexp package docs suggests to me that it might be a good idea to link to https://code.google.com/p/re2/wiki/Syntax - as that gives a good over-view of what is, and isn't supported. |
|
As @SvenDowideit has stated above, we can't simply tell people that it's a 'golang regexp'. This also needs some examples, in addition to a link to the regexp syntax documentation. |
|
I'll add some extra docs and examples. As a thought - would limiting it to POSIX regexp be a good idea? It's a better known syntax, has a smaller API surface area, and is less likely to change than RE2. The use case is normally '--no-cache "git clone"' so POSIX regexp should be plenty to cover it. |
|
I prefer standards - it makes it easier for us to communicate :) |
|
@SvenDowideit agreed - I'd feel more confident to see POSIX in a tool than almost-RE2 :) Changed to use POSIX ERE throughout, updated docs, and added an example. |
|
Docs LGTM |
1 similar comment
|
Docs LGTM |
|
I'm seeing a failure in the tests: |
|
@unclejack sorry for slow reply - tests were passing for me, still passing now (rebased all new work). |
api/client.go
Outdated
There was a problem hiding this comment.
Could we make this a generic RegexFlag? What do you think? I also think this struct can be moved into the /opts package.
|
I'm getting a build error root@9509f414ea95:/go/src/github.com/dotcloud/docker# ./hack/make.sh binary test test-integration
---> Making bundle: binary (in bundles/0.9.1-dev/binary)
# github.com/dotcloud/docker/server
server/server.go:29: runtime redeclared as imported package name
previous declaration at server/server.go:16
server/server.go:2458: undefined: runtime.Runtime |
integration/buildfile_test.go
Outdated
There was a problem hiding this comment.
You can group and simplify this with
var (
useCacheRe *regexp.Regexp
ignoreCacheRe = regexp.MustCompilePOSIX(".*")
)|
@vieux Can you take a look at the |
|
flags look ok, @shykes what do you think about the feature |
|
Updated with approach @tianon suggested in #1996. It adds a new The PR is rough and non-working after these changes - can't test as can't pull images while accessing internet via tethering. Wanted to check the approach & docs (cc @SvenDowideit) are acceptable before continuing! |
…file - modifies CLI and server to accept a regexp for no-cache - adds defaultable flags to mflag to support existing bool no-cache - applies to matching RUN and ADD lines Docker-DCO-1.1-Signed-off-by: Tim Ruffles <oi@truffles.me.uk> (github: timruffles)
|
I am a +1 on this feature, we discussed it a few times. I will gladly take it, however as a general rule please don't assign PRs to others - they should be self-assigned, otherwise I worry that we will start mentally labelling it as spam and ignoring assignment. |
|
@vieux are you going to carry this PR or do you want me to? |
|
@timruffles do you have time to work on this ? |
|
Sure - I guess it just needs merging? On Thursday, 31 July 2014, Victor Vieux <notifications@github.com
|
|
@timruffles you last commit is completely broken. I guess you somehow messed up when you pushed. For example https://github.com/docker/docker/pull/4322/files#diff-e728bf75e7a6536ac0e70b85f7aaf65aR111 It's a |
|
Yes, sorry - should have read my own comment. I pushed stuff I couldn't compile/build as my dev env was all screwed up and I had no internet. Looks like quite a big merge job as lots of files have moved. I'm working on it now, and having great fun with boot2docker not working. |
|
@timruffles I'm closing this for now. Feel free to update your branch and comment below we will gladly reopen it. |
|
What ever became of this idea? |
|
This proposal will solve this issue, and in much more elegant way, IMO. If what folks are looking for is a way to invalidate cache when something like a git repo actually changes you could take the following approach: $>docker build --build-arg git_commit=$(git rev-parse HEAD) ...
//the file:
FROM busybox
RUN git clone https://git.foo.com/myrepo.git
ARG git_commit
RUN git fetch https://git.foo.com/myrepo.git $git_commit
RUN git merge $git_commitThe proposed patch has been merged or approved, I believe, so hopefully we'll see it out soon. |
|
in the more generic case you can also do: will never cache from that RUN line thru the rest of the Dockerfile. Just too bad that people need the hack in the first place. |
Closes #1996