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.
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.
Currently, it allows you to create self-hosted GitLab runners on AWS (Fedora, RHEL, Windows Server, macOS) and Azure (RHEL, Windows Desktop).
To register a GitLab Runner, you need an access token with create_runner and manage_runner scopes. There are two options:
Project Access Tokens are scoped to a specific project, making them more secure than personal tokens.
Requirements:
- GitLab Premium/Ultimate (on GitLab.com)
- OR self-managed GitLab instance (version 13+)
Steps:
- Go to your project → Settings → Access Tokens
- Create a new token with:
- Token name:
mapt-runner - Role:
MaintainerorOwner - Scopes: Select
create_runnerandmanage_runner - Expiration: Set according to your needs
- Token name:
- Click Create project access token
- Copy the token immediately
If Project Access Tokens are not available, use a Personal Access Token:
- Go to User Settings → Access Tokens
- Create a new token with:
- Token name:
mapt-runner-token - Scopes: Select
create_runnerandmanage_runner - Expiration: Set according to your needs
- Token name:
- Click Create personal access token
- Copy the token immediately
You also need either a Project ID or Group ID:
- Project ID: Go to your project → Settings → General (displayed at the top)
- Group ID: Go to your group → Settings → General (displayed at the top)
NOTE: For Group Runners with Group Access Tokens, you'll need GitLab Premium/Ultimate on GitLab.com or a self-managed instance.
After obtaining the token and the project/group ID, you can deploy a runner using the appropriate flags.
Required flags:
--glrunner-token- Your GitLab access token (project or personal)--glrunner-url- GitLab instance URL (e.g.,https://gitlab.com)--glrunner-project-idOR--glrunner-group-id- Either project or group ID (not both)
Optional flags:
--glrunner-tags- Comma-separated tags (e.g.,aws,mapt,fedora)--glrunner-http-proxy- Proxy URL for the jobs when the host network needs an egress proxy (e.g.,http://proxy.example.com:3128). It is written to the runner'senvironmentasHTTP_PROXY,HTTPS_PROXY,http_proxyandhttps_proxy--glrunner-no-proxy- Comma-separated host names, domains or IP addresses the jobs reach directly, written asNO_PROXYandno_proxy. Requires--glrunner-http-proxy. CIDR ranges such as10.0.0.0/8are rejected, because some clients (curl on RHEL 9, for example) ignore them without an error
Both proxy flags need --glrunner-token; without it no runner is set up and they are ignored.
NOTE: The proxy settings only reach the jobs. Downloading and registering the runner, the runner service and the image pulls made by Podman on the host use the host's own proxy configuration; see #974.
NOTE: The proxy URL, including any credentials in it, ends up in:
- the instance user data, which any process on the host can read from the cloud's instance metadata service. With
--glrunner-unsecure, jobs run as the host login user, so job code can read it too- the Pulumi state in the
--backed-urlbackend, because the user data is a resource input/var/lib/cloud/instance/user-data.txton Linux hosts that use cloud-init/etc/gitlab-runner/config.tomlPrefer a proxy that allows clients by source address, or a credential used only for this runner. Percent-encode special characters such as
@,:,/,?and#in a user name or password.
To deploy a Fedora runner on AWS behind an egress proxy:
mapt aws fedora create --spot \
--glrunner-token="glpat-xxxxxxxxxxxxxxxxxxxx" \
--glrunner-url="https://gitlab.com" \
--glrunner-project-id="12345678" \
--glrunner-http-proxy="http://proxy.example.com:3128" \
--glrunner-no-proxy="localhost,127.0.0.1,.internal.example.com" \
--project-name mapt-fedora-aws \
--backed-url file:///Users/tester/workspace \
--conn-details-output /Users/tester/workspace/conn-detailsTo deploy a Fedora runner on AWS as a project runner:
mapt aws fedora create --spot \
--glrunner-token="glpat-xxxxxxxxxxxxxxxxxxxx" \
--glrunner-url="https://gitlab.com" \
--glrunner-project-id="12345678" \
--glrunner-tags="aws,fedora,mapt" \
--project-name mapt-fedora-aws \
--backed-url file:///Users/tester/workspace \
--conn-details-output /Users/tester/workspace/conn-detailsTo deploy a RHEL runner on Azure as a group runner:
mapt azure rhel create --spot \
--glrunner-token="glpat-xxxxxxxxxxxxxxxxxxxx" \
--glrunner-url="https://gitlab.com" \
--glrunner-group-id="87654321" \
--glrunner-tags="azure,rhel,mapt" \
--project-name mapt-rhel-azure \
--backed-url file:///Users/tester/workspace \
--conn-details-output /Users/tester/workspace/conn-detailsNOTE: 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.