Skip to content

Commit

Permalink
Use 'host' network in deb container builds (#1071)
Browse files Browse the repository at this point in the history
The --network argument was added to 'docker build' in Docker 1.13 in
2017 and behaves like the --net argument to 'docker run'.

We're already using --net=host during the actual deb build and during
all of the RPM containers. The change here is to also use host
networking during the build phase.

The intent here is to support more self-contained building scenarios
where a repository may be on localhost.
  • Loading branch information
cottsay authored Nov 1, 2024
1 parent 383dc7c commit d136ce3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions ros_buildfarm/templates/release/deb/binarypkg_job.xml.em
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ but disabled since the package is blacklisted (or not whitelisted) in the config
'echo "# BEGIN SECTION: Build Dockerfile - binarydeb task"',
'cd $WORKSPACE/docker_generating_docker',
'python3 -u $WORKSPACE/ros_buildfarm/scripts/misc/docker_pull_baseimage.py',
'docker build --force-rm -t binarydeb_task_generation.%s_%s_%s_%s_%s .' % (rosdistro_name, os_name, os_code_name, arch, pkg_name),
'docker build --network=host --force-rm -t binarydeb_task_generation.%s_%s_%s_%s_%s .' % (rosdistro_name, os_name, os_code_name, arch, pkg_name),
'echo "# END SECTION"',
'',
'echo "# BEGIN SECTION: Run Dockerfile - binarydeb task"',
Expand All @@ -138,6 +138,7 @@ but disabled since the package is blacklisted (or not whitelisted) in the config
' --rm ' +
' --cidfile=$WORKSPACE/docker_generating_docker/docker.cid' +
' -e=TRAVIS=$TRAVIS' +
' --net=host' +
' -e=ROS_BUILDFARM_PULL_REQUEST_BRANCH=$ROS_BUILDFARM_PULL_REQUEST_BRANCH' +
' -v $WORKSPACE/ros_buildfarm:/tmp/ros_buildfarm:ro' +
' -v $WORKSPACE/binarydeb:/tmp/binarydeb' +
Expand All @@ -159,7 +160,7 @@ but disabled since the package is blacklisted (or not whitelisted) in the config
'# build and run build_binarydeb Dockerfile',
'cd $WORKSPACE/docker_build_binarydeb',
'python3 -u $WORKSPACE/ros_buildfarm/scripts/misc/docker_pull_baseimage.py',
'docker build --force-rm -t binarydeb_build.%s_%s_%s_%s_%s .' % (rosdistro_name, os_name, os_code_name, arch, pkg_name),
'docker build --network=host --force-rm -t binarydeb_build.%s_%s_%s_%s_%s .' % (rosdistro_name, os_name, os_code_name, arch, pkg_name),
'echo "# END SECTION"',
'',
'echo "# BEGIN SECTION: Run Dockerfile - build binarydeb"',
Expand Down Expand Up @@ -224,7 +225,7 @@ but disabled since the package is blacklisted (or not whitelisted) in the config
@# 'echo "# BEGIN SECTION: Build Dockerfile - install"',
@# 'cd $WORKSPACE/docker_install_binarydeb',
@# 'python3 -u $WORKSPACE/ros_buildfarm/scripts/misc/docker_pull_baseimage.py',
@# 'docker build --force-rm -t binarydeb_install.%s_%s_%s_%s_%s .' % (rosdistro_name, os_name, os_code_name, arch, pkg_name),
@# 'docker build --network=host --force-rm -t binarydeb_install.%s_%s_%s_%s_%s .' % (rosdistro_name, os_name, os_code_name, arch, pkg_name),
@# 'echo "# END SECTION"',
@# '',
@# 'echo "# BEGIN SECTION: Run Dockerfile - install"',
Expand Down
2 changes: 1 addition & 1 deletion ros_buildfarm/templates/release/deb/sourcepkg_job.xml.em
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ but disabled since the package is blacklisted (or not whitelisted) in the config
'echo "# BEGIN SECTION: Build Dockerfile - generate sourcedeb"',
'cd $WORKSPACE/docker_sourcedeb',
'python3 -u $WORKSPACE/ros_buildfarm/scripts/misc/docker_pull_baseimage.py',
'docker build --force-rm -t sourcedeb.%s_%s_%s_%s .' % (rosdistro_name, os_name, os_code_name, pkg_name),
'docker build --network=host --force-rm -t sourcedeb.%s_%s_%s_%s .' % (rosdistro_name, os_name, os_code_name, pkg_name),
'echo "# END SECTION"',
'',
'echo "# BEGIN SECTION: Run Dockerfile - generate sourcedeb"',
Expand Down

0 comments on commit d136ce3

Please sign in to comment.