Commit graph

887 commits

Author SHA1 Message Date
Gabriel
cf231c9d8d
Merge pull request #297 from gabriel-samfira/add-omitempty
Add omitempty to all struct fields
2024-09-28 21:25:07 +03:00
Gabriel Adrian Samfira
2dfde30aad Add omitempty to all struct fields
The JSON that gets returned by the API is filled with empty values
which serve no purpose. Adding omitempty will skip empty values.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-09-28 18:19:14 +00:00
Gabriel
bdb26c1827
Merge pull request #296 from gabriel-samfira/make-tag-search-case-insensitive
Do a case insensitive search for tags
2024-09-28 21:03:29 +03:00
Gabriel Adrian Samfira
e5fd702544 Fix tests
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-09-27 08:05:43 +00:00
Gabriel Adrian Samfira
c319341ec5 Do a case insensitive search for tags
This change switches to a case insensitive search for pool tags.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-09-27 07:54:29 +00:00
Gabriel
3a2061afb9
Merge pull request #278 from fabi200123/version-v3
Add provider interface versioning
2024-09-04 15:15:46 +03:00
Fabian Fulga
dcff6f9854 Add getProviderBaseParams function in basePoolManager 2024-09-02 15:25:44 +03:00
Fabian Fulga
7074f01541 Move ValidateResult to common package 2024-09-02 10:39:45 +03:00
Fabian Fulga
08244161a1 Update garm-provider-common package 2024-08-22 11:40:37 +03:00
Fabian Fulga
03f280da59 Version provider interface 2024-08-21 16:14:38 +03:00
Gabriel
deb30e1d25
Merge pull request #288 from gabriel-samfira/use-lxd-image-mirror
Allow using LXD image mirror
2024-08-14 23:57:41 +03:00
Gabriel Adrian Samfira
9a6f0e7926 Pin go version
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-08-14 20:52:10 +00:00
Gabriel Adrian Samfira
f5992b7344 Allow using LXD image mirror
This change allows GARM tests to use a mirror for LXD images, allowing
for faster image downloads.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-08-14 19:44:23 +00:00
Gabriel
3b1e3c77e1
Merge pull request #287 from gabriel-samfira/switch-to-self-hosted
Switch to self hosted runner
2024-08-14 20:14:52 +03:00
Gabriel Adrian Samfira
d5cbc5bfb2 Switch to self hosted runner
GitHub hosted runners seem to have issues with LXD containers.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-08-12 21:15:47 +00:00
Gabriel
fc32978c63
Merge pull request #286 from gabriel-samfira/replace-ngrok
Replace ngrok
2024-08-12 22:29:37 +03:00
Gabriel Adrian Samfira
e1e46211a1 Replace ngrok
This change switches the integration tests to an alternate tunneling
service.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-08-12 19:22:52 +00:00
Gabriel
237afdb25d
Merge pull request #284 from gabriel-samfira/prepare-v0.1.5
Prepare v0.1.5
2024-08-08 15:32:37 +03:00
Gabriel Adrian Samfira
926797dda5 Pin provider versions and switch to busybox
Thic change pins all providers to a released version. We also switched
the GARM image to busybox. This adds an extra ~45MB, but we get an image
we can exec into.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-08-08 12:22:16 +00:00
Gabriel
82d70d2310
Merge pull request #4 from fabi200123/small-nits
Update docs
2024-08-08 15:05:17 +03:00
Fabian Fulga
b9aafbe65e Update docs 2024-08-08 15:01:24 +03:00
Gabriel Adrian Samfira
a12ad2fa89 Fix example spaces vs tabs
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-08-08 09:29:15 +00:00
Gabriel Adrian Samfira
932ee4693e Remove extra doc
The database.md doc has been added to config.md.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-08-08 09:16:09 +00:00
Gabriel Adrian Samfira
1a54bcfc35 Restructure docs
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-08-08 09:13:55 +00:00
Gabriel Adrian Samfira
6640599584 Add more info on events
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-08-06 15:18:18 +00:00
Gabriel Adrian Samfira
9b0633c557 Update quickstart and using_garm, add events.md
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-08-06 15:18:18 +00:00
Gabriel Adrian Samfira
35f4bea269 Update docs
Reword some phrases, update links and steps.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-08-06 15:18:18 +00:00
Gabriel
56b0e6065a
Merge pull request #283 from gabriel-samfira/add-json-tags
Add JSON tags to the ChangePayload struct
2024-08-06 16:53:12 +03:00
Gabriel Adrian Samfira
a7f1a51a7d Add JSON tags to the ChangePayload struct
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-08-06 13:43:58 +00:00
Gabriel
516908f26c
Merge pull request #282 from gabriel-samfira/update-common
Update garm-provider-common
2024-08-03 19:16:53 +03:00
Gabriel Adrian Samfira
bc4285dc80 Update garm-provider-common
Use the websocket reader from within garm-provider-common.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-08-03 16:07:21 +00:00
Gabriel
a5b15789a1
Merge pull request #281 from gabriel-samfira/cleanup-websocket-urls
Rename websocket URLs
2024-08-03 01:29:05 +03:00
Gabriel Adrian Samfira
79c1e47427 Rename websocket URLs
Given that we now have multiple websocket URLs (logs and events), this
change categorizes them under the same prefix.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-08-02 22:19:51 +00:00
Gabriel
7fe2a3ad34
Merge pull request #280 from gabriel-samfira/generalize-ws-reader
Generalize the websocket reader
2024-08-03 00:27:43 +03:00
Gabriel Adrian Samfira
5c45f54ef4 Generalize the websocket reader
This change adds a new message handler that users of the reader can use
to handle websocket messages. Packages should never print to console by
themselves.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-08-02 21:18:31 +00:00
Gabriel
6835419daf
Merge pull request #279 from gabriel-samfira/scope-entities-to-endpoint
Fix: Scope entities to endpoint
2024-08-01 13:19:42 +03:00
Gabriel Adrian Samfira
cc6e985629 Fix: Scope entities to endpoint
This change scopes all github entities to a github endpoint, allowing
users to have the same repo/org/enterprise created for each endpoint.

This way, if your username is the same on github.com and on your GHES
server, and you have the same repository name or org in both places,
GARM can now handle that situation.

This change also fixes a leaky watcher in the pool manager.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-07-29 17:35:57 +00:00
Gabriel
f64ffa8d92
Merge pull request #277 from gabriel-samfira/slight-docs-reword
Reword the section about labels
2024-07-07 00:05:27 +03:00
Gabriel Adrian Samfira
411dcea4fb Reword the section about labels
This change removes a stray line in the quickstart and rewords
the section about labels a bit.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-07-06 21:02:54 +00:00
Gabriel
59de9cdf93
Merge pull request #275 from gabriel-samfira/add-event-stream
Add event stream
2024-07-05 23:06:09 +03:00
Gabriel Adrian Samfira
2554f70b89 Replace time.After with time.NewTimer
Improper use of time.After can lead to memory leaks if the timer never
gets a chance to fire.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-07-05 12:55:35 +00:00
Gabriel Adrian Samfira
49f1b7aa14 Set read limit to 16 KB
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-07-05 12:55:35 +00:00
Gabriel Adrian Samfira
a2c606b87d Simplify logic
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-07-05 12:55:35 +00:00
Gabriel Adrian Samfira
5b24b9e56b Fix shadowing bug in job create function
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-07-05 12:55:35 +00:00
Gabriel Adrian Samfira
5c5b2256bb Create common utility function for ws
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-07-05 12:55:35 +00:00
Gabriel Adrian Samfira
246f826b76 Validate filter payload
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-07-05 12:55:35 +00:00
Gabriel Adrian Samfira
9f8659abd6 Add events websocket endpoint
This change adds a new websocket endpoint for database events. The events
endpoint allows clients to stream events as they happen in GARM. Events
are defined as a structure containning the event type (create, update, delete),
the database entity involved (instances, pools, repos, etc) and the payload
consisting of the object involved in the event. The payload translates
to the types normally returned by the API and can be deserialized as one
of the types present in the params package.

The events endpoint is a websocket endpoint and it accepts filters as
a simple json send over the websocket connection. The filters allows the
user to specify which entities are of interest, and which operations should
be returned. For example, you may be interested in changes made to pools
or runners, in which case you could create a filter that only returns
update operations for pools. Or update and delete operations.

The filters can be defined as:

{
  "filters": [
    {
      "entity_type": "instance",
      "operations": ["update", "delete"]
    },
    {
      "entity_type": "pool"
    },
  ],
  "send_everything": false
}

This would return only update and delete events for instances and all events
for pools. Alternatively you can ask GARM to send you everything:

{
  "send_everything": true
}

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-07-05 12:55:35 +00:00
Gabriel Adrian Samfira
dd1740c189 Refactor the websocket client and add fixes
The websocket client and hub interaction has been simplified a bit.
The hub now acts only as a tee writer to the various clients that
register. Clients must register and unregister explicitly. The hub
is no longer passed in to the client.

Websocket clients now watch for password changes or jwt token expiration
times. Clients are disconnected if auth token expires or if the password
is changed.

Various aditional safety checks have been added.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-07-05 12:55:35 +00:00
Gabriel
ca7f20b62d
Merge pull request #276 from gabriel-samfira/add-version-to-api-response
Add version to controller info response
2024-07-05 15:54:45 +03:00
Gabriel Adrian Samfira
42ae3c52d1 Add version to controller info response
This change adds the GARM server version to the controller info response.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2024-07-05 12:49:16 +00:00