Commit graph

48 commits

Author SHA1 Message Date
Gabriel Adrian Samfira
078659f81f Remove leftover test
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2023-07-16 12:02:23 +00:00
Gabriel Adrian Samfira
f5978f82d3 Remove some options and add docs
* Remove the unused CondifGir option
  * Add docs for the default section
  * Move some docs from other files

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2023-07-16 12:02:23 +00:00
Gabriel Adrian Samfira
f0e761bc6d Fix constraints
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2023-07-03 07:46:20 +00:00
Gabriel Adrian Samfira
a526c1024c Various fixes
* enable foreign key constraints on sqlite
  * on delete cascade for addresses and status messages
  * add debug server config option
  * fix rr allocation

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2023-07-03 07:46:20 +00:00
Gabriel Adrian Samfira
b6a593b20c fix sqlite connection URI
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2023-07-03 07:46:20 +00:00
Gabriel Adrian Samfira
8f604c8a32 Fix test
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2023-07-03 07:46:20 +00:00
Gabriel Adrian Samfira
4ec684b493 use journal mode WAL
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2023-07-03 07:46:20 +00:00
Gabriel Adrian Samfira
0074af9370
Move some defaults and types from config
The params package should not depend on config. The params packages
should be consumable by external applications that wish to interact with
garm, and it makes no sense to pull in the config package just for some
constants. As such, the following changes have been made:

  * Moved some types from config to params
  * Moved defaults in a new leaf package called appdefaults

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2023-03-14 14:15:10 +02:00
Gabriel Adrian Samfira
829db87f15
Rename module
This change renames the module from "garm" to "github.com/cloudbase/garm".

This will make it easier to consume public functions defined in garm, by
external applications, without having to resort to replace.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2023-03-12 16:01:49 +02:00
Gabriel Adrian Samfira
27a523f133 Fix TLS listener
The TLS listener was not being set up correctly. The TLSConfig was changed
to include only cert and key. The cert now needs to be a full chain bundle
including intermediary CA certificates. The ca_cert config option was removed.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2023-01-31 13:42:39 +00:00
Michael Kuhnt
6a032bfaa2
metrics: fix review findings 2023-01-26 15:46:27 +01:00
Michael Kuhnt
ee659f509f
feat: add prometheus metrics & endpoint 2023-01-26 14:15:16 +01:00
Gabriel Adrian Samfira
d3fe741cfe Don't save runner registration tolen in DB
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2022-12-06 19:48:00 +00:00
Gabriel Adrian Samfira
0869073906 Define a metadata subrouter
Define a metadata subrouter and move the token endpoint there. We may
end up needing multiple endpoints for various purposes in the future.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2022-12-02 19:48:38 +00:00
Gabriel Adrian Samfira
a078645ab2
Add token endpoint
This change adds a github registration endpoint that instances can use
to fetch a github registration token.

This change also invalidates disables access to an instance to the token
and status updates endpoints once the instance transitions from
"pending" or "installing" to any other state.
2022-12-01 18:00:22 +02:00
Gabriel Adrian Samfira
296333412a
Add enterprise support
This change adds enterprise support throughout garm.

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
a7f151e2d2
Add log streamer
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2022-10-21 11:13:42 +03:00
Gabriel Adrian Samfira
d4b7fca9f6
Fix test config_dir
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2022-09-06 21:35:42 +03:00
mihaelabalutoiu
229946a4c0 Add unit tests for full coverage to the NewConfig function 2022-07-26 13:43:56 +03:00
mihaelabalutoiu
795b7ebb56 Add missing assertion 2022-07-26 13:43:35 +03:00
mihaelabalutoiu
c523032c86 Fix NewConfig function
Move the default setting before validating the config, otherwise the code will
never run. This happens because the `Validate()` function will always fail when
`config.Default.ConfigDir` is empty.
2022-07-21 11:51:52 +03:00
Gabriel Adrian Samfira
95db6599ff Make external provider less opinionated about executable
You can now specify the absolute path to a provider executable instead
of specifying a provider directory with a "garm-external-provider" in it.
2022-07-16 18:00:07 +00:00
Gabriel Adrian Samfira
ecd476af02 Add container support to LXD provider plus fixes
* Add the ability to define an LXD provider which spins up containers
    instead of virtual machines.
  * Loading an LXD provider that is not reachable no longer crashes garm
    on startup.
  * Labels are no longer copied on image import. The LXD provider will
    resolve the image fingerprint from the simplestreams server every time.
    The image will be copied locally if a new version exists.
2022-07-12 13:34:12 +00:00
Gabriel Adrian Samfira
fb0bcbe3eb Add more tests
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2022-07-06 22:08:22 +00:00
Gabriel Adrian Samfira
8ccb152312 Add some more tests and switch to require
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2022-07-06 19:21:36 +00:00
Gabriel Adrian Samfira
874506e539 Add more tests
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2022-07-06 09:03: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
87c77f6966 Update readme, add some tests
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2022-07-05 17:48:25 +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
f52accc47f Add idempotency when stopping a VM and some tests
When deleting a VM, we try to force stop it. If the VM is already stopped,
LXD will return an error. Unfortunately, we can't import the drivers package
from LXD without also pulling in a bunch of linux specific CGO dependencies
which we want to avoid.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2022-06-28 15:13:02 +00:00
Gabriel Adrian Samfira
c089217a53
Add runner user to docker and lxd groups
Add the runner user to the docker and lxd groups. This will help avoid
the need for sudo if the workflow will require the use of either docker
or LXD.
2022-06-17 12:46:24 +03:00
Ionut Balutoiu
3c36854b65 Fix typos 2022-05-12 16:39:58 +03:00
Gabriel Adrian Samfira
0b70a30944 Add external providers and an example
Add the ability to externalize providers to a binary on disk.
2022-05-09 17:11:47 +00:00
Gabriel Adrian Samfira
2353d42ad2 Update README 2022-05-06 13:28:54 +00:00
Gabriel Adrian Samfira
5e0a64f909 Add license headers 2022-05-05 13:25:50 +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
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
2be5653683 Added some DB logic 2022-04-25 00:21:44 +00:00
Gabriel Adrian Samfira
ee207b0b54 Validate webhook and add some pool logic 2022-04-23 13:05:40 +00:00
Gabriel Adrian Samfira
ebec0dda52 Handle org runners 2022-04-22 14:46:27 +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