isri-aist / BaselineWalkingController

Humanoid walking controller with various baseline methods
https://isri-aist.github.io/BaselineWalkingController
BSD 2-Clause "Simplified" License
110 stars 19 forks source link

[CI] Run CI on docker image for PR branches (second) #2

Closed mmurooka closed 1 year ago

mmurooka commented 1 year ago

Try the same thing as https://github.com/isri-aist/BaselineWalkingController/pull/1 again. This time, using docker save/load.

mmurooka commented 1 year ago

One drawback: Uploading docker image as artifact takes about 17 minutes longer than pushing docker image to docker repo.

Upload docker image as artifact

Save image for CI: 2m 59s Upload image for CI: 16min 25s Total of above two: 19min 24s https://github.com/isri-aist/BaselineWalkingController/runs/8285047390?check_suite_focus=true

Push docker image to docker repo

Push image for CI: 2m 34s https://github.com/isri-aist/BaselineWalkingController/runs/8262127017?check_suite_focus=true

mmurooka commented 1 year ago

Completed working and CI succeeds. The only concern is that the time will be longer, as mentioned in https://github.com/isri-aist/BaselineWalkingController/pull/2#issuecomment-1242822089

mmurooka commented 1 year ago

The only concern is that the time will be longer, as mentioned in https://github.com/isri-aist/BaselineWalkingController/pull/2#issuecomment-1242822089

To alleviate this, I tried deleting the src and build directories, but the size of the docker image remained almost the same. https://github.com/isri-aist/BaselineWalkingController/pull/2/commits/e82f20105ef97d5ce022de32714a78367b2f0852 before: 5.75 GB => after: 5.75 GB

Maybe it's because all the histories are saved?

mmurooka commented 1 year ago

To alleviate this, I tried deleting the src and build directories, but the size of the docker image remained almost the same.

I checked which files are large. The libraries installed on the system seem to account for the majority.

root@740ef1b2c3f2:~# du -h -d0 /home/
4.0K    /home/
root@740ef1b2c3f2:~# du -h -d0 /root/
947M    /root/
root@740ef1b2c3f2:~# du -h -d0 / 2> /dev/null 
6.3G    /
root@740ef1b2c3f2:~# du -h -d2 / 2> /dev/null  | sort -r -h | head
6.3G    /
5.1G    /usr
3.7G    /usr/lib
947M    /root
945M    /root/catkin_ws
817M    /usr/share
339M    /usr/include
247M    /usr/bin
119M    /var
117M    /opt/ros
root@740ef1b2c3f2:~# du -h -d2 /usr/lib 2> /dev/null  | sort -r -h | head
3.7G    /usr/lib
2.3G    /usr/lib/x86_64-linux-gnu
440M    /usr/lib/python3/dist-packages
440M    /usr/lib/python3
398M    /usr/lib/jvm/java-11-openjdk-amd64
398M    /usr/lib/jvm
219M    /usr/lib/gcc/x86_64-linux-gnu
219M    /usr/lib/gcc
83M /usr/lib/python2.7
69M /usr/lib/x86_64-linux-gnu/dri
root@740ef1b2c3f2:~# du -h -d2 /usr/lib/x86_64-linux-gnu 2> /dev/null  | sort -r -h | head
2.3G    /usr/lib/x86_64-linux-gnu
69M /usr/lib/x86_64-linux-gnu/dri
28M /usr/lib/x86_64-linux-gnu/jni
24M /usr/lib/x86_64-linux-gnu/perl/5.30.0
24M /usr/lib/x86_64-linux-gnu/perl
19M /usr/lib/x86_64-linux-gnu/lapack
16M /usr/lib/x86_64-linux-gnu/samba
13M /usr/lib/x86_64-linux-gnu/vdpau
13M /usr/lib/x86_64-linux-gnu/openmpi
12M /usr/lib/x86_64-linux-gnu/sane
# From host side
$ docker images ghcr.io/isri-aist/baseline_walking_controller
REPOSITORY                                      TAG       IMAGE ID       CREATED             SIZE
ghcr.io/isri-aist/baseline_walking_controller   latest    a89f9b5cc7da   About an hour ago   6.05GB
gergondet commented 1 year ago

The only concern is that the time will be longer, as mentioned in #2 (comment)

To alleviate this, I tried deleting the src and build directories, but the size of the docker image remained almost the same. e82f201 before: 5.75 GB => after: 5.75 GB

Maybe it's because all the histories are saved?

I think you have to make this into a single step in the Dockerfile (i.e. clone everything, build, then remove the build and src folder) otherwise this creates multiple layers in the docker image and the cleanup step does not remove anything.

Or there may be a docker command to compact the steps from the base image to the result state into a single layer, sorry for being a little vague about it, I really need to up my docker game :-D

mmurooka commented 1 year ago

To run simulation with many combination settings efficiently with CI, we push the docker image in the first build job and pull it in the next simulation job. (From https://github.com/isri-aist/BaselineWalkingController/pull/1#issuecomment-1221542044)

Since CI for standalone only took about 5 minutes to build, I came to think that it is not that bad idea to build for every test case. (It takes about 3 minutes to push and pull a docker image now.)

mmurooka commented 1 year ago

Since CI for standalone only took about 5 minutes to build, I came to think that it is not that bad idea to build for every test case. (It takes about 3 minutes to push and pull a docker image now.)

https://github.com/isri-aist/BaselineWalkingController/commit/e4d8e60bf0eef4237e73aec4658f96bd49bb51f9 and the several commits around it have stopped the use of docker for exhaustive test case simulation. The problem in this PR is no longer present, so I am closing it.