Bring your own runners
Run jobs on your own machines, such as a Mac mini for code signing, a GPU box or a fleet inside your VPC. Pipemesh stays hosted, and those jobs' code and secrets never touch hosted compute.
A runner is a name your jobs give, plus the machines that joined it.
They run the open-source
gitlab-runner agent, as-is.
It only talks to Pipemesh, and your repositories stay on GitHub.
1. Create a runner
Organization owners create it in Settings → Organization → Runners → New runner, or with the CLI:
pipemesh runners create build-farm
Names use lower-case letters, digits, ., _ and -. Names starting
linux-, macos- or windows- are reserved for hosted runners.
Creating the runner shows its token (glrt-…) once. Copy it then:
it won't be shown again. Machines join the runner with it (see Join
machines). New token on the runner (or
pipemesh runners token build-farm) makes another, shown the same way.
Pull request jobs are off by default. They never run on your runner's machines, because on a public repository a pull request's code can come from anyone's fork. Turn them on for a runner whose repositories are private, or whose machines you can afford to expose.
Limit what a runner takes
A runner whose machines hold credentials, such as a cloud role through their service account or instance profile, is a security boundary: only the jobs it is meant for may run there. Give it a scope, when you create it or later:
pipemesh runners create deploy-prod \
--repos='acme/payments/**' --refs='default,tag:v*'
pipemesh runners update deploy-prod --repos='acme/payments/**,id:4211'
- Repositories: paths without the host.
*is one level and**any number of them, soacme/payments/**covers every repository under that group, including ones created later.id:<n>is the provider's repository id, which a rename keeps. Empty: every repository of the organization. - Refs:
default(the branch each repository's pipeline runs),branch:<pattern>andtag:<pattern>. Empty: any ref. A runner with refs never takes pull request jobs, since their branch name is the author's to choose. A tag starts a run only from the repository's branch or a branch its trigger lists, sotag:v*takes release tags cut from those.
The runner's machines never receive a job outside its scope. A job that
names the runner from outside it fails at once, and its log says what
the runner takes and what the run was. On GitHub, its machines hold only
the clone tokens of the repositories their jobs clone, each reading that
one repository (What a job gets),
so the scope also bounds what they can read. The scope shows on the runner in
Settings and in pipemesh runners list, with who changed it last. Each
change is recorded in the audit log.
Pause a runner (pipemesh runners update deploy-prod --paused) to
keep its machines from taking jobs. Jobs that name it wait until
Resume.
2. Join machines
Register each machine with the runner's token (gitlab-runner 16 or
later). The command Pipemesh shows next to the token is an example: use
the executor of your choice (shell, docker, kubernetes, …).
gitlab-runner register \
--non-interactive \
--url https://pipemesh.io \
--token glrt-XXXXXXXX_YYYYYYYY \
--executor shell
Any number of machines can share a token. A fleet can use one token,
or a token per group of machines, so revoking one stops only that group.
Each machine is the token plus
the system_id its agent keeps, and shows up under the runner, online
if it asked for work in the last two minutes. gitlab-runner unregister
removes that machine; a token no other machine has used goes with it.
A machine silent for a week is dropped, and comes back as itself if it
asks for work again. A token no machine has used for 30 days is
revoked.
Provision runners from automation
A fleet with a runner per team, environment and account is kept in a
repository and deployed, not clicked. A runner-management token
(Settings → Runners → Automation, or
pipemesh runners management-token deployer) belongs to the
organization, not to a person. It can list, create and update the
organization's runners and mint and revoke their tokens, and nothing
else.
Declare the runners and apply them on every deploy:
# runners.yaml
runners:
deploy-prod:
description: Production deploys (account 4411)
repos: [acme/payments/**]
refs: [default, tag:v*]
build-farm:
pull_requests: true
PIPEMESH_TOKEN=pmrm_… pipemesh runners apply runners.yaml # creates or updates each one
PIPEMESH_TOKEN=pmrm_… pipemesh runners apply runners.yaml --prune # and deletes the rest
Entrypoints written for GitLab keep working. GitLab's
POST /api/v4/user/runners creates the runner, or updates it if it
exists, and returns a token for register --token. The
runner's name is name, or description when that is a valid runner
name. tag_list, runner_type and group_id are accepted and ignored,
because a job picks its runner with runner:.
# In the runner pod's entrypoint, with the management token from a Secret
TOKEN=$(curl -fsS -X POST "$PIPEMESH_URL/api/v4/user/runners" \
-H "PRIVATE-TOKEN: $RUNNER_MANAGEMENT_TOKEN" \
--data name=deploy-prod --data runner_type=group_type | jq -r .token)
gitlab-runner register --non-interactive --url "$PIPEMESH_URL" --token "$TOKEN" --executor kubernetes
exec gitlab-runner run
A pod that creates its token at start and unregisters on stop (a
preStop hook running gitlab-runner unregister --all-runners) leaves
nothing behind. An organization can have up to 500 runners.
3. Run jobs on it
sign_app:
job_type: build # signs what it consumes; checks out only its script
stage: release
runner: mac-signing # runs only on the machines of the runner "mac-signing"
consumes:
APP: build/app # the file lands at its path; $APP is that path
checkout:
- scripts/sign.sh
script:
- ./scripts/sign.sh "$APP"
produces:
signed: dist/app-signed.zip
The job runs only on the runner's machines, and only for your organization's repositories, within the runner's scope. It never falls back to hosted compute, and your runners aren't metered.
- No machine can take it? It waits, and its card says why: no runner by that name, no machine online, the runner is paused, or it doesn't take pull request jobs. A run outside the runner's scope fails instead (see above).
- A machine goes silent mid-job? The job fails at its
timeout_seconds(one hour when absent).
What a job gets
The same as on hosted runners: its image:
(with the Docker and Kubernetes executors), a workspace with exactly
what its checkout: lists (its commit only, no history), its secrets as masked
variables, the artifacts it consumes, its cache: and produces: (an image
Pipemesh builds, build:, needs a hosted runner). A bootstrap
sets this up as the first script line, so the image needs bash, git,
curl and tar.
Remove machines and runners
- A machine: run
gitlab-runner unregisteron it, or remove it from the runner. It stops at once if no other machine shares its token, since the token goes with it. A machine whose token others share is stopped by revoking that token. - A token: revoke it, and every machine that joined with it stops at once.
- A runner: delete it (or
pipemesh runners delete build-farm) to remove its machines and revoke its tokens. Jobs that name it wait.
GitHub Actions
Give a job github_actions: in place of script:, and an Actions
workflow runs it on any runner Actions accepts, GitHub-hosted or
self-hosted. The job settles on the run's verdict and keeps its job
type, so a deploy is still a deploy. Release stages, gates and promotion
stay in Pipemesh (see The definition).
GitHub's own runner (
actions/runner) speaks GitHub's proprietary broker protocol, so it can't connect to Pipemesh today. Usegitlab-runner, and Pipemesh handles the checkout credentials. Native support is being assessed.