-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Replace makefile with a bash script #107
Conversation
Another improvement that could be made is to handle the case where |
Definitely an improvement. A few suggestions:
|
4707e16
to
faf70cf
Compare
Fixed the README and added a usage. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
couple of nits, but LGTM.
tasks
Outdated
|
||
Run a project task in the appropriate Docker image. | ||
|
||
TASK may be the name of a target in the Makefile or one of: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use
make -qp | awk -F':' '/^[a-zA-Z0-9][^$#\/\t=]*:([^=]|$)/ {split($1,A,/ /);for(i in A)print A[i]}' | sort -u
To display the Makefile targets? (Stolen from SO).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was looking at that too. My concern is that this runs on the host, so now instead of just requiring bash
on the host we'd also be requiring make, awk, and sort (with versions that support those flags). I guess in most cases anyone with bash would have awk and sort, but possible not make.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can have it test for make and awk presence and use your message if it is not present
README.md
Outdated
@@ -9,32 +9,33 @@ Docker EE products. | |||
Development | |||
=========== | |||
|
|||
`docker/cli` is developed using Docker. | |||
`docker/cli` is developed using Docker. The `./tasks` script is used to run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm confusing by what this means 😅. Can it be simplified?
Something like:
The
./tasks
script allows one to build and develop thecli
via Docker images. For local development, theMakefile
can be used directly with the same commands described below for./tasks
.
This can probably be made better too though. cc @mstanleyjones ? :)
Yes, please. Why can only circle https://github.com/docker/cli/blob/master/circle.yml#L19 build things correctly and not me? Btw, that line seems like serious anti-pattern, we are never testing the pristine source code in CI. Actually there is no place in local development either where I could verify that build/test ran on an unmodified source. If you use mounts locally then you never know what was used as source as these are mutable in any stage. I'm bit confused why we need to reinvent the wheel here. Makefile is very popular, much more readable than bash, not less windows friendly than bash. Has nice features like completion, sane logging and query features. Atm, to get any reasonable results I have to use it with We already discussed it in #99 but one the problems I have is that we use wrong defaults. The default operations known for every developer are the ones that don't work. You have to read the docs to see that although there is a |
Ok, I can add the DOCKER_HOST check for TCP. That should allow us to run this script in CI, which is great.
I don't understand this statement. How are we not? We're not making any modifications to the source files. The Dockerfiles are development configs, not the object under test. If the issue is the
What do you mean by unmodified? The entire purpose of development is to modify the source, so I want my tests to run on what is in my current directory, nothing else.
I think we are greatly overestimating the popularity of makefiles. They are popular for a lot of c/c++ projects where they are a good tool for the job. They are not a good tool for running docker commands.
If I understand this argument it's that you expect We aren't actually using any of the features of make. It is basically a heavily duplicated bash script. It seems very silly to me that we would make this a suggested workflow. |
f2afd13
to
1a7a853
Compare
If we aren't going to use make as an entrypoint then we should remove the Makefile. |
The Instead of removing it I'd like to add a warning to the We could also rename it and alias WDYT? |
Dockerfile's are part of the source same way as any other committed file. Yes, my comment was about that specific line.
The purpose is also to verify that specific commit passes all the jobs. If some random code-state that you can't reproduce or verify passed a test it doesn't provide much value.
What's so bad about |
I think the question is really the opposite. Why use a tool (make) that does nothing more than a bash script with lots of duplication? If every target is From this thread and the related issue I think it's clear that we have different workflows. The bash script allows us to support those different workflows without duplicating every target. The bash script allows us to optionally enable It also lets us experiment to figure out what we need from a better dev tool that we can use to replace |
bf1f293
to
524918c
Compare
Ok, I've made the following changes:
|
tasks
Outdated
fi | ||
|
||
echo "$dockerfile_source" | docker build -t "$image" -f "$dockerfile" . | ||
docker run $remove $cidfile $use_tty $mounts "$image" $cmd |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
while you're at it, this need to export VERSION
, GITCOMMIT
. BUILDTIME
and LDFLAGS
from the env (to match what's in scripts/build/.variables
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added, thanks!
524918c
to
12df9a4
Compare
I think the right long term solution for this will be to take what we end up with in bash, write it in GO , and extract anything that is project specific into a config file. That should produce a good prototype for a project tasks tool. |
This is definitely an improvement, I can build/test again without modifying the source. 👍 for that. |
12df9a4
to
760553b
Compare
rebased |
760553b
to
13f81dc
Compare
Codecov Report
@@ Coverage Diff @@
## master #107 +/- ##
==========================================
+ Coverage 48.85% 48.93% +0.08%
==========================================
Files 186 177 -9
Lines 12413 11846 -567
==========================================
- Hits 6064 5797 -267
+ Misses 5975 5687 -288
+ Partials 374 362 -12 |
fa2dddf
to
deb30f8
Compare
deb30f8
to
e26b924
Compare
I've got 2 LGTM on this, so moving to code review |
bbe553d
to
ad7d5ae
Compare
Looks like circleCI isn't running on some PRs, looking into it |
ad7d5ae
to
b119d74
Compare
b119d74
to
1051d40
Compare
1051d40
to
39b4934
Compare
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Use ./tasks in circleci List task targets with './tasks --help' Signed-off-by: Daniel Nephin <dnephin@docker.com>
The warning can be disabled by setting the environment variable Signed-off-by: Daniel Nephin <dnephin@docker.com>
Signed-off-by: Daniel Nephin <dnephin@docker.com>
3bf4540
to
37c1210
Compare
Replaced by #343. This PR seemed to be broken. github wasn't triggering any hooks. |
Related to #99
Replace a 70 line
.PHONY
Makefile with 40 lines of bash which actually does a lot more than the original Makefile. This bash script will allow the addition of new targets to theMakefile
without having to touch./tasks
.shell
prompts are provided to all images without any additional configuration.I don't necessarily think this is the best solution, but I think it's an improvement over the Makefile.