Start Building for Free
CircleCI.comAcademyBlogCommunitySupport

Using the Windows execution environment

2 weeks ago5 min read
Cloud
Server v4.x
Server v3.x
On This Page

The Windows execution environment provides the tools to build Windows projects, such as a Universal Windows Platform (UWP) application, a .NET executable, or Windows-specific (like the .NET framework) projects. The following specifications detail the capacities and included features of the Windows executor:

  • Is VM-based to guarantee full job isolation.

  • Can use either the Server Core version of Windows Server 2019 Datacenter Edition, or Windows Server 2022 Datacenter edition.

  • PowerShell is the default shell (Bash and CMD are available to be manually selected).

  • Docker Engine - Enterprise is available for running Windows containers.

You can access the Windows execution environment by using the machine executor and specifying a Windows image, or by using the Windows orb and specifying the default executor.

Quickstart

Configuration options for using the Windows execution environment are shown below.

The Windows orb

To keep your configuration simple and to ensure you are using the most up-to-date image, you can use the Windows orb, and then specify the default executor from the orb in your job configuration. CircleCI strongly encourages using the Windows orb as it helps simplify your configuration.

version: 2.1

orbs:
  win: circleci/windows@5.0 # The Windows orb gives you everything you need to start using the Windows executor.

jobs:
  build: # name of your job
    executor: win/default # executor type

    steps:
      # Commands are run in a Windows virtual machine environment
      - checkout
      - run: Write-Host 'Hello, Windows'
version: 2.1

orbs:
  win: circleci/windows@5.0

jobs:
  build:
    executor: win/server-2022
    steps:
      - run: Write-Host 'Hello, Windows'
workflows:
  my-workflow:
    jobs:
      - build

Available resource classes

ClassvCPUsRAMDisk SizeCloudServer

medium (default)

4

15GB

200 GB

large

8

30GB

200 GB

xlarge

16

60GB

200 GB

2xlarge

32

128GB

200 GB

View resource usage

To view the compute resource usage for the duration of a job in the CircleCI web app:

  1. Select Dashboard from the sidebar menu

  2. Use the dropdown menus to select a project, and a branch

  3. Expand your workflow ( )

  4. Select a job by clicking on the job name

  5. Select the Resources tab to view CPU and RAM usage for the duration of the job

You can use these insights to decide whether to make changes to the job’s configured resource class. You can also access resource class Insights.

Resources tab

Windows machine executor images

CircleCI supports Windows Server 2019 with Visual Studio 2019 and Windows Server 2022 with Visual Studio 2022. For information on what software is pre-installed on the Windows image, visit the Developer Hub, or the Discuss forum. The Windows image page on the Developer Hub lists links to the most recent updates.

Details on the Windows Server 2022 image can be found on this Discuss post.

The Windows images are updated approximately every 30 days. If a tag is not specified when using the Windows image, by default the latest stable version will be applied. The tagging scheme for the Windows image is as follows:

  • Current (formerly Stable): This image tag points to the latest production-ready Windows image. This image should be used by projects that want a decent level of stability, but would like to get occasional software updates. It is typically updated once a month.

  • Previous: This image tag points to the previous production-ready Windows image. This image can be used in cases where there was a breaking change in the latest software updates. It is typically updated once a month.

  • Edge: This image tag points to the latest version of the Windows image, and is built from the HEAD of the main branch. This tag is intended to be used as a testing version of the image with the most recent changes, and not guaranteed to be stable.

Specifying a shell with the Windows executor

There are three shells that you can use to run job steps on Windows:

  • PowerShell (default in the Windows orb)

  • Bash

  • Command

You can configure the shell at the job level or at the step level. It is possible to use multiple shells in the same job. Consider the example below, where we use Bash, PowerShell, and CMD by adding a shell: argument to our job and step declarations:

Running Windows Docker containers on the Windows executor

You can run Windows Docker containers on the Windows executor like so:

SSH into your Windows build

It is possible to SSH into a Windows build container. This is useful for troubleshooting problems in your pipeline. Follow these steps to SSH into a Windows container:

Steps

  1. If you have not already done so, add an SSH key to your User Settings. This key will be used to connect to container or VM that is running your job.

  2. To start a job with SSH enabled, select the Rerun job with SSH option from the "Rerun Workflow" dropdown menu.

  3. To see the connection details, expand the "Enable SSH" section in the job output where you will see the SSH command needed to connect:

    SSH connection details

Ensure that you are passing the name of the shell you want to run when you SSH in. To run cmd.exe in the build above you would run: ssh -p <remote_ip> -- cmd.exe

The available options are:

  • powershell.exe

  • bash.exe

  • cmd.exe

You can read more about using SSH in your builds here.

Known issues and limitations

These are the issues with the Windows executor that we are aware of and will address as soon as we can:

  • The add_ssh_keys step is required for any SSH key used in the job

  • It is currently not possible to do nested virtualization (for example, using the --platform linux flag).

  • The Windows executor currently only supports Windows containers. Running Linux containers on Windows is not possible for now.

Next steps

Check out the Hello World on Windows page.


Suggest an edit to this page

Make a contribution
Learn how to contribute