jenkins-infra / helpdesk

Open your Infrastructure related issues here for the Jenkins project
https://github.com/jenkins-infra/helpdesk/issues/new/choose
17 stars 10 forks source link

support Linux containers when running on Windows VMs #3548

Open jtnord opened 1 year ago

jtnord commented 1 year ago

Service(s)

ci.jenkins.io

Summary

It is not uncommon for a plugin to have some containers for tests and use the legacy docker-fixtures or TestContainers

However the containers are generally linux specific (e.g. --platform=linux) and this causes build errors when run on windows VMs.

As it is useful to run the tests on Windows as well as Linux it would be helpful if there was a Windows VM that had been set to Linux containers (rather than the current Linux containers).

Current workaround is to use a specific container label in the buildPlugins (which actually broke and was just fixed a few hours ago)

e.g. https://github.com/jenkinsci/distfork-plugin/blob/master/Jenkinsfile https://github.com/jenkinsci/docker-workflow-plugin/blob/d5d2e5c4007f7ea006152542b2bcbe0f1b2b08aa/Jenkinsfile#L1-L4 are 2 plugins that use this approach.

a windows VM can be switched between linux and windows containers with the command "c:\Program Files\Docker\Docker\DockerCli.exe" -SwitchDaemon

untested (the help is broken) but -SwitchLinuxEngine may switch specifically to linux and -SwitchWindowsEngine may likewise do the same for windows containers.

Reproduction steps

No response

dduportal commented 1 year ago

Alas the flags -SwitchDaemon (etc.) are Docker Desktop only si it's not an option today on the Jenkins Infrastrcuture which uses Windows Server VMs.

As per https://learn.microsoft.com/en-us/virtualization/windowscontainers/quick-start/set-up-environment, Docker Desktop is recommended on Windows 10/11 and Docker CE standalone (or Mirantis or containerd) on Windows Server 2016/2019/2022.

It means that, in order to cover the CI case of "Windows build with Linux container", we need to use one of the following solutions:

if you have any other idea, please share!

dduportal commented 1 year ago

Tried a manual installation of Docker Desktop on a Windows 2022 (full, not a "core") server: succeeded with the UI enabled but I failed to have Docker Linux containers working.

Gotta try with WSL preinstalled and initialized before Docker Desktop.

going to backlog as no emergency here