GitHub Actions Runner Manager
Find a file
Gabriel Adrian Samfira d09f12dfd8 Add force delete runner
This branch adds the ability to forcefully remove a runner from GARM.

When the operator wishes to manually remove a runner, the workflow is as
follows:

* Check that the runner exists in GitHub. If it does, attempt to
  remove it. An error here indicates that the runner may be processing
  a job. In this case, we don't continue and the operator gets immediate
  feedback from the API.
* Mark the runner in the database as pending_delete
* Allow the consolidate loop to reap it from the provider and remove it
  from the database.

Removing the instance from the provider is async. If the provider errs out,
GARM will keep trying to remove it in perpetuity until the provider succedes.

In situations where the provider is misconfigured, this will never happen, leaving
the instance in a permanent state of pending_delete.

A provider may fail for various reasons. Either credentials have expired, the
API endpoint has changed, the provider is misconfigured or the operator may just
have removed it from the config before cleaning up the runners. While some cases
are recoverable, some are not. We cannot have a situation in which we cannot clean
resources in garm because of a misconfiguration.

This change adds the pending_force_delete instance status. Instances marked with
this status, will be removed from GARM even if the provider reports an error.

The GARM cli has been modified to give new meaning to the --force-remove-runner
option. This option in the CLI is no longer mandatory. Instead, setting it will mark
the runner with the new pending_force_delete status. Omitting it will mark the runner
with the old status of pending_delete.

Fixes: #160

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2023-10-12 06:15:36 +00:00
.github/workflows Refactor integration E2E tests 2023-08-24 15:22:46 +03:00
apiserver Add force delete runner 2023-10-12 06:15:36 +00:00
auth Add temporary redirect to go-github fork 2023-09-24 13:49:04 +00:00
client Add force delete runner 2023-10-12 06:15:36 +00:00
cmd Add force delete runner 2023-10-12 06:15:36 +00:00
config Add flag to toggle webhook management 2023-08-22 09:39:02 +03:00
contrib Rotate log file on SIGHUP 2023-06-27 20:04:20 +03:00
database Add force delete runner 2023-10-12 06:15:36 +00:00
doc feat: add new metrics 2023-10-06 10:21:56 +02:00
internal/testing Rename module 2023-03-12 16:01:49 +02:00
metrics feat: add new metrics 2023-10-06 10:21:56 +02:00
params Add JIT config as part of instance create 2023-09-24 13:51:17 +00:00
runner Add force delete runner 2023-10-12 06:15:36 +00:00
scripts Enable Windows builds 2023-08-18 14:46:00 +00:00
test/integration Update go-github and garm-provider-common 2023-09-24 07:56:56 +00:00
testdata Update comment on option 2023-08-22 09:39:02 +03:00
util Replace deprecated function call 2023-09-24 08:04:00 +00:00
vendor Add force delete runner 2023-10-12 06:15:36 +00:00
websocket Fixed a bunch of linting issues 2023-01-20 22:21:22 +02:00
.gitignore Refactor integration E2E tests 2023-08-24 15:22:46 +03:00
Dockerfile Enable Windows builds 2023-08-18 14:46:00 +00:00
Dockerfile.build-static Enable Windows builds 2023-08-18 14:46:00 +00:00
go.mod Add force delete runner 2023-10-12 06:15:36 +00:00
go.sum Add force delete runner 2023-10-12 06:15:36 +00:00
LICENSE Initial commit 2022-04-13 19:45:01 +03:00
Makefile Enable Windows builds 2023-08-18 14:46:00 +00:00
README.md Cleanup old docs 2023-07-20 10:46:22 +00:00

GitHub Actions Runner Manager (GARM)

Go Tests

Welcome to GARM!

Garm enables you to create and automatically maintain pools of self-hosted GitHub runners, with autoscaling that can be used inside your github workflow runs.

The goal of GARM is to be simple to set up, simple to configure and simple to use. It is a single binary that can run on any GNU/Linux machine without any other requirements other than the providers it creates the runners in. It is intended to be easy to deploy in any environment and can create runners in any system you can write a provider for. There is no complicated setup process and no extremely complex concepts to understand. Once set up, it's meant to stay out of your way.

Garm supports creating pools on either GitHub itself or on your own deployment of GitHub Enterprise Server. For instructions on how to use GARM with GHE, see the credentials section of the documentation.

Join us on slack

Whether you're running into issues or just want to drop by and say "hi", feel free to join us on slack.

slack

Installing

Check out the quickstart document for instructions on how to install GARM. If you'd like to build from source, check out the building from source document.

Installing external providers

External providers are binaries that GARM calls into to create runners in a particular IaaS. There are currently two external providers available:

Follow the instructions in the README of each provider to install them.

Configuration

The GARM configuration is a simple toml. The sample config file in the testdata folder is fairly well commented and should be enough to get you started. The configuration file is split into several sections, each of which is documented in its own page. The sections are:

Optimizing your runners

If you would like to optimize the startup time of new instance, take a look at the performance considerations page.

Write your own provider

The providers are interfaces between GARM and a particular IaaS in which we spin up GitHub Runners. These providers can be either native or external. The native providers are written in Go, and must implement the interface defined here. External providers can be written in any language, as they are in the form of an external executable that GARM calls into.

There is currently one native provider for LXD and two external providers for Openstack and Azure.

If you want to write your own provider, you can choose to write a native one, or implement an external one. The easiest one to write is probably an external provider. Please see the Writing an external provider document for details. Also, feel free to inspect the two available external providers in this repository.