Skip to content

Commit 059611b

Browse files
committed
doc: add basic info about self-hosted runner setup to readme
1 parent 1f26a45 commit 059611b

File tree

2 files changed

+74
-1
lines changed

2 files changed

+74
-1
lines changed

README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,19 @@ Features:
3131
* a airgap
3232
* s spot
3333
* p proxy
34-
* v vpn
34+
* v vpn
35+
36+
## Github Self hosted runner
37+
38+
`mapt` can setup a deployed machine as a Self Hosted runner on most of the Platform and Provider combinations
39+
it supports.
40+
41+
Use the following flags with `mapt <provider> <platform> create` command:
42+
43+
```
44+
--install-ghactions-runner <bool> Install and setup Github Actions runner in the instance
45+
--ghactions-runner-name <string> Name for the Github Actions Runner
46+
--ghactions-runner-repo <string> Full URL of the repository where the Github Actions Runner should be registered
47+
--ghactions-runner-token <string> Token needed for registering the Github Actions Runner token
48+
```
49+

docs/self-hosted-runner.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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

Comments
 (0)