|
| 1 | +# Overview |
| 2 | + |
| 3 | +This feature of `mapt` allows to setup hosts deployed by it as a Github Self Hosted Runner, which can then be directly used for running github actions jobs. |
| 4 | +It benefits from all the existing features that `mapt` already provides, allowing to create self hosted runners that can be used for different QE scenarios. |
| 5 | + |
| 6 | +## Providers and Platforms |
| 7 | + |
| 8 | +Currently it allow to create self hosted runners on AWS (Windows Server, RHEL) and Azure (Windows Desktop) |
| 9 | + |
| 10 | +### Prerequisite |
| 11 | + |
| 12 | +To register a Self Hosted Runner for a repository or a Github organization, the runner program needs a registration token, which can be obtained by requesting the |
| 13 | +Github API. |
| 14 | + |
| 15 | +* [Information for requesting a token to register a runner for an Organization]() |
| 16 | +* [Information for requesting a token to register a runner for a repository]() |
| 17 | + |
| 18 | +After obtaining the token we can invoke `mapt` with it to deploy a VM as a Self hosted runner. |
| 19 | + |
| 20 | +For example to add a runner to this repository, we can use the following `curl` command to request a token: |
| 21 | + |
| 22 | +``` |
| 23 | +% curl -L \ |
| 24 | + -X POST \ |
| 25 | + -H "Accept: application/vnd.github+json" \ |
| 26 | + -H "Authorization: Bearer <github_personal_access_token>" \ |
| 27 | + -H "X-GitHub-Api-Version: 2022-11-28" \ |
| 28 | + https://api.github.com/repos/redhat-developer/mapt/actions/runners/registration-token |
| 29 | +``` |
| 30 | +The Response from this `POST` request will be: |
| 31 | + |
| 32 | +``` |
| 33 | +{ |
| 34 | + "token": "ACDZL3QXEIC73UXBDGSEYEI", |
| 35 | + "expires_at": "2024-07-12T19:01:48.478+05:30" |
| 36 | +} |
| 37 | +``` |
| 38 | + |
| 39 | +### Operations |
| 40 | + |
| 41 | +After getting the required token, we need to also decide what we are going to call this runner, the desired name can be passed to the `mapt` command using the |
| 42 | +`--ghactions-runner-name` flag. |
| 43 | + |
| 44 | +The full URL of the repository or the github organization also needs to be passed using the `--ghactions-runner-repo` flag. |
| 45 | + |
| 46 | +To deploy a Windows runner on the Azure provider, we can use the following command: |
| 47 | + |
| 48 | +``` |
| 49 | +% mapt azure windows create --spot \ |
| 50 | + --install-ghactions-runner \ |
| 51 | + --ghcations-runner-token="ACDZL3QXEIC73UXBDGSEYEI" |
| 52 | + --ghcations-runner-name "az-win-11" |
| 53 | + --ghcations-runner-repo "https://github.com/redhat-developer/mapt" |
| 54 | + --project-name mapt-windows-azure \ |
| 55 | + --backed-url file:///Users/tester/workspace \ |
| 56 | + --conn-details-output /Users/tester/workspace/conn-details |
| 57 | +``` |
| 58 | + |
0 commit comments