Welcome to the Early Access Program (EAP) for self-hosted Windows Runners in Bitbucket Pipelines. With this feature, you will be able to run builds in Pipelines on your own Windows infrastructure. In this guide, we will walk you through the steps to set up and use runners so you can get started right away.
You won’t be charged for the build minutes used by your self-hosted Windows Runners.
OpenJDK 11 is installed
Git is installed
PowerShell 5.0+ is installed
A 64-Bit Windows 10+ or Windows Server 2019+ instance with at least 8GB of RAM as a host for the runner
Below are the sample chocolatey scripts to install all of the prerequisites required:
choco install -y git
choco install -y openjdk11
choco install -y dotnetfx --pre
We recommend installing any other dependencies your Pipelines require in advance to improve build times, for example: nuget, xUnit, nUnit, etc.
In the Pipelines section, select Runners.
Labels allow you to schedule a step on a runner matching certain requirements. For example, you could label runners with ‘dotnet.5’ to target it specifically from build steps that should run on a host with dotnet 5 installed, and then create a separate label, such as ‘env.prod’ for runners that have a special configuration so they can deploy to a production environment.
Labels can only contain lowercase, alphanumerical characters and dots.
Select Next. The next page will have a list of pre-configured PowerShell commands that you will need to run on the host machine where you’re installing your runners. It will download, unzip, and start the software necessary to run build steps on your host. The token in the command will automatically authenticate the host with Bitbucket. Note: Make sure you remember or write down the commands, as you will not be able to access it again after the setup is complete.
Select Next.
Select Finish to complete the setup. Now the new runner is listed as a runner in your repository. It will be in the unregistered state until you run the command you saved in Step 6 on your host machine.
Make sure you run the command and that the state of the runner changes to ‘online’ before you try to use the runner in your Pipelines.
To use your runner in Pipelines, add a runs-on parameter with at least a windows
label to a step, and it will run on the next available Windows Runner that has all the required labels.
If you don’t specify the windows
label, our scheduler will assume it is a Linux step and will try to run it as a Linux Runner.
If all matching Windows Runners are busy, your step will be queued until one becomes available again.
If you don't have any online runners in your repository that match all your labels, the step will fail.
pipelines:
custom:
customPipelineWithRunnerStep:
- step:
name: Step 1
runs-on:
- 'self.hosted'
- 'windows'
script:
- >
Write-Host 'This step will run on a self hosted Windows runner.';
- step:
name: Step 2
script:
- echo "This step will run on Atlassian's infrastructure as usual.";
Recommendation: Given that yaml file can become easily confused by characters used in PowerShell, such as escape characters, delimiters and quotes, it is always better to use folded style for your PowerShell script commands.
Warning: Currently we only support running one runner per machine.
The Windows Runner uses PowerShell to execute the step scripts, and the host machine will be shared by multiple steps that schedule onto the runner. If you install/change something globally in your step, such as installing a new library, then this change will affect the next step run on the host machine.
Note: At the moment, self-hosted Windows Runners does not support all features provided when running Pipelines on Atlassian’s infrastructure. The following features are not yet supported:
The following features won't be support by self-hosted Windows Runners:
As we continue to work on the known issues and implement new features, check out the Bitbucket Cloud roadmap to see what’s coming down the pipes.
The following are known issues for current Windows Runners which we are plan to fix before our beta release:
git-credential-manager-core
via chocolatey and don't have the .NetFramework installed, pipelines steps will hang during "git clone"
with the following modal:choco install -y dotnetfx --pre
."We're very interested in any comments you may have around your experience with self-hosted Windows Runners! Please leave your feedback in this community group.
For further assistance on using the self-hosted Windows Runner:
Post your question in this community group.
lliang2
5 comments