Commit graph

669 commits

Author SHA1 Message Date
Mario Constanti
0ab86a7e51 fix: unused-parameter linter findings
Signed-off-by: Mario Constanti <mario.constanti@mercedes-benz.com>
2024-02-22 15:06:53 +01:00
Mario Constanti
3b9f8b555b fix: var-naming linter findings
Signed-off-by: Mario Constanti <mario.constanti@mercedes-benz.com>
2024-02-22 15:06:53 +01:00
Mario Constanti
bd0b27ab10 fix: gci section warnings
Signed-off-by: Mario Constanti <mario.constanti@mercedes-benz.com>
2024-02-22 15:06:53 +01:00
Mario Constanti
8fc001f5f6 fix: misspell linter warnings
Signed-off-by: Mario Constanti <mario.constanti@mercedes-benz.com>
2024-02-22 15:06:53 +01:00
Mario Constanti
b3854eaf18 fix: whitespace linter warnings
Signed-off-by: Mario Constanti <mario.constanti@mercedes-benz.com>
2024-02-22 15:06:53 +01:00
Mario Constanti
023652d76d fix: make build as PHONY target
without build as PHONY target, nothing will happen once the build
directory got created.

Signed-off-by: Mario Constanti <mario.constanti@mercedes-benz.com>
2024-02-22 15:06:53 +01:00
Mario Constanti
9ea2a312d2 feat: introduce golangci config and help in make
Signed-off-by: Mario Constanti <mario.constanti@mercedes-benz.com>
2024-02-22 15:06:53 +01:00
Gabriel
dd6f1e48b8
Merge pull request #217 from mercedes-benz/add_counter_metrics
extend metrics for github and provider executions
2024-02-22 09:35:41 +02:00
Mario Constanti
d68cc3bf05 fix: add missing metrics for few gh api callS
Signed-off-by: Mario Constanti <mario.constanti@mercedes-benz.com>
2024-02-22 05:57:42 +01:00
Mario Constanti
6cb6350602 doc: document new operations/errors metrics
Signed-off-by: Mario Constanti <mario.constanti@mercedes-benz.com>
2024-02-21 14:41:08 +01:00
Mario Constanti
9716b1d8c9 fix: align metric names
Signed-off-by: Mario Constanti <mario.constanti@mercedes-benz.com>
2024-02-21 14:29:43 +01:00
Mario Constanti
b36b5137b6 feat: count github api calls
introduce metrics counter for github api calls

Signed-off-by: Mario Constanti <mario.constanti@mercedes-benz.com>
2024-02-21 14:22:45 +01:00
Mario Constanti
0faf0927bc feat: count external provider operations
Signed-off-by: Mario Constanti <mario.constanti@mercedes-benz.com>
2024-02-21 14:21:41 +01:00
Gabriel
e108140eb6
Merge pull request #216 from mercedes-benz/extended_metrics
chore: refactor metrics endpoint
2024-02-20 17:46:22 +02:00
Mario Constanti
b1cbfac08a fix: switch to context.Background() for adminctx
Signed-off-by: Mario Constanti <mario.constanti@mercedes-benz.com>
2024-02-20 16:42:10 +01:00
Mario Constanti
2a3e4d6563 fix: pass context.TODO by getting admin context
fix linter warnings

Signed-off-by: Mario Constanti <mario.constanti@mercedes-benz.com>
2024-02-20 16:39:52 +01:00
Mario Constanti
0a53b8f6d8 fix: stop metrics collector ticker on ctx.Done
Signed-off-by: Mario Constanti <mario.constanti@mercedes-benz.com>
2024-02-20 14:57:32 +01:00
Mario Constanti
17d74dfbf0 chore: rework prometheus metrics registration
fail if metric registration panics

Signed-off-by: Mario Constanti <mario.constanti@mercedes-benz.com>
2024-02-20 14:27:27 +01:00
Mario Constanti
3e025dda2f feat: define a default duration for metrics update
Signed-off-by: Mario Constanti <mario.constanti@mercedes-benz.com>
2024-02-20 10:23:48 +01:00
Mario Constanti
97f172eb51 fix: improve metrics collection loop
by adding the context from main and make auth.GetAdminContext accepting a
context we are now able to stop the metrics collection loop once the
context is canceled

Signed-off-by: Mario Constanti <mario.constanti@mercedes-benz.com>
2024-02-20 06:33:21 +01:00
Mario Constanti
1d8d9459eb chore: refactor metrics endpoint
refactoring is needed to make the metrics package usable from within the
runner package for further metrics.

This change also makes the metric-collector independent from requests to
the /metrics endpoint

Signed-off-by: Mario Constanti <mario.constanti@mercedes-benz.com>
2024-02-19 16:22:32 +01:00
Gabriel
f68cf98d67
Merge pull request #215 from jepio/fix-static-docker
Dockerfile: Build actually static binaries
2024-02-16 10:39:59 +02:00
Jeremi Piotrowski
b4644ca3c8 Dockerfile: Build actually static binaries
Without '-linkmode external' some of the produced binaries were not actually
static. /bin/garm was fine but providers would fail with "exit code 127" when
executed. Unpacking the container image and running the binaries in strace
showed that they were accessing the musl dynamic linker.

Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
2024-02-16 09:31:04 +01:00
Gabriel
e575053f7c
Merge pull request #210 from gabriel-samfira/add-new-providers
Add new providers
2024-02-12 21:16:52 +02:00
Gabriel Adrian Samfira
342ed8e990 Add new providers
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-02-12 19:16:12 +00:00
Gabriel
96208bb3c2
Merge pull request #209 from gabriel-samfira/fix-typos
Fix typos in garm-cli
2024-02-12 12:06:52 +02:00
Gabriel Adrian Samfira
eb729320f9 Fix typos in garm-cli
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-02-12 10:05:23 +00:00
Gabriel
6ca50dc4b2
Merge pull request #208 from gabriel-samfira/update-readme
Add GCP to the list of providers
2024-02-12 11:55:50 +02:00
Gabriel Adrian Samfira
803f7afd70 Add GCP to the list of providers
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-02-12 09:55:22 +00:00
Gabriel
3b9e822ee0
Merge pull request #207 from gabriel-samfira/update-readme
Update readme
2024-02-12 11:04:33 +02:00
Gabriel Adrian Samfira
8efdcba359 Update README
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-02-12 09:01:13 +00:00
Gabriel Adrian Samfira
d4a9a821cf Add some more info
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-02-12 08:44:26 +00:00
Gabriel Adrian Samfira
1ffa562581 Add using garm doc
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-02-12 01:06:25 +00:00
Gabriel Adrian Samfira
d17629efd4 Add logging section info
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-02-11 12:47:19 +00:00
Gabriel Adrian Samfira
53264528ee Add Equinix and EC2 in the README
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-02-11 12:28:49 +00:00
Gabriel
7c44b8125a
Merge pull request #206 from gabriel-samfira/more-strict-token-checks
More strict instance token checks
2024-01-30 13:57:14 +02:00
Gabriel Adrian Samfira
9031a4029e More strict instance token checks
This change invalidates tokens based on more parameters. Tokens that were
generated for previous attempts of spinning up an instance will be invalidates.

Also, only instances that are in Running or Creating will be able to authenticate.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-01-30 11:07:55 +00:00
Gabriel
23c9ed6b6d
Merge pull request #205 from gabriel-samfira/add-some-logging
Add some logging
2024-01-30 11:41:53 +02:00
Gabriel Adrian Samfira
43b96c543d Add some logging
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-01-30 09:37:26 +00:00
Gabriel
8e0456c83a
Merge pull request #203 from gabriel-samfira/small-fixes
Small adjustments
2024-01-12 22:07:28 +02:00
Gabriel Adrian Samfira
5b735eaaf4 Small adjustments
This change increases the tools refresh interval to 5 minutes, cleans
up the websocket code a bit, augments the error message that may be returned
when trying to delete a runner in an invalid state and removes a log message
that does not add much value.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-01-12 19:53:27 +00:00
Gabriel
523237ca18
Merge pull request #202 from gabriel-samfira/cleanup-websocket-code
Fix log streamer and cleanup code
2024-01-06 16:22:09 +02:00
Gabriel Adrian Samfira
4d7fcbe23a Safely close the quit channel
Prevent accidental closure of an already closed channel.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-01-06 14:15:52 +00:00
Gabriel Adrian Samfira
70bfff96e0 Fix log streamer and cleanup code
I accidentally disabled the log streamer when I moved the config options
to their own section. This change fixes that.

This change also adds some safety checks and locking when cleaning up stale
clients. The websocket hub Write() function now copies the message before
sending it on the channel to the clients.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-01-06 14:05:38 +00:00
Gabriel
0aaeebde28
Merge pull request #201 from gabriel-samfira/switch-to-slog
Switch to slog
2024-01-06 03:04:09 +02:00
Gabriel Adrian Samfira
d44d64dbfd Use log_file from logging config
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-01-06 00:32:39 +00:00
Gabriel Adrian Samfira
61e97f0896 Append pool_type and pool_mgr info to logs
Pool managers will have 2 fields identifying which manager generated
the log line.

In the future, we will add tracking ids in various cases, allowing
us to track down issues faster.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-01-06 00:21:50 +00:00
Gabriel Adrian Samfira
e441b6ce89 Switch to log/slog
This change switches GARM to the new structured logging standard
library. This will allow us to set log levels and reduce some of
the log spam.

Given that we introduced new knobs to tweak logging, the number of
config options for logging now warrants it's own section.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-01-05 23:46:40 +00:00
Gabriel
f72e97209f
Merge pull request #200 from gabriel-samfira/add-systeminfo-callback
Add system-info instance callback
2024-01-04 17:38:02 +02:00
Gabriel Adrian Samfira
2a5e2409b2 Add system-info instance callback
Allow runners to update their own system information. Runners can now send
back os_name, os_version and agent_id back as part of a POST to
CALLBACK_URL/system-info/.

The goal is to get better info in regard to the actual OS that's running
and to move the agent_id from the status updates to the system-info callback.

The status updates should be used only to send back info about the status of
the installation process.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-01-04 15:23:43 +00:00