Commit graph

42 commits

Author SHA1 Message Date
Gabriel Adrian Samfira
72ec1bf68f No need to explicitly call Stop() on runner loops
Once the context is canceled, the loops will exit, so there is no
need to explicitly Stop(). We just need to Wait() for the loops to
exit.
2022-12-30 15:13:49 +00:00
Gabriel Adrian Samfira
d5f5524934 Wait for loop exit and some fixes
* Wait for http server graceful shutdown and for pool managers to
properly exit.
  * Fix potential nil pointer dereference when checking response
code from github API.
2022-12-30 15:07:40 +00:00
Gabriel Adrian Samfira
05057e37fd
Start pool managers in the background
Garm no longer fails on startup if a pool manager cannot be started. It
will attempt to start the pool manager in the background. If it fails
due to an unauthorized error, it will sleep for 3 hours. It is unlikely
it will work a second time if credentials are not updated in the config
and garm is restarted, so no point in getting rate limited.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2022-10-21 17:14:03 +03:00
Gabriel Adrian Samfira
3e3b91ee59
Add enterprise support to garm-cli
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2022-10-21 17:14:03 +03:00
Gabriel Adrian Samfira
f40420bfb6
Add ability to specify github enpoints for creds
The GitHub credentials section now allows setting some API endpoints
that point the github client and the runner setup script to the propper
URLs. This allows us to use garm with an on-prem github enterprise server.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2022-10-21 17:14:03 +03:00
Gabriel Adrian Samfira
a55f852161
Use multi writer for API logs
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2022-10-21 17:13:53 +03:00
Gabriel Adrian Samfira
16b56c89de
Format message on error 2022-10-21 11:38:16 +03:00
Gabriel Adrian Samfira
bad7398b6c
Convert byte array to string 2022-10-21 11:23:04 +03:00
Gabriel Adrian Samfira
a7f151e2d2
Add log streamer
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2022-10-21 11:13:42 +03:00
Gabriel Adrian Samfira
5566cde77f A few fixes
* CLI properly formats the IP addresses in runner show
  * LXD provider now waits for an IP address before returning on Create
  * Added a few mocks for testing

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2022-07-10 14:52:15 +00:00
Gabriel Adrian Samfira
280cad96e4 Make runner-bootstrap-timeout optional
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2022-07-06 17:37:18 +00:00
Gabriel Adrian Samfira
535f39a1ba Make use of CORS, add more tests
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2022-07-05 19:28:50 +00:00
Gabriel Adrian Samfira
9e949d833f Update .gitignore
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2022-06-30 10:34:51 +00:00
Gabriel Adrian Samfira
bbbe67bf7c Vendor packages and add Makefile
* Vendors packages
  * Adds a Makefile that uses docker to build a static binary against musl
using alpine linux.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2022-06-30 10:20:32 +00:00
Gabriel Adrian Samfira
15a1308441 Add timeout functionality for pool runner bootstrap
Pools can now define a bootstrap timeout for runners. The timeout can
be defined per pool and indicates the amount of time after which a runner
is considered defunct and removed.

If a runner doesn't join github in the configured amount of time, and it
receives no updates indicating that it is installing the runner via instance
status updates, it is considered defunct.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2022-06-29 23:44:03 +00:00
Gabriel Adrian Samfira
5390efbaab Add manual runner removal
Runners can now be manually removed using the CLI. Some restrictions apply:

  * A runner must be idle in github. Github will not allow us to remove a runner
that is running a workflow.
  * The runner status must be "running"

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2022-06-29 16:23:01 +00:00
Gabriel Adrian Samfira
a8274dcc02 Add profile management in the CLI 2022-06-17 10:58:35 +00:00
Gabriel Adrian Samfira
dc04bca95c Retry failed runners
* retry adding runners for up to 5 times if they fail.
  * various fixes
2022-05-10 12:28:39 +00:00
Gabriel Adrian Samfira
5e0a64f909 Add license headers 2022-05-05 13:25:50 +00:00
Gabriel Adrian Samfira
d9c65872e8 Added more CLI commands and API endpoints 2022-05-05 13:07:06 +00:00
Gabriel Adrian Samfira
1e2e96ccb5 Paralelize loading pools 2022-05-05 07:54:52 +00:00
Gabriel Adrian Samfira
6b80009730 Add org instances command
* Adds command to list runners from all org pools
2022-05-04 22:04:30 +00:00
Gabriel Adrian Samfira
f130798f41 Added org pool command
* added new command
  * fixed a bunch of bugs in orgs
2022-05-04 21:57:08 +00:00
Gabriel Adrian Samfira
7964a8f03f Added CLI organizations command 2022-05-04 16:34:18 +00:00
Gabriel Adrian Samfira
095b43ffb4 Add organizations 2022-05-04 16:27:24 +00:00
Gabriel Adrian Samfira
3e416d8272 Slight refactor of sql code 2022-05-04 13:15:27 +00:00
Gabriel Adrian Samfira
11c7ec6ad1 Fix windows build tags 2022-05-04 11:48:27 +00:00
Gabriel Adrian Samfira
1dda4a835c Rename project to garm
Project renamed to garm (Github Actions Runner Manager)
2022-05-04 11:44:10 +00:00
Gabriel Adrian Samfira
2bd128af13 Runners now send status messages 2022-05-03 19:49:14 +00:00
Gabriel Adrian Samfira
6bdb8cd78b return proper error on conflict 2022-05-03 13:20:49 +00:00
Gabriel Adrian Samfira
8ceafff09b Add more CLI commands 2022-05-03 12:40:59 +00:00
Gabriel Adrian Samfira
475d424f32 Add a basic CLI 2022-05-02 17:55:29 +00:00
Gabriel Adrian Samfira
0314fd3b67 Add some API resources 2022-04-29 14:18:22 +00:00
Gabriel Adrian Samfira
0883fcd5cd Add some basic auth 2022-04-28 16:13:20 +00:00
Gabriel Adrian Samfira
66b46ae0ab Implement some more db functions 2022-04-27 16:56:28 +00:00
Gabriel Adrian Samfira
62ba5a5a08 WiP 2022-04-26 20:29:58 +00:00
Gabriel Adrian Samfira
ebec0dda52 Handle org runners 2022-04-22 14:46:27 +00:00
Gabriel Adrian Samfira
bf0a5bf147 LXD provider implementation
finished implementation of LXD provider.
2022-04-19 20:22:50 +00:00
Gabriel Adrian Samfira
d68b842375 LXD provider can create workers
The bare minimum needed code to successfully create an instance that
installs and launches a runner is there.
2022-04-19 14:42:10 +00:00
Gabriel Adrian Samfira
eb28542110 Added cloud config 2022-04-18 17:26:13 +00:00
Gabriel Adrian Samfira
9d2ab57603 Add some LXD provider code 2022-04-15 15:22:47 +00:00
Gabriel Adrian Samfira
d48130e872 Initial commit
Added some config structures
2022-04-13 16:47:42 +00:00