Skip to content

Commit

Permalink
doc: add basic info about self-hosted runner setup to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
anjannath committed Jul 12, 2024
1 parent 1f26a45 commit 059611b
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 1 deletion.
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,19 @@ Features:
* a airgap
* s spot
* p proxy
* v vpn
* v vpn

## Github Self hosted runner

`mapt` can setup a deployed machine as a Self Hosted runner on most of the Platform and Provider combinations
it supports.

Use the following flags with `mapt <provider> <platform> create` command:

```
--install-ghactions-runner <bool> Install and setup Github Actions runner in the instance
--ghactions-runner-name <string> Name for the Github Actions Runner
--ghactions-runner-repo <string> Full URL of the repository where the Github Actions Runner should be registered
--ghactions-runner-token <string> Token needed for registering the Github Actions Runner token
```

58 changes: 58 additions & 0 deletions docs/self-hosted-runner.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Overview

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.
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.

## Providers and Platforms

Currently it allow to create self hosted runners on AWS (Windows Server, RHEL) and Azure (Windows Desktop)

### Prerequisite

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
Github API.

* [Information for requesting a token to register a runner for an Organization]()
* [Information for requesting a token to register a runner for a repository]()

After obtaining the token we can invoke `mapt` with it to deploy a VM as a Self hosted runner.

For example to add a runner to this repository, we can use the following `curl` command to request a token:

```
% curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <github_personal_access_token>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/redhat-developer/mapt/actions/runners/registration-token
```
The Response from this `POST` request will be:

```
{
"token": "ACDZL3QXEIC73UXBDGSEYEI",
"expires_at": "2024-07-12T19:01:48.478+05:30"
}
```

### Operations

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
`--ghactions-runner-name` flag.

The full URL of the repository or the github organization also needs to be passed using the `--ghactions-runner-repo` flag.

To deploy a Windows runner on the Azure provider, we can use the following command:

```
% mapt azure windows create --spot \
--install-ghactions-runner \
--ghcations-runner-token="ACDZL3QXEIC73UXBDGSEYEI"
--ghcations-runner-name "az-win-11"
--ghcations-runner-repo "https://github.com/redhat-developer/mapt"
--project-name mapt-windows-azure \
--backed-url file:///Users/tester/workspace \
--conn-details-output /Users/tester/workspace/conn-details
```

0 comments on commit 059611b

Please sign in to comment.