Skip to content
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

Moveit2 ci #46

Merged
merged 3 commits into from
Mar 25, 2019
Merged

Moveit2 ci #46

merged 3 commits into from
Mar 25, 2019

Conversation

mlautman
Copy link
Contributor

@mlautman mlautman commented Mar 15, 2019

Description

TODO: resolve with #44 and #37

Create a moveit_ci branch that passes travis.

Ports the MoveIt ci Dockerfile to ROS2
Removes shadow-fixed since ROS2 does not provide shadow-fixed packages
Removes experimental docker recipe since it is not available for ROS2

Checklist

  • Required by CI: Code is auto formatted using clang-format
  • Extended the tutorials / documentation, if necessary reference
  • Include a screenshot if changing a GUI
  • Document API changes relevant to the user in the moveit/MIGRATION.md notes
  • Created tests, which fail without this PR reference
  • Decide if this should be cherry-picked to other current ROS branches
  • While waiting for someone to review your request, please consider reviewing another open pull request to support the maintainers

.docker/ci/Dockerfile Outdated Show resolved Hide resolved
.docker/source/Dockerfile Outdated Show resolved Hide resolved
moveit.rosinstall Outdated Show resolved Hide resolved
moveit.rosinstall Outdated Show resolved Hide resolved
moveit.rosinstall Outdated Show resolved Hide resolved
moveit.rosinstall Outdated Show resolved Hide resolved
@mlautman mlautman changed the title Moveit2 ci WIP: Moveit2 ci Mar 15, 2019
.docker/ci/Dockerfile Outdated Show resolved Hide resolved
.docker/ci/Dockerfile Outdated Show resolved Hide resolved
.docker/ci/Dockerfile Outdated Show resolved Hide resolved
.docker/ci-shadow-fixed/Dockerfile Show resolved Hide resolved
.docker/experimental/Dockerfile Show resolved Hide resolved
.travis.yml Outdated Show resolved Hide resolved
.travis.yml Outdated Show resolved Hide resolved
moveit.rosinstall Outdated Show resolved Hide resolved
moveit_core/package.xml Outdated Show resolved Hide resolved
moveit_core/package.xml Outdated Show resolved Hide resolved
.docker/ci/Dockerfile Outdated Show resolved Hide resolved
@mlautman
Copy link
Contributor Author

@davetcoleman

Copy link
Contributor

@rhaschke rhaschke left a comment

Choose a reason for hiding this comment

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

A few minor remarks.
Furthermore, I suggest to factor out the COLCON_IGNORE files into a separate PR.
They are not related to the Dockerfiles, are they?
If we merge-commit this PR, it should be fine though as you have split the individual commits.

.docker/ci/Dockerfile Outdated Show resolved Hide resolved
.docker/ci/Dockerfile Outdated Show resolved Hide resolved
.docker/ci/Dockerfile Outdated Show resolved Hide resolved
.docker/ci/Dockerfile Outdated Show resolved Hide resolved
.docker/ci/Dockerfile Show resolved Hide resolved
.docker/release/Dockerfile Show resolved Hide resolved
.docker/source/Dockerfile Outdated Show resolved Hide resolved
.docker/source/Dockerfile Outdated Show resolved Hide resolved
moveit.rosinstall Outdated Show resolved Hide resolved
@mlautman
Copy link
Contributor Author

@rhaschke @davetcoleman Changes have been applied and dockerhub is now successfully building moveit/moveit:crystal-ci

Ready for merge? (after changing the url's to master branch)

@mlautman mlautman requested a review from rhaschke March 18, 2019 21:27
@mlautman mlautman changed the title WIP: Moveit2 ci Moveit2 ci Mar 18, 2019
Copy link
Contributor

@rhaschke rhaschke left a comment

Choose a reason for hiding this comment

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

A few remaining suggestions...

.docker/ci/Dockerfile Show resolved Hide resolved
.docker/ci/Dockerfile Outdated Show resolved Hide resolved
.docker/ci/Dockerfile Outdated Show resolved Hide resolved
.docker/ci/Dockerfile Outdated Show resolved Hide resolved
@mlautman mlautman mentioned this pull request Mar 19, 2019
7 tasks
@mlautman mlautman requested a review from rhaschke March 19, 2019 23:05
@mlautman
Copy link
Contributor Author

@rhaschke When you are happy with this PR, feel free to update the url's and squash-merge. Or I can take care of it

.docker/ci/Dockerfile Outdated Show resolved Hide resolved
.docker/ci/Dockerfile Outdated Show resolved Hide resolved
.docker/ci/Dockerfile Outdated Show resolved Hide resolved
.docker/ci/Dockerfile Outdated Show resolved Hide resolved
.docker/ci/Dockerfile Outdated Show resolved Hide resolved
.docker/ci/Dockerfile Show resolved Hide resolved
.docker/ci/Dockerfile Outdated Show resolved Hide resolved
.docker/ci/Dockerfile Outdated Show resolved Hide resolved
.docker/source/Dockerfile Outdated Show resolved Hide resolved
@mlautman mlautman mentioned this pull request Mar 25, 2019
7 tasks
@mlautman
Copy link
Contributor Author

@rhaschke If there are no remaining issues with this PR I wold like to keep this effort moving along. I have separated the changes into #57 and #56 so that these changes only touch docker. Docker will fail until those PR's are merged.

Let's get this merged :)

Copy link
Member

@henningkayser henningkayser left a comment

Choose a reason for hiding this comment

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

Just some minor points before I approve

flake8-docstrings \
flake8-import-order \
flake8-quotes \
# git+https://github.com/lark-parser/lark.git@0.7d \
Copy link
Member

Choose a reason for hiding this comment

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

what's this line?

# Install Fast-RTPS dependencies
RUN apt-get -qq update && \
apt-get install -qq --no-install-recommends -y \
libasio-dev \
Copy link
Member

Choose a reason for hiding this comment

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

These could be moved to the 'apt-get install...' block above so we don't need to call an extra update

Copy link
Member

Choose a reason for hiding this comment

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

Splitting apt-get install .. commands like this is accepted (and best) practice in Dockerfiles. It allows for better reuse of cached layers.


# Download all MoveIt dependencies
RUN \
apt-get -qq update && \
Copy link
Member

Choose a reason for hiding this comment

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

we just ran update, no?

Copy link
Member

@gavanderhoorn gavanderhoorn Mar 25, 2019

Choose a reason for hiding this comment

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

Yes, but rm -rf /var/lib/apt/lists/* removed the local apt indices (again best practice to avoid layer bloat).

Copy link
Contributor

Choose a reason for hiding this comment

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

I see. Having separate apt-get commands and removing the apt caches, avoids layer bloat.
However, it leaves us with multiple update commands, downloading the caches.
I'm fine with it, if this is best-practice nowadays. Probably dockerhub has a good network connection 😉

WORKDIR $ROS_WS

# Update apt package list as previous containers clear the cache
RUN apt-get -qq update && \
Copy link
Member

Choose a reason for hiding this comment

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

I think these RUN commands should be combined again eventually.

Copy link
Member

Choose a reason for hiding this comment

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

But that would negatively impact layer reuse/caching (see above).

Copy link
Contributor

@rhaschke rhaschke left a comment

Choose a reason for hiding this comment

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

I really would like to merge these asap, but you introduced some important performance regressions. Please talk to Dave about these issues first. If he agrees to merge this PR anyway to progress on CI, that's fine for me. But you should tackle those issues immediately after in another PR.


ENV TERM xterm

# Setup catkin workspace
ENV CATKIN_WS=/root/ws_moveit
WORKDIR $CATKIN_WS
ENV ROS_WS=/opt/ws_moveit
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure why you changed the original location at all. But /opt seems to be rather weird for a temporary and private folder. I suggest to use ros_ws as folder name (as everywhere else now) and /tmp to indicate temporary usage.

Suggested change
ENV ROS_WS=/opt/ws_moveit
ENV ROS_WS=/tmp/ros_ws

Copy link
Contributor

Choose a reason for hiding this comment

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

Developers often mount /tmp in the container to an external volume to cache filesystems, proxies, and workspaces between the host. I don't think it would helpful to place the workspace that the Dockerfile is to build at the only root folder that is frequently overloaded from docker volumes.

.docker/ci/Dockerfile Show resolved Hide resolved
.docker/ci/Dockerfile Show resolved Hide resolved
.docker/ci/Dockerfile Show resolved Hide resolved
# Clear apt-cache to reduce image size
rm -rf /var/lib/apt/lists/*

# Remove the source code from this container
# TODO: in the future we may want to keep this here for further optimization of later containers
RUN cd $ROS_WS && \
Copy link
Contributor

Choose a reason for hiding this comment

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

The whole ROS_WS can be removed, right?

This command should be part of the same command downloading the MoveIt sources.
As @davetcoleman teached me a year? ago, commands creating and removing files/folders should be kept together in a single docker RUN command. For each RUN command a new image layer is added for all filesystem changes in this command. So, if we add and remove files in separate commands, we need to save and download the layer caches for both, additions and removals, while if both shell commands are handled in the same docker command, there are virtually no changes to save and download.

Copy link
Contributor

Choose a reason for hiding this comment

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

In view of #46 (comment), I think keeping separate commands for apt-get is fine.
However, downloading MoveIt sources, installing dependencies via rosdep, and cleaning should all be handled in a single command then to minimize layer size.
Do you agree @ruffsl / @gavanderhoorn?

Copy link
Contributor

Choose a reason for hiding this comment

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

However, downloading MoveIt sources, installing dependencies via rosdep, and cleaning should all be handled in a single command then to minimize layer size.

Given that we are now cleaning up after ourselves after each RUN invocation and apt installation, there is little tangible difference in overall size, while at the same time we gain finer granularity in our build caching.

The whole ROS_WS can be removed, right?

Acutely, I think we should omit this sanitization step entirely. It's rather valuable to have the exact source code on hand in the image that was used in building the binaries in the workspace. In navigation2, we use the existing source in the workspace baked into the image to seed the keys for later CI caching, as it worthwhile be able to determine if source code dependencies have changed from the latest pull. Cleaning the existing source I think is best left to the CI script that is to use the image, as we do via a pre_checkout step here:

https://github.com/ros-planning/navigation2/blob/bbbaf6d0cde05e89db871601677f134a823e13b3/.circleci/config.yml#L3-L11

Copy link
Contributor

@rhaschke rhaschke Mar 26, 2019

Choose a reason for hiding this comment

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

For this use case, we have a different docker container: source.
Here, the workspace is only needed to pull in dependencies! We don't (yet) compile any binaries in this docker image.

@ruffsl
Copy link
Contributor

ruffsl commented Mar 25, 2019

Linking to #46 (comment) as it was prematurely resolved. Do we really want to lose the traceability in determining the source code that was used in crating the workspace binaries?

Copy link
Member

@henningkayser henningkayser left a comment

Choose a reason for hiding this comment

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

All right, I think this PR is good for now and can be merged.

@kingmodus
Copy link

😛

@mlautman mlautman dismissed rhaschke’s stale review March 25, 2019 23:55

Let's tackle the remaining open questions in a separate PR

@mlautman mlautman merged commit 27ab801 into moveit:master Mar 25, 2019
@mlautman mlautman deleted the moveit2-ci branch March 25, 2019 23:55
@rhaschke
Copy link
Contributor

Let's tackle the remaining open questions in a separate PR.

@mlautman, I hope you will do so. I'm tired to clean up after your PRs.

@rhaschke rhaschke mentioned this pull request May 15, 2019
JafarAbdi pushed a commit to JafarAbdi/moveit2 that referenced this pull request Oct 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants