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

Use text replacement to modify dockerfile once/day for windows #424

Merged
merged 2 commits into from
Apr 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion job_templates/ci_job.xml.em
Original file line number Diff line number Diff line change
Expand Up @@ -357,10 +357,13 @@ echo "# BEGIN SECTION: Build DockerFile"
set CONTAINER_NAME=ros2_windows_ci_msvc%CI_VISUAL_STUDIO_VERSION%
set DOCKERFILE=windows_docker_resources\Dockerfile.msvc%CI_VISUAL_STUDIO_VERSION%

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

Choose a reason for hiding this comment

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

I forgot that this would need to be escaped in order for empty to render the @-sign through: #426


rem "Finding the ReleaseId is much easier with powershell than cmd"
powershell $(Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion').ReleaseId > release_id.txt
set /p RELEASE_ID=< release_id.txt
set BUILD_ARGS=--build-arg WINDOWS_RELEASE_ID=%RELEASE_ID% --build-arg TODAYS_DATE="%date%"
set BUILD_ARGS=--build-arg WINDOWS_RELEASE_ID=%RELEASE_ID%
docker build %BUILD_ARGS% -t %CONTAINER_NAME% -f %DOCKERFILE% windows_docker_resources
echo "# END SECTION"

Expand Down
3 changes: 1 addition & 2 deletions windows_docker_resources/Dockerfile.msvc2019
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
# To find this value run in powershell:
# $(Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion').ReleaseId
ARG WINDOWS_RELEASE_ID=1909
ARG TODAYS_DATE=0

# Indicates that the windows image will be used as the base image. Must be same or older than host.
# --isolation=hyperv is needed for both build/run if the image id is older than the host id
Expand Down Expand Up @@ -84,7 +83,7 @@ RUN mkdir C:\ws
WORKDIR C:\ci

# Invalidate once a day to cause online installers to check for updates
RUN echo %TODAYS_DATE%
RUN echo "@todays_date"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Becomes:

RUN echo "Thursday, April 9, 2020"


# Qt5 online installer
ADD http://download.qt.io/official_releases/online_installers/qt-unified-windows-x86-online.exe C:\TEMP\
Expand Down