Skip to content

Commit a7c41fb

Browse files
Split windows dockerfiles for different ROS distros. (#451)
1 parent 23ae3ce commit a7c41fb

4 files changed

Lines changed: 167 additions & 4 deletions

File tree

job_templates/ci_job.xml.em

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ colcon_branch: ${build.buildVariableResolver.resolve('CI_COLCON_BRANCH')}, <br/>
103103
use_whitespace: ${build.buildVariableResolver.resolve('CI_USE_WHITESPACE_IN_PATHS')}, <br/>
104104
isolated: ${build.buildVariableResolver.resolve('CI_ISOLATED')}, <br/>
105105
ubuntu_distro: ${build.buildVariableResolver.resolve('CI_UBUNTU_DISTRO')}, <br/>
106+
ros_distro: ${build.buildVariableResolver.resolve('CI_ROS_DISTRO')}, <br/>
106107
colcon_mixin_url: ${build.buildVariableResolver.resolve('CI_COLCON_MIXIN_URL')}, <br/>
107108
cmake_build_type: ${build.buildVariableResolver.resolve('CI_CMAKE_BUILD_TYPE')}, <br/>
108109
build_args: ${build.buildVariableResolver.resolve('CI_BUILD_ARGS')}, <br/>
@@ -357,8 +358,12 @@ setlocal enableDelayedExpansion
357358
rmdir /S /Q ws workspace "work space"
358359

359360
echo "# BEGIN SECTION: Build DockerFile"
360-
set CONTAINER_NAME=ros2_windows_ci_msvc%CI_VISUAL_STUDIO_VERSION%
361-
set DOCKERFILE=windows_docker_resources\Dockerfile.msvc%CI_VISUAL_STUDIO_VERSION%
361+
@# Eloquent uses the Dashing Dockerfile.
362+
if "!CI_ROS_DISTRO!" == "eloquent" (
363+
set "CI_ROS_DISTRO=dashing"
364+
)
365+
set CONTAINER_NAME=ros2_windows_ci_%CI_ROS_DISTRO%
366+
set DOCKERFILE=windows_docker_resources\Dockerfile.%CI_ROS_DISTRO%
362367

363368
rem "Change dockerfile once per day to invalidate docker caches"
364369
powershell "(Get-Content ${Env:DOCKERFILE}).replace('@@todays_date', $(Get-Date).ToLongDateString()) | Set-Content ${Env:DOCKERFILE}"

job_templates/packaging_job.xml.em

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ All packages listed here have to be available from either the primary or supplem
110110
@[if 'linux' in os_name]@
111111
ubuntu_distro: ${build.buildVariableResolver.resolve('CI_UBUNTU_DISTRO')}, <br/>
112112
@[end if]@
113+
ros_distro: ${build.buildVariableResolver.resolve('CI_ROS_DISTRO')}, <br/>
113114
branch: ${build.buildVariableResolver.resolve('CI_BRANCH_TO_TEST')}, <br/>
114115
ci_branch: ${build.buildVariableResolver.resolve('CI_SCRIPTS_BRANCH')}, <br/>
115116
repos_url: ${build.buildVariableResolver.resolve('CI_ROS2_REPOS_URL')}, <br/>
@@ -343,8 +344,12 @@ setlocal enableDelayedExpansion
343344
rmdir /S /Q ws workspace
344345

345346
echo "# BEGIN SECTION: Build DockerFile"
346-
set CONTAINER_NAME=ros2_windows_ci_msvc%CI_VISUAL_STUDIO_VERSION%
347-
set DOCKERFILE=windows_docker_resources\Dockerfile.msvc%CI_VISUAL_STUDIO_VERSION%
347+
@# Eloquent uses the Dashing Dockerfile.
348+
if "!CI_ROS_DISTRO!" == "eloquent" (
349+
set "CI_ROS_DISTRO=dashing"
350+
)
351+
set CONTAINER_NAME=ros2_windows_ci_%CI_ROS_DISTRO%
352+
set DOCKERFILE=windows_docker_resources\Dockerfile.%CI_ROS_DISTRO%%
348353

349354
rem "Change dockerfile once per day to invalidate docker caches"
350355
powershell "(Get-Content ${Env:DOCKERFILE}).replace('@@todays_date', $(Get-Date).ToLongDateString()) | Set-Content ${Env:DOCKERFILE}"
File renamed without changes.
Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
# escape=`
2+
# This Dockerfile needs to be built from the parent directory (ros2/ci) so the build context
3+
# includes the python scripts
4+
5+
# To find this value run in powershell:
6+
# $(Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion').ReleaseId
7+
ARG WINDOWS_RELEASE_ID=1909
8+
9+
# In order to ensure the image is correctly compatible with the host system a
10+
# more precise version than the release id is required. To find this value run
11+
# the following in powershell.
12+
# $(Get-ItemProperty -Path 'HKLM:SOFTWARE\Microsoft\Windows NT\CurrentVersion\Update\TargetingInfo\Installed\Server.OS.amd64' -Name Version).Version"
13+
# Fall back to the Release ID
14+
ARG WINDOWS_RELEASE_VERSION=$WINDOWS_RELEASE_ID
15+
16+
# Indicates that the windows image will be used as the base image. Must be same or older than host.
17+
# --isolation=hyperv is needed for both build/run if the image id is older than the host id
18+
# Use --isolation=process if you need to build in a mounted volume
19+
FROM mcr.microsoft.com/windows:$WINDOWS_RELEASE_VERSION
20+
21+
# These are versioned files, so they shouldn't invalidate caches. Renaming to fixed names.
22+
# Regularly updated installers are next to their associated code.
23+
ADD https://github.com/ADLINK-IST/opensplice/releases/download/OSPL_V6_9_190925OSS_RELEASE/PXXX-VortexOpenSplice-6.9.190925OSS-HDE-x86_64.win-vs2019-installer.zip C:\TEMP\OpenSplice.zip
24+
25+
# OpenSSL
26+
ADD https://slproweb.com/download/Win64OpenSSL-1_0_2u.exe C:\TEMP\Win64OpenSSL.exe
27+
28+
# OpenCV
29+
ADD https://github.com/ros2/ros2/releases/download/opencv-archives/opencv-3.4.6-vc16.VS2019.zip C:\TEMP\opencv.zip
30+
31+
# Python 3.7
32+
ADD https://www.python.org/ftp/python/3.7.6/python-3.7.6-amd64.exe C:\TEMP\python-37.exe
33+
34+
# Custom choco packages
35+
ADD https://github.com/ros2/choco-packages/releases/download/2020-02-24/asio.1.12.1.nupkg C:\TEMP\asio.nupkg
36+
ADD https://github.com/ros2/choco-packages/releases/download/2020-02-24/bullet.2.89.0.nupkg C:\TEMP\bullet.nupkg
37+
ADD https://github.com/ros2/choco-packages/releases/download/2020-02-24/cunit.2.1.3.nupkg C:\TEMP\cunit.nupkg
38+
ADD https://github.com/ros2/choco-packages/releases/download/2020-02-24/eigen.3.3.4.nupkg C:\TEMP\eigen.nupkg
39+
ADD https://github.com/ros2/choco-packages/releases/download/2020-02-24/log4cxx.0.10.0.nupkg C:\TEMP\log4cxx.nupkg
40+
ADD https://github.com/ros2/choco-packages/releases/download/2020-02-24/tinyxml-usestl.2.6.2.nupkg C:\TEMP\tinyxml.nupkg
41+
ADD https://github.com/ros2/choco-packages/releases/download/2020-02-24/tinyxml2.6.0.0.nupkg C:\TEMP\tinyxml2.nupkg
42+
43+
# xmllint files
44+
ADD https://www.zlatkovic.com/pub/libxml/64bit/libxml2-2.9.3-win32-x86_64.7z C:\TEMP\libxml2.7z
45+
ADD https://www.zlatkovic.com/pub/libxml/64bit/zlib-1.2.8-win32-x86_64.7z C:\TEMP\zlib.7z
46+
ADD https://www.zlatkovic.com/pub/libxml/64bit/iconv-1.14-win32-x86_64.7z C:\TEMP\iconv.7z
47+
48+
# Restore the default Windows shell for correct batch processing.
49+
SHELL ["cmd", "/S", "/C"]
50+
51+
RUN C:\TEMP\python-37.exe /quiet `
52+
TargetDir=C:\Python37 `
53+
PrependPath=1 `
54+
Include_debug=1 `
55+
Include_symbols=1
56+
57+
# Install Chocolatey by powershell script
58+
RUN powershell -noexit "Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))"
59+
60+
# choco installs
61+
RUN choco install -y cmake curl git vcredist2013 vcredist140 cppcheck patch
62+
RUN choco install -y -s C:\TEMP asio cunit eigen tinyxml-usestl tinyxml2 log4cxx bullet
63+
64+
RUN C:\TEMP\Win64OpenSSL.exe /VERYSILENT
65+
66+
# For extracting .7z files
67+
ADD https://www.7-zip.org/a/7z1900-x64.exe C:\TEMP\
68+
RUN C:\TEMP\7z1900-x64.exe /S /D="C:\Program Files\7-zip"
69+
RUN setx PATH "%PATH%;C:\Program Files\7-zip"
70+
71+
# Install xmllint
72+
# 7z.exe command line usage https://sevenzip.osdn.jp/chm/cmdline/commands/extract.htm
73+
RUN 7z.exe x C:\TEMP\libxml2.7z -aoa -oC:\xmllint
74+
RUN 7z.exe x C:\TEMP\zlib.7z -aoa -oC:\xmllint
75+
RUN 7z.exe x C:\TEMP\iconv.7z -aoa -oC:\xmllint
76+
RUN 7z.exe x C:\TEMP\opencv.zip -aoa -oC:\
77+
78+
RUN 7z.exe x C:\TEMP\OpenSplice.zip -aoa -oC:\opensplice
79+
80+
# Environment setup
81+
ENV OPENSSL_CONF C:\OpenSSL-Win64\bin\openssl.cfg
82+
ENV OpenCV_DIR C:\opencv
83+
ENV OSPL_HOME C:\opensplice\HDE\x86_64.win64
84+
# You can't use ENV to append to the PATH https://stackoverflow.com/questions/42092932/appending-to-path-in-a-windows-docker-container
85+
RUN setx PATH "%PATH%;C:\Program Files\Git\cmd;C:\Program Files\CMake\bin;C:\OpenSSL-Win64\bin\;C:\xmllint\bin;"C:\opencv\x64\vc16\bin"
86+
87+
RUN powershell -Command Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1
88+
RUN mkdir C:\ws
89+
WORKDIR C:\ci
90+
91+
# Invalidate once a day to cause online installers to check for updates
92+
RUN echo "@todays_date"
93+
94+
# Qt5 online installer
95+
ADD http://download.qt.io/official_releases/online_installers/qt-unified-windows-x86-online.exe C:\TEMP\
96+
97+
# Install Qt5 with automated install script, no msvc2019 version exists but 2017 is compatible
98+
# Updater/silentUpdate options did not work for me. Install scripts finds and installs the most recent LTS version
99+
COPY qt-installer.qs C:\TEMP\
100+
101+
# Installing Qt5 requires an account. This file contains a username and secret account token
102+
RUN mkdir C:\Users\ContainerAdministrator\AppData\Roaming\Qt
103+
COPY qtaccount\qtaccount.ini C:\Users\ContainerAdministrator\AppData\Roaming\Qt\qtaccount.ini
104+
105+
RUN C:\TEMP\qt-unified-windows-x86-online.exe --script C:\TEMP\qt-installer.qs MsvcVersion=2019 ErrorLogname="%ERROR_FILENAME%"
106+
RUN IF EXIST "%ERROR_FILENAME%" EXIT 1
107+
108+
RUN choco upgrade -y chocolatey
109+
RUN choco upgrade -y all
110+
111+
# The rest of the python packages are installed through run_ros2_batch.py
112+
RUN python -m pip install -U pip setuptools pydot PyQt5
113+
114+
COPY rticonnextdds-license\rti_license.dat C:\connext\
115+
ENV RTI_LICENSE_FILE C:\connext\rti_license.dat
116+
117+
COPY rticonnextdds-src\openssl-1.0.2n-target-x64Win64VS2017.zip C:\TEMP\connext\
118+
RUN 7z.exe x C:\TEMP\connext\openssl-1.0.2n-target-x64Win64VS2017.zip -aoa -oC:\connext\
119+
ENV RTI_OPENSSL_BIN C:\connext\openssl-1.0.2n\x64Win64VS2017\release\bin
120+
ENV RTI_OPENSSL_LIB C:\connext\openssl-1.0.2n\x64Win64VS2017\release\lib
121+
122+
COPY rticonnextdds-src\rti_connext_dds-5.3.1-pro-host-x64Win64.exe.??? C:\TEMP\connext\
123+
RUN copy /b C:\TEMP\connext\rti_connext_dds-5.3.1-pro-host-x64Win64.exe.??? C:\TEMP\connext\rti_connext_dds-5.3.1-pro-host-x64Win64.exe
124+
RUN C:\TEMP\connext\rti_connext_dds-5.3.1-pro-host-x64Win64.exe `
125+
--mode unattended `
126+
--unattendedmodeui minimalWithDialogs `
127+
--prefix "%ProgramFiles%"
128+
129+
COPY rticonnextdds-src\openssl-1.0.2n-5.3.1-host-x64Win64.rtipkg C:\TEMP\connext\
130+
RUN ""%ProgramFiles%\rti_connext_dds-5.3.1\bin\rtipkginstall.bat" C:\TEMP\connext\openssl-1.0.2n-5.3.1-host-x64Win64.rtipkg"
131+
COPY rticonnextdds-src\rti_connext_dds-5.3.1-pro-target-x64Win64VS2017.rtipkg.??? C:\TEMP\connext\
132+
RUN copy /b C:\TEMP\connext\rti_connext_dds-5.3.1-pro-target-x64Win64VS2017.rtipkg.??? C:\TEMP\connext\rti_connext_dds-5.3.1-pro-target-x64Win64VS2017.rtipkg
133+
RUN ""%ProgramFiles%\rti_connext_dds-5.3.1\bin\rtipkginstall.bat" C:\TEMP\connext\rti_connext_dds-5.3.1-pro-target-x64Win64VS2017.rtipkg"
134+
COPY rticonnextdds-src\rti_security_plugins-5.3.1-host-x64Win64.rtipkg C:\TEMP\connext\
135+
RUN ""%ProgramFiles%\rti_connext_dds-5.3.1\bin\rtipkginstall.bat" C:\TEMP\connext\rti_security_plugins-5.3.1-host-x64Win64.rtipkg"
136+
COPY rticonnextdds-src\rti_security_plugins-5.3.1-target-x64Win64VS2017.rtipkg C:\TEMP\connext\
137+
RUN ""%ProgramFiles%\rti_connext_dds-5.3.1\bin\rtipkginstall.bat" C:\TEMP\connext\rti_security_plugins-5.3.1-target-x64Win64VS2017.rtipkg"
138+
139+
# Visual Studio Build Tools and .Net SDK`
140+
ADD https://aka.ms/vs/16/release/vs_BuildTools.exe C:\TEMP\
141+
142+
# 3010 is an acceptable exit code (install was successful but restart required), but it will confuse docker.
143+
# This installer invalidates docker image caches pretty regularly, so it's late in the order. See documentation for installer at:
144+
# https://docs.microsoft.com/en-us/visualstudio/install/use-command-line-parameters-to-install-visual-studio?view=vs-2019
145+
RUN C:\TEMP\vs_BuildTools.exe --quiet --wait --norestart --includeRecommended `
146+
--add Microsoft.Net.Component.4.8.SDK `
147+
--add Microsoft.VisualStudio.Workload.VCTools `
148+
--add Microsoft.Component.MSBuild `
149+
--add Microsoft.VisualStudio.Component.VC.CLI.Support `
150+
|| IF "%ERRORLEVEL%"=="3010" EXIT 0
151+
152+
CMD ["C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Auxiliary\\Build\\vcvarsall.bat", "x86_amd64", "&&", `
153+
"python", "run_ros2_batch.py", "%CI_ARGS%"]

0 commit comments

Comments
 (0)