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>
* The `{{ .RunnerUsername }}` is not replaced in any external providers' scripts.
However, we can safely assume that the username is properly created by
cloud-init before the userdata is executed.
* Correctly use the `OS_TO_GH_ARCH_MAP` bash map.
Signed-off-by: Ionut Balutoiu <ibalutoiu@cloudbasesolutions.com>
When garm starts up, it attempts to cleanup any orphaned runners from
github. This, unfortunately ends up deleting manually set up runners.
This change looks for our controller ID in the labels of the runners and
only deleted runners that we created.
Fixes: #40
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
The error is not wrapped correctly, because instead of using `q.Error`,
it uses `err`, which is defined elsewhere.
Also, the `UpdateRepository` and `CreateRepositoryPool` functions will
never fail on update/create repo, because it returns a nil error, instead
of wrap error.
Signed-off-by: Mihaela Balutoiu <mbalutoiu@cloudbasesolutions.com>
The error is not wrapped correctly, because instead of using `q.Error`,
it uses `err`, which is defined elsewhere.
Also, the `UpdateOrganization` and `CreateOrganizationPool` functions will
never fail on update/create org, because it returns a nil error, instead
of wrap error.
Signed-off-by: Mihaela Balutoiu <mbalutoiu@cloudbasesolutions.com>
This case is probably caused by a webhook event that was meant for
another runner controller / manager. No need to report this as
error, we can simply ignore this and avoid noise in the logs.
Github treats owners (users and orgs) and repos as case insensitive. To
github, https://github.com/cloudbase/garm is equivalent to
https://github.com/CloudBase/GaRm. This commit makes the sql store
backend, case insensitive when querying repos and orgs.
Fixes: #25
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
Add more test cases regarding the SQL database interactions.
Moreover, add `go-sqlmock` dependency used to mock SQL DB instructions.
Signed-off-by: Mihaela Balutoiu <mbalutoiu@cloudbasesolutions.com>
Make sure that the README `Go Test` badge has a link to the GitHub
page with latest workflow results.
Signed-off-by: Ionut Balutoiu <ibalutoiu@cloudbasesolutions.com>
In some cases, runner information is not sent via webhook by Github when
a workflow job transitions to in_progress. We need to know the runner
name in order to update the state in the database. Attempt to fetch the
runner from the API using the workflow ID.
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>