Commit graph

84 commits

Author SHA1 Message Date
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
5b651eeb3f Update example config with LXD instance type setting
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2022-07-16 13:52:38 +00:00
Gabriel Adrian Samfira
3da860eea6 Always lookup images in simplestreams
This change makes sure we always download the latest image from
simplestreams. We no longer copy labels from simplestreams so we need
to lookup the hash of the image against simplestreams. This means that
in airgapped environments, the operator will have to manually tag images
and use the tag name in favor of remote:image_name.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2022-07-16 13:47:17 +00:00
Gabriel Adrian Samfira
dede5cc465 Allow deletion of a runner in error state
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2022-07-16 13:41:26 +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
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
afb1d31394 Slight cleanup
* added interface for the github client. This will help mocking it
out for testing.
  * removed some unused code
  * moved some code around

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2022-07-07 16:48:00 +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
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
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
42249ede0b Set SELinux labels on host FS when building via docker/podman
Adds :z to the bind mount, ensuring the container can access the files
when SELinux is enabled.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2022-06-30 15:11:10 +00:00
Gabriel
7da2875e2b
Merge pull request #4 from pothos/building-with-podman
Support building with Podman instead of Docker
2022-06-30 14:09:01 +03:00
Kai Lueke
f052709112 Support building with Podman instead of Docker
When /usr/bin/docker is a wrapper for podman (as common no Fedora),
Podman will be used which requires the full image name including the
registry. It does not require the chown step, because this results in
the files being owned by a temporary mapped ID due to the user
namespace in rootless mode (which is the default unless Podman is run
by the root user) - make the chown a no-op by using UID/GID 0.
2022-06-30 13:06:33 +02: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
0a17578798 Properly set timeout on pool create
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2022-06-30 06:55:13 +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
1f419d0abc Unwrap error before comparing
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2022-06-28 16:27: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
b4e9af13d5 Fix tags update 2022-06-24 11:41:38 +00:00
Gabriel Adrian Samfira
846bd672ad Fix cleanup orphaned github runners 2022-06-24 11:17:34 +00:00
Gabriel Adrian Samfira
63824247be Optimize orphan cleanup and add Debian to OS list
* Runner names are unique. Skip querying pool, then runner name. Just fetch
the runner, which has a PoolID field set that can be used to determine the
pool.
  * Add Debian to the list of Linux OSs
2022-06-24 10:01:20 +00:00
Gabriel Adrian Samfira
808bc42d33 Add image alias if not there
On LXD, if the list of image aliases does not include the image name
we just fetched from the simplestreams remote, add it to the list.
2022-06-17 15:31:47 +00:00
Gabriel Adrian Samfira
a8274dcc02 Add profile management in the CLI 2022-06-17 10:58:35 +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
Gabriel Adrian Samfira
98eb594cd6 Remove some blocking code
* added 2 new statuses: creating and deleting
  * remove wait on create/delete, speeding things up a bit
2022-05-13 23:34:16 +00:00
Gabriel Adrian Samfira
e7eb13acc9 Update readme 2022-05-13 13:24:39 +00:00
Gabriel Adrian Samfira
51b3bc816c Add some docs (WiP) 2022-05-12 21:37:53 +00:00
Gabriel
1e991795a2
Merge pull request #2 from ionutbalutoiu/add-azure-external-provider
Add azure external provider
2022-05-12 22:19:10 +03:00
Ionut Balutoiu
366ccf76c5 Add Azure external provider example 2022-05-12 22:13:33 +03:00
Ionut Balutoiu
3c36854b65 Fix typos 2022-05-12 16:39:58 +03:00
Gabriel Adrian Samfira
209347e0c6 Fix bug in get instance query 2022-05-11 14:50:19 +00:00
Gabriel Adrian Samfira
f428e86fb1 update readme 2022-05-11 09:36:19 +00:00
Gabriel Adrian Samfira
c554f7561a convert tabs to spaces 2022-05-10 18:42:46 +00:00
Gabriel Adrian Samfira
9a59028c1a Merge branch 'main' of github.com:cloudbase/garm into main 2022-05-10 16:10:35 +00:00
Gabriel Adrian Samfira
4e4ab691c8 Error when deleting a pool with runners 2022-05-10 16:10:02 +00:00
Gabriel
1d864e8130
Merge pull request #1 from ionutbalutoiu/fix-type
Fix typo
2022-05-10 18:50:42 +03:00
Ionut Balutoiu
011e66872f Fix typo
Fix `README.md` typo.
2022-05-10 18:46:27 +03:00
Gabriel Adrian Samfira
8a7396151f Fix sample config db passphrase and comment 2022-05-10 15:40:11 +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
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
ebe7d722c0 updated README 2022-05-06 14:33:00 +00:00
Gabriel Adrian Samfira
bc4f4c7ffc updated README 2022-05-06 14:32:15 +00:00
Gabriel Adrian Samfira
687d84d8fe updated README 2022-05-06 14:13:04 +00:00
Gabriel Adrian Samfira
af684962eb Update README 2022-05-06 13:54:26 +00:00
Gabriel Adrian Samfira
7c7d8fc37a Update README 2022-05-06 13:48:08 +00:00