CircleCI Self-hosted Runner Installation on Windows

Last updated
Tags Cloud Server v3.x

This page describes how to install CircleCI self-hosted runners on Windows. This has been tested for Windows Server 2019 and Windows Server 2016, both in Datacenter Edition. Other Server SKUs with Desktop Experience and Remote Desktop Services should also work.

This page is a continuation of installing self-hosted runners. You will need to have an existing namespace and resource class to continue below. You can do this on the CircleCI web app by navigating to Self-Hosted Runners (see the documentation for the Web App Installation). You can also use the CLI.

With this procedure, you install CircleCI launch agent and its dependencies, for example, Chocolatey, Git and Gzip, on your Windows Server.

Since this setup creates a new local administrator user that runs CircleCI jobs, your Windows Server needs to be capable of creating local users and accepting remote logons for them.

The Windows Server needs to be a domain member when you set this up in domain environments. The self-hosted runner instance cannot run on a Windows Server operating as a domain controller.

Installation steps

  1. Download the Install-CircleCIRunner.ps1 script from Github to an easily accessible location.

  2. Open PowerShell as an administrator and navigate to the directory where you placed the script file.

  3. Run the following in your PowerShell:

    Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072;
    ./Install-CircleCIRunner.ps1

    The installation will be output into your PowerShell interface.

  4. As part of the installation, the configuration file for the self-hosted runner (launch-agent-config.yaml) will open in Notepad. Please fill the file out with the requested information (see Self-hosted Runner Configuration Reference). The configuration file is located in the installation directory, C:\Program Files\CircleCI, by default.

After setup completes, the launch agent starts automatically and begins looking for jobs to process.

Referencing your self-hosted runner on a job

After setting up your self-hosted runner, you will need to reference it on a job by setting some fields in your .circleci/config.yml file. The fields you must set for a specific job to run using your self-hosted runners are:

  • machine: true

  • resource_class: your-namespace/your-resource

Here is a simple example of how you could set up a job:

version: 2.1
workflows:
  testing:
    jobs:
      - runner
jobs:
  runner:
    machine: true
    resource_class: your-namespace/your-resource
    steps:
      - run: echo "Hi I'm on Runners!"

The job will then execute using your self-hosted runner when you push the config to your VCS provider.

Uninstall / reinstall steps

Uninstalling CircleCI self-hosted runners will prepare the system for installation again.

  1. Download the Uninstall-CircleCIRunner.ps1 script from GitHub to an easily accessible location.

  2. Open PowerShell as an administrator and navigate to the directory where you placed the script file.

  3. Run the following in your PowerShell:

    ./Uninstall-CircleCIRunner.ps1

Continuous mode vs. single task mode for Windows self-hosted runners

By default, Windows self-hosted runners run in single task mode in order to ensure high reliablity of the underlying technology that the self-hosted runner uses to execute jobs. This is the recommended mode for Windows self-hosted runners.

A Windows self-hosted runner can be run in continuous mode, however, doing so eliminates the guarantee of a clean job environment. This may translate into jobs not executing as expected and failing.



Help make this document better

This guide, as well as the rest of our docs, are open source and available on GitHub. We welcome your contributions.

Need support?

Our support engineers are available to help with service issues, billing, or account related questions, and can help troubleshoot build configurations. Contact our support engineers by opening a ticket.

You can also visit our support site to find support articles, community forums, and training resources.