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

Add DOCKER_PULL option #283

Merged
merged 2 commits into from
Jul 11, 2018

Conversation

mathias-luedtke
Copy link
Member

This PR adds a flag to disable automatic pull of images.
Setting it to false assumes that the (base) image was already pulled or provided otherwise.

Cherry-picked from #279 and extended to include DOCKER_BASE_IMAGE.
I will update #279 and #280 afterwards.

The test jobs are run on gitlab only: https://gitlab.com/ipa-mdl/industrial_ci/pipelines/23079479

If image in DOCKER_IMAGE has been created locally, docker pull would fail.
This was referenced Jun 6, 2018
@mathias-luedtke
Copy link
Member Author

@miguelprada: Do you have time for a review?

@130s
Copy link
Member

130s commented Jul 11, 2018

I can get to review this in a few hours hopefully

* **DOCKER_BUILD_OPTS** (default: not set): Used do specify additional build options for Docker.
* **DOCKER_FILE** (default: not set): Instead of pulling an images from the Docker hub, build it from the given path or URL. Please note, this disables the handling of `ROS_REPOSITORY_PATH` and `ROS_DISTRO`, they have to be set in the build file instead.
* **DOCKER_IMAGE** (default: not set): Selects a Docker images different from default one. Please note, this disables the handling of `ROS_REPOSITORY_PATH` and `ROS_DISTRO` as ROS needs already to be installed in the image.
* **DOCKER_PULL** (default: true): set to false if custom docker image should not be pulled, e.g. if it was created locally
Copy link
Member

Choose a reason for hiding this comment

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

If false, shouldn't some other DOCKER* variable need to be passed? If that is correct, let's add that as a note (if I'm wrong, sorry in advance).

Copy link
Member Author

Choose a reason for hiding this comment

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

These have to be passed anyway. It just adds the option to not pull the image before the run.
This can be used to create the image in another Gitlab stage, which then can be reused in other jobs.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, but what's the necessary variable set might not be obvious for esp. users new to this feature. Maybe adding a small sample section is a way to go (I think the tests you're adding in this PR can be used there).

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually, I have added this just for #279. Most users don' t have to deal with this.

Copy link
Member

Choose a reason for hiding this comment

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

I can open another PR for doc then.

@@ -135,6 +135,9 @@ function docker_cp {
#######################################
function ici_docker_build() {
local opts=($DOCKER_BUILD_OPTS)
if [ "$DOCKER_PULL" != false ]; then
Copy link
Member

Choose a reason for hiding this comment

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

By mistake users can pass DOCKER_PULL with invalid values (similar to #296). So it'd be nice for this if logic to be strict.

Copy link
Member Author

Choose a reason for hiding this comment

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

For now I don't want to check these cases, because we don't have the proper infrastructure (something like #285)

Copy link
Member

Choose a reason for hiding this comment

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

Agreed. That is better than repeating to embed same/similar if-else logic.

Copy link
Member

@130s 130s left a comment

Choose a reason for hiding this comment

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

Nice idea!

I just left a few comments for discussion, which may or may not need to be addressed.

@130s 130s merged commit f531acd into ros-industrial:master Jul 11, 2018
@130s 130s mentioned this pull request Jul 11, 2018
6 tasks
@mathias-luedtke mathias-luedtke deleted the feature/docker-pull branch February 7, 2019 15:56
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.

2 participants