Windows Containers
Windows Containers¶
It is possible to run Windows Containers like how one can run Linux containers on Windows Community Cluster.
To use Windows, add windows_container
instead of container
in .cirrus.yml
files:
Cirrus CI will execute scripts instructions like Batch scripts.
OS Versions¶
By default, Cirrus CI assumes that the container image's host OS is Windows Server 2019. You can specify os_version
to override it. Cirrus CI supports most versions of Windows Containers, including: 1709
, 1803
and 2019
.
windows_container:
image: cirrusci/windowsservercore:2019
windows_task:
install_script: choco install -y ...
...
PowerShell support¶
By default Cirrus CI agent executed scripts using cmd.exe
. It is possible to override default shell executor by providing
CIRRUS_SHELL
environment variable:
It is also possible to use PowerShell scripts inline inside of a script instruction by prefixing it with ps
:
ps: COMMAND
is just a syntactic sugar which transforms it to:
Environment Variables¶
Some software installed with Chocolatey would update PATH
environment variable in system settings and suggest using refreshenv
to pull those changes into the current environment.
Unfortunately, using refreshenv
will overwrite any environment variables set in Cirrus CI configuration with system-configured defaults.
We advise to make necessary changes using env
and environment
instead of using refreshenv
command in scripts.
Chocolatey¶
All cirrusci/*
Windows containers like cirrusci/windowsservercore:2016
have Chocolatey pre-installed.
Chocolatey is a package manager for Windows which supports unattended installs of software, useful on headless machines.