Commit graph

354 commits

Author SHA1 Message Date
Ionut Balutoiu
721cbefd6a Rotate log file on SIGHUP
Add functionality to rotate the log file when `SIGHUP` signal is received.

Also, a doc is added with few details about logging.

Signed-off-by: Ionut Balutoiu <ibalutoiu@cloudbasesolutions.com>
2023-06-27 20:04:20 +03:00
Gabriel
442e76e278
Merge pull request #112 from gabriel-samfira/use-select-with-wait
Refactor pool manager loop
2023-06-23 18:49:48 +03:00
Gabriel Adrian Samfira
1edb9247a8 Add per instance mux
Lock operations per instance name. This should avoid go routines trying
to update the same instance when operations may be slow.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2023-06-23 15:43:31 +00:00
Gabriel Adrian Samfira
a9cf5127a9 More granular loops, update go-github
This commit adds:

  * more granular loops for various operations
  * update go-github to latest version
  * skip trying to fetch runner info for canceled or skipped jobs
  * loops use waitgroups to signal exit

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2023-06-23 08:16:41 +00:00
Gabriel Adrian Samfira
f84da48f5b Accomodate older versions of curl
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2023-06-22 22:46:09 +00:00
Gabriel Adrian Samfira
4921692ee2 Wrap errgroup in select
This commit:

  * swaps WaitGroups with errgroups
  * wraps errgroup.Wait() in a select to prevent situations in which an
    operation takes a long time and prevents garm from being restarted.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2023-06-23 01:07:55 +03:00
Gabriel
f5226aec17
Merge pull request #111 from mihaelabalutoiu/fix-pools-typo
Fix `runner/pools.go` typo
2023-06-21 12:35:42 +03:00
Mihaela Balutoiu
d698e2815e Fix runner/pools.go typo
Signed-off-by: Mihaela Balutoiu <mbalutoiu@cloudbasesolutions.com>
2023-06-21 10:56:51 +03:00
Gabriel
1ebbbd6915
Merge pull request #110 from mihaelabalutoiu/add-more-pools-unit-tests
Add more `runner/pools.go` unit tests
2023-06-20 23:25:58 +03:00
Mihaela Balutoiu
00c0ada0aa Add more runner/pools.go unit tests
Signed-off-by: Mihaela Balutoiu <mbalutoiu@cloudbasesolutions.com>
2023-06-19 23:39:07 +03:00
Gabriel Adrian Samfira
8f31db1f67
Reword title
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2023-06-16 17:36:27 +03:00
Gabriel Adrian Samfira
3a5c939612
Add slack link
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2023-06-16 12:00:32 +03:00
Gabriel
e44786f1d2
Merge pull request #109 from mihaelabalutoiu/fix-pools-typo
Fix `runner/pools.go` typo
2023-06-15 15:57:48 +03:00
Mihaela Balutoiu
7ac2455379 Fix runner/pools.go typo
Signed-off-by: Mihaela Balutoiu <mbalutoiu@cloudbasesolutions.com>
2023-06-15 14:12:07 +03:00
Gabriel
05168ac994
Merge pull request #106 from gabriel-samfira/reap-failed-agent
Reap failed agent
2023-06-14 22:19:20 +03:00
Gabriel
22b410c9b7
Merge pull request #108 from mihaelabalutoiu/add-db-users-unit-tests
Add more test cases for the `/database/sql/users.go`
2023-06-14 20:05:00 +03:00
Mihaela Balutoiu
d340200333 Add more test cases for the /database/sql/users.go
Add more coverage for the `users.go` using the SQL database interactions.

Signed-off-by: Mihaela Balutoiu <mbalutoiu@cloudbasesolutions.com>
2023-06-14 19:24:42 +03:00
Gabriel
a4933b2836
Merge pull request #107 from mihaelabalutoiu/add-pools-unit-tests
Add test cases for the `runner/pools.go`
2023-06-14 15:45:42 +03:00
Mihaela Balutoiu
e1ad300f79 Add test cases for the runner/pools.go
Signed-off-by: Mihaela Balutoiu <mbalutoiu@cloudbasesolutions.com>
2023-06-14 14:17:47 +03:00
Gabriel Adrian Samfira
a33b15c6c9
Remove install target
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2023-06-13 23:50:33 +03:00
Gabriel Adrian Samfira
9e18d5d7a9
Add build target to Makefile
Add a build target to the Makefile that allows building a non static
version if both garm and garm-cli. This is useful when you just need to
build the binaries locally and make sure the version is properly set.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2023-06-13 23:47:36 +03:00
Gabriel Adrian Samfira
9ed9e9eec5
Add retries for curl calls
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2023-06-13 22:37:20 +03:00
Gabriel Adrian Samfira
08bf2bf5a1
Make spacing consistent & add some status updates
Convert the templates.go file to contain tabs instead of spaces
consistently.

Add some status messages when installing.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2023-06-13 21:27:49 +03:00
Gabriel Adrian Samfira
0e637c10e3
Remove failed runner and some retries
* When a runner fails to set up the github agent, we reap it after the
pool timeout is reached.
  * add a retry in the userdata when configuring the runner agent

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2023-06-13 21:01:40 +03:00
Gabriel
939905a725
Merge pull request #105 from mihaelabalutoiu/add-db-users-unit-tests
Add more `users.go` unit tests
2023-06-13 17:41:44 +03:00
Mihaela Balutoiu
44c7ac1b7b Add more users.go unit tests
Signed-off-by: Mihaela Balutoiu <mbalutoiu@cloudbasesolutions.com>
2023-06-13 16:52:32 +03:00
Gabriel Adrian Samfira
636164fb18
Exclude a temp cmd used for testing
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2023-06-13 13:24:00 +03:00
Gabriel
a42ad39264
Merge pull request #103 from HippocampusGirl/lxd-extra-packages
Allow installing additional packages in lxd container
2023-06-11 18:57:24 +03:00
Lea Waller
e3065d6951
Allow installing additional packages in lxd 2023-06-11 17:32:30 +02:00
Gabriel
d56858a599
Merge pull request #102 from gabriel-samfira/validate-provider-responses
Validate provider responses
2023-06-11 15:13:03 +03:00
Gabriel Adrian Samfira
06745eb88a
Validate the result returned by providers
Providers may return only 3 possible statuses:

  * InstanceRunning
  * InstanceError
  * InstanceStopped

Every other status is reserved for the controller to set. Provider
responses will be split from the instance response in a future commit.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2023-06-11 15:02:36 +03:00
Gabriel Adrian Samfira
e6a4137e3b
properly set version
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2023-06-08 18:07:35 +03:00
Gabriel
dd1569a8da
Merge pull request #101 from gabriel-samfira/do-not-merge-second-column
Don't merge the second column in the CLI
2023-06-08 14:16:14 +03:00
Gabriel Adrian Samfira
66dc18c3ff
Don't merge the second column in the CLI
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2023-06-08 13:57:08 +03:00
Gabriel
b46d7eb6fe
Merge pull request #97 from gabriel-samfira/lxd-add-timeouts
Parallelization and LXD timeouts
2023-06-08 13:42:47 +03:00
Gabriel
e3bcee89a4
Merge pull request #98 from mihaelabalutoiu/add_db_users_unit_tests
Add `users.go` unit tests
2023-06-07 12:55:44 +03:00
Mihaela Balutoiu
a25991ee2f Add users.go unit tests
Signed-off-by: Mihaela Balutoiu <mbalutoiu@cloudbasesolutions.com>
2023-06-07 12:46:47 +03:00
Gabriel
65c86c96f0
Merge pull request #99 from ionutbalutoiu/fix-makefile-typo
Fix Makefile typo
2023-06-07 10:10:11 +03:00
Ionut Balutoiu
38d3b6100b Fix Makefile typo
Signed-off-by: Ionut Balutoiu <ibalutoiu@cloudbasesolutions.com>
2023-06-07 10:01:03 +03:00
Gabriel Adrian Samfira
d8ed55288f Small comment change
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2023-06-06 14:55:08 +00:00
Gabriel Adrian Samfira
829933559d Allow installing runners to finish
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2023-06-06 14:49:28 +00:00
Gabriel Adrian Samfira
bd2f103743
Wait for addPendingInstances to finish
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2023-06-06 16:40:27 +03:00
Gabriel Adrian Samfira
e9f66c2035
Wait for deletePendingInstances() to finish
Use an errgroup to wait for all instance deletion operations before
returning. Log any failure.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2023-06-06 16:36:08 +03:00
Gabriel Adrian Samfira
05a79d298c
Move some code around
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2023-06-06 16:31:30 +03:00
Gabriel Adrian Samfira
9efefc0d6a
Parallelization and LXD timeouts
* cleanupOrphanedGithubRunners() now uses errgroup to parallelize and
    report errors when removing runners from the provider.
  * retryFailedInstancesForOnePool() now uses errgroup
  * Removed some setPoolRunningState which should be treated in the loop
    where those errors eventually bubble up and can be handled.
  * Added a number of timeouts in the LXD provider for delete and list
    instances. This provider should be converted into an external
    provider.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2023-06-06 16:07:07 +03:00
Gabriel
aee4eb24b2
Merge pull request #95 from gabriel-samfira/lxd-disable-updates
Allow disabling updates
2023-06-05 01:35:26 +03:00
Gabriel Adrian Samfira
88a39220f5 Allow disabling updates
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2023-06-04 22:28:50 +00:00
Gabriel
524ed99950
Merge pull request #94 from gabriel-samfira/lxd-set-image-expiration
Let CreateInstance download and cache image
2023-06-05 01:03:49 +03:00
Gabriel Adrian Samfira
06d2e6f6cd Send a fail status if chcon fails
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2023-06-04 21:50:49 +00:00
Gabriel Adrian Samfira
19118008b1 Properly set security context
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2023-06-04 21:47:34 +00:00