Commit graph

746 commits

Author SHA1 Message Date
Gabriel Adrian Samfira
e2eb8f719b
Check for nil pointer before dereferencing
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-03-26 16:43:09 +02:00
Gabriel
bb67ae5afe
Merge pull request #237 from gabriel-samfira/fix-jit-config-empty-group
Fix JIT config with empty runner group name
2024-03-25 20:59:56 +02:00
Gabriel Adrian Samfira
39f1be5512 Fix JIT config with empty runner group name
When no runner group is set, do not attempt to resolve the runner group.
Looking for an empty runner group will just return a not found error, which
will make GARM fall back to registration token.

This change fixes that.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-03-25 18:53:53 +00:00
Gabriel
90dd92d27c
Merge pull request #235 from gabriel-samfira/refactor-internal-gh-client
Refactor internal gh client
2024-03-18 20:12:53 +02:00
Gabriel Adrian Samfira
f0080047a3 Remove superfluous function
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-03-18 10:56:49 +00:00
Gabriel Adrian Samfira
56da6a4437 Slightly better UX when dealing with webhooks
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-03-18 10:19:16 +00:00
Gabriel Adrian Samfira
9259f84e56 Fix getting webhook URL info
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-03-18 09:53:34 +00:00
Gabriel Adrian Samfira
cfb68f8928 Check webhook secret for entity
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-03-18 09:39:07 +00:00
Gabriel Adrian Samfira
e3ffc153d2 simplify switch statement
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-03-17 18:08:46 +00:00
Gabriel Adrian Samfira
bef8f30d63 Fix lint
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-03-17 11:13:14 +00:00
Gabriel Adrian Samfira
fa75ecfa8e Dedupe more code
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-03-17 10:59:09 +00:00
Gabriel Adrian Samfira
b550d0c5b9 remove extra function
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-03-17 10:28:35 +00:00
Gabriel Adrian Samfira
1734e6f87c Deduplicate code
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-03-17 10:21:41 +00:00
Gabriel Adrian Samfira
234f71d9d1 Rename PoolType to GithubEntityType
We'll use GithubEntityType throughout the codebase to determine the
type of operation that is about to take place, so this won't belimited
to determining only pool type. We'll also use this to dedupe the label
scope as well.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-03-17 06:58:03 +00:00
Gabriel
2c217f0479
Merge pull request #234 from gabriel-samfira/add-oci-provider
Add OCI to provider list
2024-03-17 08:03:55 +02:00
Gabriel Adrian Samfira
e7834820c3 Add OCI to provider list
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-03-17 06:03:06 +00:00
Gabriel
6bfcddca75
Merge pull request #233 from gabriel-samfira/add-balancing-strategy
Add pool balancing strategy
2024-03-15 23:40:12 +02:00
Gabriel Adrian Samfira
206fe42c73 Remove unused code, update test
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-03-15 15:48:53 +00:00
Gabriel Adrian Samfira
ac29af6eff Add some unit tests
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-03-15 14:35:23 +00:00
Gabriel Adrian Samfira
d7ea80a657 Remove log message
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-03-15 08:12:16 +00:00
Gabriel Adrian Samfira
cdfda0321a Fix balancer type validation
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-03-15 07:26:04 +00:00
Gabriel Adrian Samfira
b58555bc10 Fix missing info in pool list
Without preloading the entity we're listing pools for, we don't get that
info when listing pools for a repo/org/enterprise.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-03-14 20:19:54 +00:00
Gabriel Adrian Samfira
ce3c917ae5 Add pool balancing strategy
This change adds the ability to specify the pool balancing strategy to
use when processing queued jobs. Before this change, GARM would round-robin
through all pools that matched the set of tags requested by queued jobs.

When round-robin (default) is used for an entity (repo, org or enterprise)
and you have 2 pools defined for that entity with a common set of tags that
match 10 jobs (for example), then those jobs would trigger the creation of
a new runner in each of the two pools in turn. Job 1 would go to pool 1,
job 2 would go to pool 2, job 3 to pool 1, job 4 to pool 2 and so on.

When "stack" is used, those same 10 jobs would trigger the creation of a
new runner in the pool with the highest priority, every time.

In both cases, if a pool is full, the next one would be tried automatically.

For the stack case, this would mean that if pool 2 had a priority of 10 and
pool 1 would have a priority of 5, pool 2 would be saturated first, then
pool 1.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-03-14 20:04:34 +00:00
Gabriel
569d512819
Merge pull request #232 from gabriel-samfira/add-job-details
Add job info in runner list
2024-03-12 15:14:07 +02:00
Gabriel Adrian Samfira
7d33e0f0cf Add job info in runner list
This change adds information about the job a runner is currently handling.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-03-11 15:46:18 +00:00
Gabriel
321126629a
Merge pull request #231 from gabriel-samfira/bypass-gh-unauthorized
Allow bypassing Unauthorized error when deleting runner
2024-03-10 17:51:39 +02:00
Gabriel Adrian Samfira
9a6770c3a3 Allow bypassing Unauthorized error when deleting runner
This change allows users to bypass GitHub Unauthorized errors when removing
github runners. This means that removing runners will now be possible even
if the pool manager is stopped.

There is a new flag added to the runner rm command and to the API that
tells GARM to bypass pool being stopped and any 401 error returned by
GitHub.

This means you will be able to remove the runners from garm and your
provider, but will mean that the runner will still exist in github as
"offline" if the credentials are not updated or the runner manually removed.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-03-10 15:21:39 +00:00
Gabriel
df72c4917e
Merge pull request #229 from gabriel-samfira/add-toc
Add ToC to using_garm.md
2024-03-05 09:52:37 +02:00
Gabriel Adrian Samfira
73a2690d45 Add ToC to using_garm.md
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-03-05 07:52:01 +00:00
Gabriel
1b11c682c1
Merge pull request #228 from gabriel-samfira/add-github-app-support
Add GitHub App support
2024-03-04 09:46:10 +02:00
Gabriel Adrian Samfira
d734286296 Add some tests
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-03-02 20:42:36 +00:00
Gabriel Adrian Samfira
4733cac526 Replace errors.Wrap calls
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-03-02 19:07:06 +00:00
Gabriel Adrian Samfira
4668461603 Expose the credential type through the API
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-03-02 17:04:27 +00:00
Gabriel Adrian Samfira
cbb2134f0e Add GitHub App support
This change adds the ability to use GitHub Apps to authenticate against the
GitHub API. This gives us a larger quota for API requests (15k vs 5k for PATs).

Also, each GitHub App has its own quota, whereas PATs share the same user quota.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-03-01 19:47:50 +00:00
Gabriel
2ea6bb9490
Merge pull request #225 from gabriel-samfira/fix-variables
Fix variable name
2024-02-26 21:06:14 +02:00
Gabriel Adrian Samfira
b5e3552776 Fix variable name
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-02-26 19:04:48 +00:00
Gabriel
d3f6c40258
Merge pull request #224 from gabriel-samfira/simplify-job
simplify integration test job
2024-02-26 19:58:40 +02:00
Gabriel Adrian Samfira
111b93f062 simplify integration test job
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-02-26 17:58:04 +00:00
Gabriel
c233559d3b
Merge pull request #223 from gabriel-samfira/use-user-service
Use user service
2024-02-26 19:41:51 +02:00
Gabriel Adrian Samfira
43b3db5c0c Use user service
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-02-26 17:41:04 +00:00
Gabriel
72c5364537
Merge pull request #222 from gabriel-samfira/add-scripts-and-service
Add script and service template
2024-02-26 18:48:47 +02:00
Gabriel Adrian Samfira
a17cd577e0 Add script and service template
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-02-26 16:48:22 +00:00
Gabriel
5c49bc79ae
Merge pull request #221 from gabriel-samfira/switch-to-apg
Switch to apg for password gen
2024-02-26 18:45:16 +02:00
Gabriel Adrian Samfira
00fd7c1204 Switch to apg for password gen
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-02-26 16:44:47 +00:00
Gabriel
9d21bd6b51
Merge pull request #220 from gabriel-samfira/fix-integration-tests
Install dependencies and set RUN_USER
2024-02-26 18:39:18 +02:00
Gabriel Adrian Samfira
b9b185d1c1 Install dependencies and set RUN_USER
Install make dependencies and default to current user

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-02-26 16:38:27 +00:00
Gabriel
8728051c40
Merge pull request #219 from gabriel-samfira/augment-tests
Allow integration tests to run locally
2024-02-26 18:32:00 +02:00
Gabriel Adrian Samfira
b4dde6a839 Allow integration tests to run locally
This change adds the ability to run integration tests locally. You will
still need a number of environment variables set, including a github PAT.

Details on how to use this will come in a subsequent commit.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-02-26 16:28:07 +00:00
Gabriel
cffb4f23d4
Merge pull request #218 from mercedes-benz/introduce_golangci_config
Introduce golangci config and `make help`
2024-02-22 19:39:49 +02:00
Mario Constanti
d332e7a8ca fix: gocritic linter finding
Signed-off-by: Mario Constanti <mario.constanti@mercedes-benz.com>
2024-02-22 17:40:15 +01:00