Split docker-py tests from main image#37939
Split docker-py tests from main image#37939adrielldagasuan wants to merge 1 commit intomoby:masterfrom
Conversation
|
Is the janky build doing |
thaJeztah
left a comment
There was a problem hiding this comment.
Thanks for working on this! I left some thoughts inline, but only gave it a quick look. 😅
Dockerfile.test
Outdated
There was a problem hiding this comment.
nit: missing a newline at the end
Also, the WORKDIR can be move more to the top (even before the first RUN), so that this step can be cached, even if the DOCKER_PY_COMMIT changes
Dockerfile.test
Outdated
There was a problem hiding this comment.
I assume docker-pycred and yamllint can be installed independently from docker-py, so it's best to put them in their own RUN.
Dockerfile.test
Outdated
There was a problem hiding this comment.
To optimise for caching, installation of docker-py should be in its own RUN. That way installation of the packages installed through apt-get ... will be cached, and only the cache for files installed for docker-py will be busted if DOCKER_PY_COMMIT changes
RUN git clone https://github.com/docker/docker-py.git /docker-py \
&& cd /docker-py \
&& git checkout -q $DOCKER_PY_COMMIT \
&& pip install -r test-requirements.txt
Dockerfile.test
Outdated
There was a problem hiding this comment.
Hm.. I'm personally never a fan of an empty default for FROM; ideally, it would have a sensible default, so that I can build the image successfully (docker build ..) without having to specify a --build-arg.
That will be a bit tricky in this case though
There was a problem hiding this comment.
Now that buildkit will be more used overall, perhaps we could still include the docker-py image as a build-stage in the main Dockerfile; buildkit will skip that stage if it's not needed, and only build if the --target actually needs the build stage.
Doing so may make the FROM xyz easier to do.
@shin- @cpuguy83 @tonistiigi any suggestions?
|
Looks like CI is failing on this; |
|
Thanks @thaJeztah for the quick review. I'll take your feedback and submit some changes. Some question on the janky build though. Is it just running |
|
Based from TOOLS.md
which leaves me to believe that it's not using the Makefile at all, but rather it has its instruction configured in Jenkins directly. For this change to pass the CI, I have to modify the Jenkins config to run the tests on the docker-test image, rather than the docker-dev image. But that might be hard to do considering that the Jenkins config applies to all PRs. Until we use Jenkinsfiles which will allow a different pipeline per build, I think this will be stuck for a while. That said, it might be worth doing that change first (mentioned in #36416), to allow for changes like these to work. I can push the changes to address the feedback from but at the same time still waiting for comments regarding including the docker-py stage in the main docker-dev image (but having the option to skip it). Thoughts @thaJeztah @vdemeester ? |
fb67373 to
07fd590
Compare
|
Please sign your commits following these rules: $ git clone -b "36145-splitting-docker-py-section" git@github.com:adrielldagasuan/moby.git somewhere
$ cd somewhere
$ git commit --amend -s --no-edit
$ git push -fAmending updates the existing PR. You DO NOT need to open a new one. |
Codecov Report
@@ Coverage Diff @@
## master #37939 +/- ##
=========================================
Coverage ? 36.1%
=========================================
Files ? 610
Lines ? 45126
Branches ? 0
=========================================
Hits ? 16293
Misses ? 26594
Partials ? 2239 |
Signed-off-by: Adriell Matthew Julius Dagasuan <adrielldagasuan@gmail.com>
07fd590 to
78c655e
Compare
|
Updated the code based on the feedback. But I don't think this will pass the CI since the CI has to be updated to pass --target=test. The final image wouldn't have the docker-py content. So if the CI has to run the docker-py tests, it has to either to pass the target flag. |
|
@adrielldagasuan can you fix those failing tests? |
|
obsoleted by #39068 thanks @adrielldagasuan for working on this though! |
Signed-off-by: Adriell Matthew Julius Dagasuan adrielldagasuan@gmail.com
- What I did
Addressed: #36415. Moved the docker-py tests from main docker-dev image into another docker-test image that will be used for testing
- How I did it
Removed the docker-py section from the main Dockerfile
Removed the installation of python-* packages from the main Dockerfile
Created Dockerfile.test as another image used for testing docker-py (and potentially other test scenarios)
Updated Makefile to build Dockerfile.test and use the image for testing
- How to verify it
Run
make test-docker-py. It should build 2 images.Verify that a docker-test image was created alongside the docker-dev image.
Verify that the docker-test image is larger than the docker-dev image, with the extra docker-py objects as well as the python-* packages.
Verify that the docker-dev image does not have the /docker-py directory by doing
docker run ... docker-dev:<tag> bash -c "ls /"- Description for the changelog
Moved docker-py tests off the main docker-dev image into separate docker-test image
- A picture of a cute animal (not mandatory but encouraged)
