|
| 1 | +# Overview |
| 2 | + |
| 3 | +This feature of `mapt` allows you to set up hosts deployed by it as GitLab Runners, which can then be directly used for running GitLab CI/CD jobs. |
| 4 | +It benefits from all the existing features that `mapt` already provides, allowing you to create self-hosted runners that can be used for different QE scenarios. |
| 5 | + |
| 6 | +## Providers and Platforms |
| 7 | + |
| 8 | +Currently, it allows you to create self-hosted GitLab runners on AWS (Fedora, RHEL, Windows Server, macOS) and Azure (RHEL, Windows Desktop). |
| 9 | + |
| 10 | +### Prerequisite |
| 11 | + |
| 12 | +To register a GitLab Runner, you need an access token with `create_runner` and `manage_runner` scopes. There are two options: |
| 13 | + |
| 14 | +#### Option 1: Project Access Token (Recommended) |
| 15 | + |
| 16 | +Project Access Tokens are scoped to a specific project, making them more secure than personal tokens. |
| 17 | + |
| 18 | +**Requirements:** |
| 19 | +* GitLab Premium/Ultimate (on GitLab.com) |
| 20 | +* OR self-managed GitLab instance (version 13+) |
| 21 | + |
| 22 | +**Steps:** |
| 23 | +1. Go to your project → **Settings** → **Access Tokens** |
| 24 | +2. Create a new token with: |
| 25 | + - **Token name**: `mapt-runner` |
| 26 | + - **Role**: `Maintainer` or `Owner` |
| 27 | + - **Scopes**: Select `create_runner` and `manage_runner` |
| 28 | + - **Expiration**: Set according to your needs |
| 29 | +3. Click **Create project access token** |
| 30 | +4. Copy the token immediately |
| 31 | + |
| 32 | +#### Option 2: Personal Access Token (Fallback) |
| 33 | + |
| 34 | +If Project Access Tokens are not available, use a Personal Access Token: |
| 35 | + |
| 36 | +1. Go to **User Settings** → **Access Tokens** |
| 37 | +2. Create a new token with: |
| 38 | + - **Token name**: `mapt-runner-token` |
| 39 | + - **Scopes**: Select `create_runner` and `manage_runner` |
| 40 | + - **Expiration**: Set according to your needs |
| 41 | +3. Click **Create personal access token** |
| 42 | +4. Copy the token immediately |
| 43 | + |
| 44 | +#### Getting Project or Group ID |
| 45 | + |
| 46 | +You also need either a Project ID or Group ID: |
| 47 | + |
| 48 | +* **Project ID**: Go to your project → **Settings** → **General** (displayed at the top) |
| 49 | +* **Group ID**: Go to your group → **Settings** → **General** (displayed at the top) |
| 50 | + |
| 51 | +> *NOTE:* For Group Runners with Group Access Tokens, you'll need GitLab Premium/Ultimate on GitLab.com or a self-managed instance. |
| 52 | +
|
| 53 | +### Operations |
| 54 | + |
| 55 | +After obtaining the token and the project/group ID, you can deploy a runner using the appropriate flags. |
| 56 | + |
| 57 | +**Required flags:** |
| 58 | +* `--glrunner-token` - Your GitLab access token (project or personal) |
| 59 | +* `--glrunner-url` - GitLab instance URL (e.g., `https://gitlab.com`) |
| 60 | +* `--glrunner-project-id` OR `--glrunner-group-id` - Either project or group ID (not both) |
| 61 | + |
| 62 | +**Optional flags:** |
| 63 | +* `--glrunner-tags` - Comma-separated tags (e.g., `aws,mapt,fedora`) |
| 64 | + |
| 65 | +To deploy a Fedora runner on AWS as a project runner: |
| 66 | + |
| 67 | +```bash |
| 68 | +mapt aws fedora create --spot \ |
| 69 | + --glrunner-token="glpat-xxxxxxxxxxxxxxxxxxxx" \ |
| 70 | + --glrunner-url="https://gitlab.com" \ |
| 71 | + --glrunner-project-id="12345678" \ |
| 72 | + --glrunner-tags="aws,fedora,mapt" \ |
| 73 | + --project-name mapt-fedora-aws \ |
| 74 | + --backed-url file:///Users/tester/workspace \ |
| 75 | + --conn-details-output /Users/tester/workspace/conn-details |
| 76 | +``` |
| 77 | + |
| 78 | +To deploy a RHEL runner on Azure as a group runner: |
| 79 | + |
| 80 | +```bash |
| 81 | +mapt azure rhel create --spot \ |
| 82 | + --glrunner-token="glpat-xxxxxxxxxxxxxxxxxxxx" \ |
| 83 | + --glrunner-url="https://gitlab.com" \ |
| 84 | + --glrunner-group-id="87654321" \ |
| 85 | + --glrunner-tags="azure,rhel,mapt" \ |
| 86 | + --project-name mapt-rhel-azure \ |
| 87 | + --backed-url file:///Users/tester/workspace \ |
| 88 | + --conn-details-output /Users/tester/workspace/conn-details |
| 89 | +``` |
| 90 | + |
| 91 | +> *NOTE:* If no tags are provided with `--glrunner-tags`, the runner can run untagged jobs. If tags are provided, the runner only runs jobs matching those tags. |
0 commit comments