Install machine runner 3 on Windows
This page describes how to install CircleCI’s machine runner 3 on Windows. This has been tested for Windows Server 2016, 2019, and 2022 in Datacenter Edition. Other Server SKUs with Desktop Experience and Remote Desktop Services (RDS) also work.
This page walks you through installing a machine runner 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. |
Prerequisites
To install machine runners and run jobs, you will need to have root access, and have the following dependencies installed on your system:
-
The CircleCI CLI if you wish to install runners from the command line.
| Additional utilities and tools, such as Chocolatey, Git, and Gzip are automatically installed as part of the installation script. |
Self-hosted runner terms agreement
-
Web app installation
-
CLI installation
Before you can install self-hosted runners through the web app, you will need to agree to the CircleCI Runner Terms. To access the Runners section of the CircleCI web app an organization admin must agree to the terms at .
Once the terms have been accepted, Runners will appear permanently in the side navigation.
Your role within your org is determined differently depending on how you integrate with your code, as follows:
-
If you have a
githuborbitbuckettype organization, CircleCI mirrors VCS permissions for organizations. If you are an admin on your organization’s VCS, you are an admin on CircleCI. If you are unsure, check the admin permissions on your VCS. -
If you have a
circlecitype organization, you can check roles by navigating to . Full details on roles and permissions are available in the Roles and Permissions Overview.
| Find out about organization types in the Users, Organizations and Integrations Guide. |
If you are installing and using self-hosted runners through the CLI, you are agreeing to the CircleCI Runner Terms.
1. Create namespace and resource class
-
Web app installation
-
CLI installation
To install self-hosted runners, you need to create a CircleCI namespace and resource class. Once set up you will receive a resource class token. You must be an organization admin to complete this process. View your installed runners on the inventory page in the web app by selecting Runners from the sidebar.
| If you already create orb in your organization you will already have a namespace configured. You must use this same namespace for runners. Each organization can only create a single namespace. |
-
On the CircleCI web app, navigate to Runners and select Create Resource Class.
Figure 2. Runner set up, step one - Get started -
Create a custom Resource Class. You will configure jobs to use this resource class when you want them to run on your self-hosted runner.
We suggest using a lowercase representation of your CircleCI account name for your namespace. CircleCI will populate your org name as the suggested namespace by default in the UI.
Namespace and resource classes must follow specific naming conventions:
-
The namespace can contain lowercase letters, numbers, underscores, and dashes.
-
The resource class name can contain uppercase and lowercase letters, numbers, colons, underscores, dashes, and plus signs.
Figure 3. Runner set up, step two - Create a namespace and resource class
-
-
Enter a description for your resource class. This is an optional field.
-
Select Save and continue to save and view your resource class token.
-
Copy and save the resource class token. Self-hosted runners use this token to claim work for the associated resource class.
The token is only displayed once, be sure to store it safely.
Figure 4. Runner set up, step three - Create a resource class token -
Select the Machine tab and progress on to the platform-specific instructions in the next section of this installation guide.
If you are installing self-hosted runners for server, the CircleCI CLI needs to be configured using your server API key. Run circleci setup to configure the CLI and access the option to supply a new API token if required.
|
To install self-hosted runners, you need to create a CircleCI namespace and resource class. Once set up you will receive a resource class token. You must be an organization admin to complete this process. View your installed runners on the inventory page in the web app by selecting Runners from the sidebar.
| If you already create orb in your organization you will already have a namespace configured. You must use this same namespace for runners. Each organization can only create a single namespace. |
-
Create a namespace for your organization’s self-hosted runners if you do not already have one configured. We suggest using a lowercase representation of your CircleCI organization’s account name.
Use the following command to create your CircleCI organization’s namespace:
$ circleci namespace create <name> --org-id <your-organization-id> -
Create a resource class for your runner using the following command. You will configure jobs to use this resource class when you want them to run on your slef-hosted runner:
$ circleci runner resource-class create <namespace>/<resource-class> <description> --generate-tokenMake sure to replace
<namespace>and<resource-class>with your org namespace and desired resource class name, respectively. You can add a description but this is optional.Resource class names must follow specific naming conventions.
-
The namespace can contain lowercase letters, numbers, underscores, and dashes.
-
The resource class name can contain uppercase and lowercase letters, numbers, colons, underscores, dashes, and plus signs.
The resource class token is returned after the runner resource class is successfully created.
The token is only displayed once, so be sure to store it safely.
-
2. Machine runner installation on Windows
-
Download the
Install-CircleCIRunner.ps1script from GitHub to an accessible location. -
Open PowerShell as an administrator and navigate to the directory where you placed the script file.
-
Run the following in your PowerShell:
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; ./Install-CircleCIRunner.ps1The installation will be displayed in your PowerShell interface.
-
As part of the installation, the configuration file for the machine runner (
runner-agent-config.yaml) will open in Notepad. Fill in the requested information (see Machine Runner 3.0 Configuration Reference). The configuration file is located in the installation directory,C:\Program Files\CircleCI, by default.
After your setup completes, the machine runner starts automatically and begins looking for jobs to process.
Machine runner configuration example
Once you have installed configuration runner, select Continue in the CircleCI web app and you will be presented with an example configuration snippet showing a job configured to use your new self-hosted runner resource class.
The fields you must set for a specific job to run using your machine runners are:
-
machine: true -
resource_class: <namespace>/<resource-class>
Simple example of how you could set up a job:
version: 2.1
workflows:
build-workflow:
jobs:
- runner
jobs:
runner:
machine: true
resource_class: <namespace>/<resource-class>
steps:
- run: echo "Hi I'm on Runners!"
The job will then execute using your self-hosted runner when you push the .circleci/config.yml to your VCS provider.
Uninstall / reinstall steps
Uninstalling machine runners will prepare the system for installation again.
-
Download the
Uninstall-CircleCIRunner.ps1script from GitHub to an accessible location. -
Open PowerShell as an administrator and navigate to the directory where you placed the script file.
-
Run the following in your PowerShell:
./Uninstall-CircleCIRunner.ps1
Continuous mode vs. single task mode for Windows self-hosted runners
By default, Windows machine runners run in Single-Task Mode in order to ensure high reliability of the underlying technology that the self-hosted runner uses to execute jobs. Single-task mode is the recommended mode for Windows machine runners.
A Windows machine 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 job failures.
Troubleshooting
Refer to the Troubleshoot Machine Runner guide if you encounter issues installing or running machine runner on Windows.