Start Building for Free
CircleCI.comAcademyBlogCommunitySupport

Machine runner 3.0 manual installation for Windows

1 month ago2 min read
Cloud
On This Page

This page describes how to manually install CircleCI’s machine runner 3.0 on Windows Server.

Prerequisites

Self-hosted runner terms agreement

1. Create namespace and resource class

In order to install self-hosted runners, you will need to create a namespace and authentication token by performing the steps listed below. Please note that to create resource classes and tokens you need to be an organization administrator in the VCS provider.

You can view your installed runners on the inventory page in the web app or your CircleCI server app, by clicking Self-Hosted Runners on the left navigation.

  1. Create a namespace for your organization’s self-hosted runners. Each organization can only create a single namespace. We suggest using a lowercase representation of your CircleCI organization’s account name. If you already use orbs, this namespace should be the same namespace orbs use.

    Use the following command to create a namespace:

    circleci namespace create <name> --org-id <your-organization-id>
  2. Create a resource class for your self-hosted runner’s namespace using the following command:

    circleci runner resource-class create <namespace>/<resource-class> <description> --generate-token

    Make sure to replace <namespace> and <resource-class> with your org namespace and desired resource class name, respectively. You may optionally add a description.

    Example: circleci runner resource-class create my-namespace/my-resource-class my-description --generate-token.

    The resource class token is returned after the runner resource class is successfully created.

2. Download the CircleCI machine runner

Using PowerShell, download the current version of CircleCI machine runner and verify the download.

$runnerVersion = "current"
$availableAgents = (Invoke-WebRequest "https://circleci-binary-releases.s3.amazonaws.com/circleci-runner/manifest.json" -UseBasicParsing).Content.Trim() | ConvertFrom-Json
$agentURL = $availableAgents.releases.$runnerVersion.windows.amd64.url
$agentHash = $availableAgents.releases.$runnerVersion.windows.amd64.sha256
$agentFile = $agentURL.Split("/")[-1]

Invoke-WebRequest $agentURL -OutFile $agentFile -UseBasicParsing
if ((Get-FileHash "$agentFile" -Algorithm SHA256).Hash.ToLower() -ne $agentHash.ToLower()) {
    throw "Invalid checksum for CircleCI Machine Runner, please try download again"
}

tar -zxvf $agentFile
del $agentFile

3. Create the CircleCI machine runner configuration and working directory

Using PowerShell, create the CircleCI machine runner configuration file and working directory.

New-Item -Name Workdir -ItemType Directory
@"
api:
  auth_token: "<< YOUR RUNNER TOKEN >>"
  url: https://runner.circleci.com
runner:
  name: "$env:COMPUTERNAME"
  mode: single-task
  working_directory: "./Workdir"
  cleanup_working_directory: true
logging:
  file: circleci-runner.log
"@ -replace "([^`r])`n", "`$1`r`n" | Out-File machine-runner-config.yaml -Encoding ascii

4. Start the CircleCI machine runner

./circleci-runner.exe machine --config machine-runner-config.yaml

Suggest an edit to this page

Make a contribution
Learn how to contribute