Skip to content

Support bash in windows containers

Description

It is common to have a SW need to support several OS.

Our developers want to have the same set of tools for windows and linux, and they are currently using Shell Executor with shell = bash and we have a custom runner with !1475 (closed) .

With new docker for windows feature, we can finally have reproducible CI environment for windows too.

But we cannot reuse the same pipeline logic because shell needs to be different.

  • Bash for linux
  • PowerShell for Windows

If we set bash as Shell in config.toml, then the executor runs the bash helper script with the PowerShell helper container (that won't work)

Set-Variable : A parameter cannot be found that matches parameter name 'eo'.
At line:1 char:5
+ set -eo pipefail
+     ~~~
    + CategoryInfo          : InvalidArgument: (:) [Set-Variable], ParameterBi 
   ndingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Comm 
   ands.SetVariableCommand
 
: : The term ':' is not recognized as the name of a cmdlet, function, script 
file, or operable program. Check the spelling of the name, or if a path was 
included, verify that the path is correct and try again.
At line:1 char:1
+ : | eval $'echo "Running on $(hostname) via devtlswindocker02..."\n'
+ ~
    + CategoryInfo          : ObjectNotFound: (::String) [], CommandNotFoundEx 
   ception

Proposal

We should probably force the shell to PowerShell for helper stuff, and also avoid to hardcode /usr/bin/bash

Links to related issues and merge requests / references

Similar to #4021 (closed)