GARM has a backoff interval when consuming queued jobs. This backoff
is intended to allow any potential idle runners to pick up a job before
GARM attempts to spin up a new one. This change allows users to set a
custom backoff interval or disable it altogether by setting it to 0.
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
This change uses the database watcher to watch for changes to the
github entities, credentials and controller info.
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
The watcher uses a buffered channel, so we may get stray events that
we need to consume before generating new ones in the tests.
This is just for testing purposes. In actual use cases, we never expect
to only have one event generated.
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
Adds a simple database watcher. At this point it's just one process, but
the plan is to allow different implementations that inform the local running
workers of changes that have occured on entities of interest in the database.
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
This change moves the callback_url, metadata_url and webhooks_url from
the config to the database. The goal is to move as much as possible from
the config to the DB, in preparation for a potential refactor that will
allow GARM to scale out. This would allow multiple nodes to share a single
source of truth.
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
There are only a few cases, where we get a job information from github
where the runner name is not set.
For all this cases we do not need to check github API at all because
these jobs are never ever get scheduled to a runner:
job.Action is:
* queued:
a queued job is just queued and not scheduled to a runner so we do
not get a runner name from the GH API
* completed:
when conclusion=cancelled|failure github never scheduled the job to a
runner and with that we do not get a runner name from the GH API
Signed-off-by: Mario Constanti <mario.constanti@mercedes-benz.com>
github is sending job events where conclusion=cancelled is spelled in american english.
Signed-off-by: Mario Constanti <mario.constanti@mercedes-benz.com>
This updates go-swagger to v0.31.0, which no longer panics when used
with golang v1.22+.
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
This change removes a check that denies the creation of a pool
if the new pool has the same image and flavor set on the same
provider. The reasoning for that check was that if you need to
create another pool with identical settings to an existing one,
you might as well scale up the min-idle-runners on the old one.
This was done when runner groups were not yet added. This in
turn has forced users to alias images with new names in their
provider, leading to terrible UX. In the end, being too
opinionated in this case has caused more harm than good.
Fixes#245
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>