Commit Graph

4589 Commits

Author SHA1 Message Date
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
flowzone-app[bot]
161f74a620
Merge pull request #2246 from balena-os/balena-lint
Update @balena/lint to v7
2024-03-04 18:15:27 +00:00
Felipe Lalanne
988a1c9e9a Update @balena/lint to v7
This updates balena lint to the latest version to enable eslint support
and unblock Typescript updates. This is a huge number of changes as the
linting rules are much more strict now, requiring modifiying most files
in the codebase. This commit also bumps the test dependency `rewire` as
that was interfering with the update of balena-lint

Change-type: patch
2024-03-01 18:27:30 -03:00
flowzone-app[bot]
8750951521
v16.1.0 2024-02-27 19:30:56 +00:00
flowzone-app[bot]
d75776131d
Merge pull request #2244 from balena-os/duplicate-overlays
Add support for repeated overlays
2024-02-27 19:29:23 +00:00
Felipe Lalanne
bda1bac04c Add support for repeated overlays
RPI firmware configuration allows repeating overlays to define
configurations on multiple devices. For instance, for configuring
multiple `ads` devices, `config.txt` needs to be setup this way

```
dtoverlay=ads1115,addr=0x48
dtoverlay=ads1115,addr=0x49
```

Before this change, the supervisor would interpret both lines as
belonging to the same overlay, preventing users from configuring multiple
devices, and leading to a loop when trying to apply configurations with
repeated overlays coming from the cloud side.

Change-type: minor
2024-02-27 14:52:41 -03:00
flowzone-app[bot]
d49b5e333f
v16.0.4 2024-02-27 15:06:27 +00:00
flowzone-app[bot]
716ca95e44
Merge pull request #2245 from balena-os/fix-rsync-deltas
Fix support for rsync deltas
2024-02-27 15:05:36 +00:00
Felipe Lalanne
24e222045a Fix support for rsync deltas
Rsync (v2) deltas have been broken since [Supervisor v14](460c3ba0aa). While considered legacy,
they are still used by a few customers with devices running OS < 2.47.1.
This should fix v2 delta support for those devices until we can
completely remove rsync deltas from the supervisor

Change-type: patch
2024-02-27 11:09:04 -03:00
flowzone-app[bot]
4daf6192b8
v16.0.3 2024-02-21 21:03:26 +00:00
flowzone-app[bot]
b1bb7934b0
Merge pull request #2243 from balena-os/config-txt-patch-default-dtparam-handling
Patch default dtparam handling in config.txt
2024-02-21 21:02:18 +00:00
Christina Ying Wang
3fd035c5bd Patch default dtparam handling in config.txt
This commit completes the list of default / board-wide dtparams
to include some `baudrate` and `vc` i2c params.

Change-type: patch
Signed-off-by: Christina Ying Wang <christina@balena.io>
2024-02-21 12:45:29 -08:00
flowzone-app[bot]
d1c834d196
v16.0.2 2024-02-17 02:44:56 +00:00
flowzone-app[bot]
6536bd7fed
Merge pull request #2241 from balena-os/config-txt-getBootConfig-arrayConf-patch
Patch config.txt backend to return array configs correctly
2024-02-17 02:44:00 +00:00
Christina Ying Wang
e22253ce6e Patch config.txt backend to return array configs correctly
Previously, getBootConfig() of the config.txt backend was omitting
array configurations such as gpio settings, thus resulting in the SV
mistakenly assuming that boot config had not been applied, since gpio
would not be in current config.txt config but would be in target config.
This resulted in SV entering an infinite loop of attempting to apply the
gpio config when it wasn't necessary.

Change-type: patch
Signed-off-by: Christina Ying Wang <christina@balena.io>
2024-02-16 18:12:33 -08:00
flowzone-app[bot]
5adf727cb5
v16.0.1 2024-02-12 19:56:21 +00:00
balena-renovate[bot]
6dfef695ea
Merge pull request #2233 from balena-os/renovate/balena-io-deploy-to-balena-action-2.x
Update balena-io/deploy-to-balena-action action to v2
2024-02-12 19:55:36 +00:00
Self-hosted Renovate Bot
ac12d9a50c Update balena-io/deploy-to-balena-action action to v2
Update balena-io/deploy-to-balena-action
Changelog-entry: Update balena-io/deploy-to-balena-action to v2.0.27
Change-type: patch
2024-02-12 11:40:19 -08:00
flowzone-app[bot]
52dddd23ce
v16.0.0 2024-02-08 21:45:45 +00:00
flowzone-app[bot]
3c7f0833b5
Merge pull request #2238 from balena-os/config-txt-dtoverlay
Fix processing of dtoverlay/dtparams on config.txt
2024-02-08 21:44:54 +00:00
Felipe Lalanne
6e6a796da5 Add special case for base DTO params on RPI config
While ordering is important in the RPI firmware configuration file (config.txt),
some dt params are by default considered part of the base dt overlay
if they are not used by other overlays.
Unfortunately the [list of dtparams](https://github.com/raspberrypi/firmware/blob/master/boot/overlays/README#L133)
is too long to add all of them as exceptions, but we can add the params
used in the default config.txt provided in OS images, to avoid reboots
when updating to this new supervisor and correctly parsing the
provisioning config.txt as variables.

While this addition handles most common scenarios, there is still a
chance a user may have use other base overlay dt params in the initial
config, in which case those will be interpreted according to the
relative ordering

Change-type: patch
2024-02-08 15:48:10 -03:00
Felipe Lalanne
9546a1a3b1 Fix processing of dtoverlay/dtparams on config.txt
DT overlays and DT params need to be consumed in the order that they
appear on the file. DT params apply to the last dtoverlay defined on the
file, or to the base overlay.

This commit updates config.txt parsing to consider this ordering, and it
also ensures global dtparams are written first so they cannot be
overriden by later overlays.

Because of the more strict parsing method, it is possible that existing
HOST_CONFIG vars do not match the interpretation of the parser. If
that's the case, the supervisor will re-apply the target state which
will cause the device to reboot.

Change-type: major
2024-02-08 15:46:07 -03:00
Felipe Lalanne
a8e371f0c9 Refactor config-txt backend
Cleans up code and adds better type detection
2024-02-07 20:39:41 -03:00
Felipe Lalanne
55a8c5bf90 Add tests for dtoverlay management in config.txt 2024-02-07 20:38:44 -03:00
flowzone-app[bot]
c90c02806f
v15.3.1 2024-02-01 19:31:16 +00:00
flowzone-app[bot]
c31cf8c533
Merge pull request #2230 from balena-os/multi-container-state-apply
Apply update strategies app-wide
2024-02-01 19:30:30 +00:00
Christina Ying Wang
3afcef2969 Respect update strategies app-wide instead of at the service level
Fixes behavior for release updates which removes a service in current state
and adds a new service in target state.

Change-type: patch
Closes: #2095
Signed-off-by: Christina Ying Wang <christina@balena.io>
2024-01-29 12:26:28 -08:00
Felipe Lalanne
87b195685a Use the state-helper functions in app module tests 2024-01-29 12:25:55 -08:00
flowzone-app[bot]
963f43cf0d
v15.3.0 2024-01-26 14:51:03 +00:00
flowzone-app[bot]
1346527ec9
Merge pull request #2235 from balena-os/prettierrc
Supervisor Developer experience improvements
2024-01-26 14:50:14 +00:00
Felipe Lalanne
0500fe10bb Pin docker version to v24 for tests
Moby v25 adds the dynamically generated MAC address to the Config field,
which breaks the state engine, preventing the state from settling as the
current state never matches the target state (empty mac address). This
seems to be a bug in Moby that we reported in moby/moby#47228

The issue won't affect Balena devices until balenaEngine is updated, and this
change fixes testing for now.

Change-type: patch
2024-01-25 16:43:00 -03:00
Felipe Lalanne
6ee606806d Fix docker utils tests for docker v25
From docker 25, the engine will validate IPAM config. This would cause
the docker utils test to fail since the network/subnet configuration was
incorrect.

Change-type: patch
2024-01-25 15:05:12 -03:00
Felipe Lalanne
23fae633ca Enable nodemon when using test:env
This avoids the need to rebuild the environment when making code changes
and running integration tests

Change-type: minor
2024-01-25 15:05:12 -03:00
Felipe Lalanne
2f3e3d2e61 Improve test:compose and test:env commands
The commands now use docker-compose run instead of docker compose up
for simplicity and also to match what flowzone does.

Change-type: patch
2024-01-25 15:05:02 -03:00
Felipe Lalanne
e2f54e29fa Add prettierrc for editor compatibility
The tsserver lsp doesn't seem to work well with .editorconfig. Using
prettierrc will allow formatting to work correctly with editor plugins

This also updates editorconfig to work well with json

Change-type: patch
2024-01-25 15:04:33 -03:00
flowzone-app[bot]
d32987ab1f
v15.2.0 2024-01-08 13:25:40 +00:00
flowzone-app[bot]
48d288b715
Merge pull request #2231 from balena-os/mdns-improvements
Try MDNS lookup only if regular DNS lookup fails
2024-01-08 13:24:53 +00:00
Felipe Lalanne
dec39a35d4 Try MDNS lookup only if regular DNS lookup fails
This is meant to allow users to configure their device to
resolve `.local` queries via dnsmasq by modifying config.json, e.g. `dnsServers":
"/bob.local/172.17.0.33`.

This would fail before as MDNS lookups would always come first

Change-type: minor
2024-01-03 14:42:23 -03:00
Felipe Lalanne
7a39da92b7 Refactor mdns lookup code in app entry
Change-type: patch
2024-01-03 14:42:23 -03:00
flowzone-app[bot]
66c35cfd4a
v15.1.1 2024-01-02 18:35:28 +00:00
flowzone-app[bot]
c969f87673
Merge pull request #2232 from balena-os/alexgg/start-stop-service
docs: api: start-service: specify this endpoint affects the device
2024-01-02 18:34:38 +00:00
Alex Gonzalez
096fdbc74a docs: api: start-service: specify this endpoint affects the device
The description incorrectly states the endpoint would start a service
in the whole fleet while it only affects the device.

Change-type: patch
Signed-off-by: Alex Gonzalez <alexg@balena.io>
2023-12-29 17:53:14 +01:00
flowzone-app[bot]
df027248fd
v15.1.0 2023-11-22 20:12:21 +00:00
flowzone-app[bot]
698b8159ff
Merge pull request #2226 from balena-os/sandbox-error
Force remove container if updateMetadata fails
2023-11-22 20:10:41 +00:00
Felipe Lalanne
3ea8d4727a Force remove container if updateMetadata fails
The `updateMetadata` step renames the container to match the target
release when the service doesn't change between releases. We have seen
this step fail because of an engine bug that seems to relate to the
engine keeping stale references after container restarts. The only way
around this issue is to remove the old container and create it again.
This implements that workaround during the updateMetadata step to deal
with that issue.

Change-type: minor
Relates-to: balena-os/balena-engine#261
2023-11-22 14:16:44 -03:00
flowzone-app[bot]
6acd04a01b
v15.0.4 2023-11-22 17:10:59 +00:00
flowzone-app[bot]
b6aa75b4ee
Merge pull request #2227 from balena-os/update-systemd-0.5.0
Update @balena/systemd to 0.5.0
2023-11-22 17:10:08 +00:00
Christina Ying Wang
fd3b6f6961 Include target-state-config dump file in testfs
Signed-off-by: Christina Ying Wang <christina@balena.io>
2023-11-22 11:09:26 -03:00