Skip to content

Add script for building windows helper image

What does this MR do?

Add script for building windows image

Context

This MR is part of a bigger issue #3755 (closed) to start building windows helper images and publish them to docker hub.

Why was this MR needed?

The decision for using PowerShell for windows is because we cannot build/save/export windows containers to a non-Windows image so we to use a scripting language native to windows. Bash can be used but it would be in a subsystem which is not ideal. This script will be used inside of GitLab CI in a future MR when the infrastructure has set up gitlab-com/gl-infra/infrastructure#5952.

This PowerShell script is doing a few things different than release_docker_images for the helper images. In the bash script we expect the helper images are already built and exported using docker export but for windows containers when you run the command you get the daemon on this operating system does not support exporting Windows containers. This script will build the docker container and then push it to the docker registry hub.

To Do

Questions

I already feel like doing this we are duplicating the work for windows and linux because of bash, windows should we try to think of ways how we can make this using one common language that is platform agnostic?

Are there points in the code the reviewer needs to double check?

Some tests builds/pubishing can be found here. The way this was tested is doing the following.

$ git checkout 3755-helper-image-for-windows-container-execution # This branch has this specific commit and commits from other MRs such as https://gitlab.com/gitlab-org/gitlab-runner/merge_requests/1167 & https://gitlab.com/gitlab-org/gitlab-runner/merge_requests/1188

$ make helper-build # Build linux/windows binaries

$ vagrant up # Start windows development environment

$ vagrant ssh # Password is `vagrant` by default.

$ powershell # To invoke powershell

$ cd $Env:RUNNER_SRC

$ Set-Item Env:PUSH_TO_DOCKER_HUB -Value "true"

$ Set-Item Env:IS_LATEST -Value "true"

$ Set-Item Env:WINDOWS_VERSION -Value "nanoserver1809"  # Set the environment variable to specify which windows image to build

$ Set-Item Env:DOCKER_HUB_USER -Value "SomeUser"

$ Set-Item Env:DOCKER_HUB_PASSWORD -Value "SomePASSWORD"

$ .\ci\build_release_windows_images.ps1

Does this MR meet the acceptance criteria?

  • Documentation created/updated
  • Added tests for this feature/bug
  • In case of conflicts with master - branch was rebased

What are the relevant issue numbers?

#3755 (closed)

Edited by Steve Xuereb

Merge request reports