Commit Graph

4636 Commits

Author SHA1 Message Date
flowzone-app[bot]
cfad7f86a0
Merge pull request #2256 from balena-os/kyle/renovate-extends-balena-io
Inherit Renovate settings from balena-io
2024-04-08 14:35:46 +00:00
Kyle Harding
58e05d0f63 Inherit Renovate settings from balena-io
Change-type: patch
Signed-off-by: Kyle Harding <kyle@balena.io>
2024-04-07 19:23:52 -04:00
flowzone-app[bot]
2cef1b9bca
v16.2.1 2024-04-06 08:22:27 +00:00
flowzone-app[bot]
4319d0aa56
Merge pull request #2263 from balena-os/bugfix-1-for-update-lock-state-apply
Update lock state apply: patch DockerName & respect lockOverride
2024-04-06 08:21:00 +00:00
Christina Ying Wang
8ac2ce4677 Respect lockOverride when taking locks
Signed-off-by: Christina Ying Wang <christina@balena.io>
2024-04-06 00:59:04 -07:00
Christina Ying Wang
b7922e6875 Fix some RegEx io-ts types
io-ts types that were generated using `shortStringWithRegex` were testing
against `VAR_NAME_REGEX`, instead of the Regex that was specified when
generating the type. This affected `DockerName` such that service names with
a dash in the middle were returning as false when passed through the
`DockerName.is` type guard, affecting how `getServicesLockedByAppId` was
returning a map of locked services.

Change-type: patch
Signed-off-by: Christina Ying Wang <christina@balena.io>
2024-04-06 00:20:34 -07:00
flowzone-app[bot]
aa00727f45
v16.2.0 2024-04-05 02:35:17 +00:00
flowzone-app[bot]
1e025ec410
Merge pull request #2234 from balena-os/update-lock-during-state-apply
Update lock during state apply
2024-04-05 02:34:23 +00:00
Christina Ying Wang
7220e994dc Log takeLock and releaseLock steps as system events
Signed-off-by: Christina Ying Wang <christina@balena.io>
2024-04-04 14:07:47 -07:00
Christina Ying Wang
fd7d58f89a Clean up lockfiles on takeLock step failure
We don't want any Supervisor lockfiles to remain on the device
when a takeLock step fails because this would interfere with the user app.

Signed-off-by: Christina Ying Wang <christina@balena.io>
2024-04-04 14:07:47 -07:00
Christina Ying Wang
fb1bd33ab6 Refine update locking interface
* Remove Supervisor lockfile cleanup SIGTERM listener
* Modify lockfile.getLocksTaken to read files from the filesystem
* Remove in-memory tracking of locks taken in favor of filesystem
* Require both `(resin-)updates.lock` to be locked with `nobody` UID
  for service to count as locked by the Supervisor

Signed-off-by: Christina Ying Wang <christina@balena.io>
2024-04-04 14:07:47 -07:00
Christina Ying Wang
10f294cf8e Add takeLock to state funnel
A takeLock step should be generated before any of the following steps:
* kill
* start
* stop
* updateMetadata
* restart
* handover

ALL services in an app will be locked for any of the above actions,
unless the action is generated through Supervisor API's
`POST /v2/applications/:appId/(start|stop|restart)-service` endpoints,
in which case only the target service will be locked.

A lock will be taken for a service before it starts by creating the
directory in /tmp before the Engine creates it through bind mounts.

Also, the commit simplifies the generation of service kill
steps from network/volume changes or removals.

Signed-off-by: Christina Ying Wang <christina@balena.io>
2024-04-04 14:07:47 -07:00
Christina Ying Wang
cf8d8cedd7 Simplify lock interface to prep for adding takeLock to state funnel
This commit changes a few things:

* Pass `force` to `takeLock` step directly. This allows us to remove
the `lockFn` used by app manager's action executors, setting takeLock
as the main interface to interact with the update lock module. Note
that this commit by itself will not pass tests, as no update locking
occurs where it once did. This will be amended in the next commit.

* Remove locking functions from doRestart & doPurge, as this is
the only area where skipLock is required.

* Remove `skipLock` interface, as it's redundant with the functionality
of `force`. The only time `skipLock` is true is in doRestart/doPurge,
as those API methods are already run within a lock function. We removed
the lock function which removes the need for skipLock, and in the next
commit we'll add locking as a composition step to replace the
functionality removed here.

* Remove some methods not in use, such as app manager's `stopAll`.

Signed-off-by: Christina Ying Wang <christina@balena.io>
2024-04-04 14:07:47 -07:00
Christina Ying Wang
2f728ee43e Change lock directory in tests to tmpfs
This prevents leftover lockfiles from interfering with tests
in between test runs.

Signed-off-by: Christina Ying Wang <christina@balena.io>
2024-04-04 14:07:47 -07:00
Christina Ying Wang
af6359f7ae Take lock before updating service metadata
Change-type: minor
Signed-off-by: Christina Ying Wang <christina@balena.io>
2024-04-04 14:07:47 -07:00
Christina Ying Wang
e6df78a22b Implement takeLock composition step + tests
This commit only implements the action that a takeLock step
results in. It does not add takeLock step generation logic
to the state funnel yet.

Signed-off-by: Christina Ying Wang <christina@balena.io>
2024-04-04 14:07:47 -07:00
Christina Ying Wang
f2843e1382 Add update lock release functionality to state funnel
releaseLock is a step that will be inferred if there are services
in target state, and if some of those services have locks taken by
the Supervisor.

The releaseLock composition step calls the method of the same name
in the updateLock module, which takes the exclusive process lock before
disposing all Supervisor lockfiles in the target appId.

This is half of the update lock incorporation into the state funnel, as
we also need to introduce a takeLock step which triggers during crucial
stages of device state transition.

Signed-off-by: Christina Ying Wang <christina@balena.io>
2024-04-04 14:07:47 -07:00
Christina Ying Wang
7cfc42e197 Separate rwlock functionality from update-lock for clarity
Signed-off-by: Christina Ying Wang <christina@balena.io>
2024-04-04 14:07:47 -07:00
Christina Ying Wang
d18a740a40 Add methods for easier checking of lockfile existence
Signed-off-by: Christina Ying Wang <christina@balena.io>
2024-04-04 14:07:47 -07:00
Christina Ying Wang
b9a6a6b685 Improve types & remove some lodash from state engine
Signed-off-by: Christina Ying Wang <christina@balena.io>
2024-04-04 14:07:47 -07:00
flowzone-app[bot]
4596149d0e
v16.1.10 2024-03-28 16:51:52 +00:00
Florin Sarbu
6ce8da3f45
Merge pull request #2258 from DynamicDevices/shreya/revpi-connect-4-support
Add revpi-connect-4 to RPi variants
2024-03-28 18:50:57 +02:00
Shreya Patel
b5dbef82d7 Add revpi-connect-4 to RPi variants
We need the supervisor to be able to manage config.txt changes for the
RevPi Connect 4.

Change-type: patch
Signed-off-by: Shreya Patel <shreya@dynamicdevices.co.uk>
2024-03-27 11:55:15 +00:00
flowzone-app[bot]
14e91779f4
v16.1.9 2024-03-25 18:36:46 +00:00
Page-
b5e098b249
Merge pull request #2254 from balena-os/report-failure-log-error
Log the full error on device state report failure as it is more useful
2024-03-25 18:36:02 +00:00
Pagan Gazzard
20e57f7f16 Log the full error on device state report failure as it is more useful
The message can be an empty string or similarly unhelpful, therefore
logging the entire error means that we will have whatever the message
may be along with the stack trace and other info that will be helpful
even when the message is not

Change-type: patch
2024-03-25 15:17:09 -03:00
flowzone-app[bot]
073373192c
v16.1.8 2024-03-25 18:11:11 +00:00
flowzone-app[bot]
9b89b9ead5
Merge pull request #2255 from balena-os/es-version-es2022
Set @balena/es-version to es2022 to match tsconfig.json
2024-03-25 18:10:17 +00:00
Pagan Gazzard
6b0500cdbc Set @balena/es-version to es2022 to match tsconfig.json
Change-type: patch
2024-03-25 16:56:27 +00:00
flowzone-app[bot]
1e2d9a71f9
v16.1.7 2024-03-25 15:25:29 +00:00
Page-
3c1763c6a8
Merge pull request #2253 from balena-os/increase-auto-select-family-timeout
Increase the timeout for auto select family to 5000ms to avoid issues
2024-03-25 15:24:27 +00:00
Pagan Gazzard
5cd37e73ac Increase the timeout for auto select family to 5000ms to avoid issues
On slower networks the default of 250ms can cause problems as all
attempts will fail rather than only the ones for interfaces that do not
actually work correctly. Increasing this timeout to 5000ms will help to
avoid these issues

Change-type: patch
2024-03-25 15:05:13 +00:00
flowzone-app[bot]
7dd0323c2b
v16.1.6 2024-03-18 21:37:36 +00:00
flowzone-app[bot]
77e596cc13
Merge pull request #2252 from balena-os/pin-iptables-to-legacy
Pin iptables to 1.8.9 (legacy)
2024-03-18 21:36:20 +00:00
Christina Ying Wang
3d881347e7 Pin iptables to 1.8.9 (legacy)
With Alpine 3.19, iptables gets bumped to 1.8.10 which uses nftables.
The host OS still uses iptables 1.8.7 (legacy), and we should
use legacy as well until the OS uses nftables.

See: https://balena.zulipchat.com/#narrow/stream/345889-balena-io.2Fos/topic/iptables.20host.20vs.2E.20nftables.20Supervisor
Change-type: patch
Signed-off-by: Christina Ying Wang <christina@balena.io>
2024-03-18 14:15:24 -07:00
flowzone-app[bot]
8b173918ea
v16.1.5 2024-03-12 13:33:10 +00:00
flowzone-app[bot]
d5708ee4ed
Merge pull request #2250 from balena-os/fatrw
Update fatrw to v0.2.21
2024-03-12 13:31:45 +00:00
Felipe Lalanne
772702793c Update fatrw to v0.2.21
Update fatrw from 0.2.9 to 0.2.21

Change-type: patch
2024-03-08 11:43:54 -03:00
flowzone-app[bot]
17edef2836
v16.1.4 2024-03-08 14:10:23 +00:00
flowzone-app[bot]
8e7c4365b0
Merge pull request #2249 from balena-os/balena-request
Update balena-register-device and its deps
2024-03-08 14:09:36 +00:00
Felipe Lalanne
790f6b71e4 Update balena-register-device and its deps
This bumps the related dependencies

- balena-register-device
- balena-request
- balena-auth

Change-type: patch
2024-03-07 14:15:38 -03:00
flowzone-app[bot]
e2de416801
v16.1.3 2024-03-07 16:10:27 +00:00
flowzone-app[bot]
f4a42d4e3d
Merge pull request #2248 from balena-os/node-20
Update Node to v20
2024-03-07 16:09:40 +00:00
Felipe Lalanne
08727ed2b5 Remove dependency on @balena/happy-eyeballs
Node 20 now implements the happy eyeballs algorithm as part of its core
`net` module, with the [autoSelectFamily](https://nodejs.org/docs/latest-v20.x/api/net.html#netgetdefaultautoselectfamily) option of `socket.connect`. This option defaults to `true`, meaning that a separate
implementation of happy eyeballs is no longer needed.

Change-type: patch
2024-03-06 15:16:33 -03:00
Felipe Lalanne
b77dba2046 Update Node to v20
This updates the supervisor runtime to latest Node LTS version. There
are no breaking changes related to this bump.

Change-type: patch
2024-03-06 12:29:54 -03:00
flowzone-app[bot]
7bb85d7aa1
v16.1.2 2024-03-06 14:06:49 +00:00
flowzone-app[bot]
ff36ccf4a0
Merge pull request #2247 from balena-os/typescript-5
Update to typescript v5
2024-03-06 14:06:01 +00:00
Felipe Lalanne
6217546894 Update typescript to v5
This also updates code to use the default import syntax instead of
`import * as` when the imported module exposes a default. This is needed
with the latest typescript version.

Change-type: patch
2024-03-05 15:33:56 -03:00
Felipe Lalanne
3c546aa199 Add sync directory to lint sources 2024-03-05 15:33:50 -03:00
flowzone-app[bot]
59137f2baf
v16.1.1 2024-03-04 18:16:14 +00:00