Commit Graph

4335 Commits

Author SHA1 Message Date
Ken Bannister
599b5cf811 Improve determination of when a state change may need to be reported
Change-type: patch
Signed-off-by: Ken Bannister <kb2ma@runbox.com>
2022-11-18 09:23:20 -05:00
Ken Bannister
b1d4aa5159 Report must include a state change if sooner than metrics frequency
Export list of metrics properties from device state module for this
determination.

Change-type: patch
Signed-off-by: Ken Bannister <kb2ma@runbox.com>
2022-11-18 09:12:10 -05:00
Ken Bannister
d1dd53b5b6 Remove report frequency management from current state reporting function
Report frequency now managed completely by callers.

Change-type: patch
Signed-off-by: Ken Bannister <kb2ma@runbox.com>
2022-11-17 07:41:08 -05:00
Ken Bannister
c67429f3e1 Move definition of maxReportFrequency to the reporting file
Narrows scope to where it is used, like the new maxMetricsFrequency value.

Change-type: patch
Signed-off-by: Ken Bannister <kb2ma@runbox.com>
2022-11-17 07:41:08 -05:00
Ken Bannister
45d71fa60d Report metrics in target-state PATCH based on a max frequency
Adds maxMetricsFrequency, separate from maxReportFrequency.
Also ensures most recent state change event is reported.

Change-type: patch
Signed-off-by: Ken Bannister <kb2ma@runbox.com>
2022-11-17 07:41:08 -05:00
Balena CI
48fca82a79
v14.4.0 2022-11-17 01:37:54 +00:00
bulldozer-balena[bot]
e4e59c656d
Merge pull request #1971 from balena-os/fatrw
Use fatrw for writes to /mnt/boot
2022-11-17 01:35:46 +00:00
Felipe Lalanne
dade598737 Use fatrw utility for writes to boot partition
This PR changes the way the supervisor reads and writes files from /mnt/boot. Reads will
now use the [fatrw utility](https://github.com/balena-os/fatrw/) as a way to minimize corruption of
files in the boot partition, and thus preventing possible bricking of the device.

Since this basically changes the way a lot of configurations are read, this work was being blocked because of
the way tests were being done. While there still remain a couple of legacy tests to be migrated, this PR disables
test:legacy tests when running npm run test, as the work on refactoring those tests is in progress (see #2048) and
fatrw integration is of higher priority.

Change-type: minor
2022-11-16 21:21:23 -03:00
Balena CI
d14cca8e5d
v14.3.5 2022-11-16 22:29:58 +00:00
bulldozer-balena[bot]
3e4954e7c3
Merge pull request #2065 from balena-os/simplify-getting-images-for-cleanup
Simplify getting images for cleanup
2022-11-16 22:28:40 +00:00
Christina Ying Wang
8174ea9643 Simplify getting images for cleanup
getImagesForCleanup used to query the Engine for the Supervisor
image, which is unnecessary given that the Supervisor has access
to constants.supervisorImage. Thus, this Engine query is removed.

The method is simplified and made more clear, and
imageManager.isCleanupNeeded doesn't need to be stubbed in tests.

Change-type: patch
Signed-off-by: Christina Ying Wang <christina@balena.io>
2022-11-16 12:52:49 -08:00
Balena CI
631e560137
v14.3.4 2022-11-16 18:55:03 +00:00
bulldozer-balena[bot]
725a6b5274
Merge pull request #2064 from balena-os/create-default-net-as-config-only-if-host-networking
Create default network as config-only when services have host networking
2022-11-16 18:53:40 +00:00
Christina Ying Wang
f558be0a16 Create default network as config-only when services have host networking
This eliminates chances of host-Docker address collision for apps such
as the Supervisor where all services have host networking.

Closes: #2062
Change-type: patch
Signed-off-by: Christina Ying Wang <christina@balena.io>
2022-11-16 10:19:36 -08:00
Balena CI
b29aaf540f
v14.3.3 2022-11-14 15:28:58 +00:00
bulldozer-balena[bot]
b9a3ad294e
Merge pull request #2042 from balena-os/device-config-tests
Migrate all device config tests to integration
2022-11-14 15:27:30 +00:00
pipex
827f892c13 Migrate all device config tests to integration.
This means that configuration backend tests no longer use stubs and
(mostly) avoid internal dependencies in the tests. Instead of stubs and
mock-fs, the tests use [testfs](https://github.com/balena-io-modules/mocha-pod#working-with-the-filesystem)
which allows working with a real filesystem and ensuring everything is
re-set between tests.

This is the last change needed in order to be able to merge #1971. Here is the list of changes

- [x] Migrate splash image backend tests
- [x] Migrate extlinux backend tests
- [x] Migrate config.txt backend tests
- [x] Migrate extra-uenv config tests
- [x] Migrate odmdata config tests
- [x] Migrate config utils tests
- [x] Migrate device-config tests

Change-type: patch
2022-11-14 11:12:52 -03:00
Balena CI
83c856ae4b
v14.3.2 2022-11-11 17:14:06 +00:00
bulldozer-balena[bot]
f6c02653ee
Merge pull request #2059 from balena-os/fix-locking-stubs
Fix locking stubs that were returning `Bluebird` rather than `Promise`
2022-11-11 17:12:52 +00:00
Pagan Gazzard
d587a323f2 Fix locking stubs that were returning Bluebird rather than Promise
Change-type: patch
2022-11-11 16:52:19 +00:00
Balena CI
ae756cfabe
v14.3.1 2022-11-11 16:47:26 +00:00
bulldozer-balena[bot]
ca02818e8d
Merge pull request #2058 from balena-os/update-blinking
Update blinking to 0.0.7
2022-11-11 16:46:07 +00:00
Pagan Gazzard
9e154da76e Update blinking to 0.0.7
Update blinking from 0.0.5 to 0.0.7

Change-type: patch
2022-11-11 16:06:11 +00:00
Balena CI
d766e3d103
v14.3.0 2022-11-10 01:09:40 +00:00
bulldozer-balena[bot]
224eeb86a0
Merge pull request #2054 from balena-os/improve-sv-docker-network-setup
Convert ensureSupervisorNetwork to native Promises, remove sys interface check
2022-11-10 01:08:12 +00:00
Christina Ying Wang
af0bb87def Improve error message if supervisor0 network not found
Signed-off-by: Christina Ying Wang <christina@balena.io>
2022-11-09 10:22:27 -08:00
Christina Ying Wang
1034aa70e6 Convert ensureSupervisorNetwork to native Promises
Also remove system interface check from ensureSupervisorNetwork.

Previously `ensure` was a Bluebird promise which wasn't awaited in
its composition step. This has been here for some time and may contribute
to issues with duplicate networks. The conversion to native Promises
allows `ensure` to be awaited, hopefully reducing instances of duplicate
networks.

Removing the system interface check for /sys/class/net/supervisor0
because it's superfluous given that the Engine creates the interface
with NetworkManager. It also makes testing a lot more difficult to set up
as /sys/class/net isn't a directory that can be written to for emulating
system interface creation / removal.

Relates-to: https://github.com/balena-os/balena-supervisor/issues/1110
Change-type: minor
Signed-off-by: Christina Ying Wang <christina@balena.io>
2022-11-08 16:06:10 -08:00
Christina Ying Wang
57f4dcbcac Change macAddressPath to /sys/class/net
Previously it was set at /mnt/root/sys/class/net, which is
the same as /sys/class/net because Supervisor has a network
mode of `host`.

Signed-off-by: Christina Ying Wang <christina@balena.io>
2022-11-08 15:51:14 -08:00
Christina Ying Wang
75bf2aa3b4 Improve NotFoundError handling
Use isNotFoundError which converts an error of the default type
`unknown` into NotFoundError if the error is an instance of NotFoundError.
Thrown errors are of type `unknown` by default so we should use methods
with type guards for better type narrowing.

Signed-off-by: Christina Ying Wang <christina@balena.io>
2022-11-08 15:41:52 -08:00
Balena CI
80e213ab7e
v14.2.21 2022-11-07 21:20:00 +00:00
bulldozer-balena[bot]
fbdd43d00a
Merge pull request #2053 from balena-os/fix-unmanaged-target-state-behavior
Allow local target state to be applied in unmanaged mode
2022-11-07 21:18:37 +00:00
Christina Ying Wang
fd320f85b5 Allow local target state to be applied in unmanaged mode
An unmanaged Supervisor will not have a balenaApi defined, so any
attempts to POST /v2/local/target-state will cause the Supervisor to
crash loop. This fix allows for the Supervisor to apply local target
state, which is useful for integration testing.

Change-type: patch
Signed-off-by: Christina Ying Wang <christina@balena.io>
2022-11-07 12:25:41 -08:00
Christina Ying Wang
fc15ad2554 Fix typo: intialise -> initialize
Missing "i"

Signed-off-by: Christina Ying Wang <christina@balena.io>
2022-11-07 12:09:17 -08:00
Balena CI
f5ec74211f
v14.2.20 2022-11-03 22:27:41 +00:00
bulldozer-balena[bot]
d1825a18e2
Merge pull request #2050 from balena-os/vipul/update-locks
patch: Update locks behavior for config changes
2022-11-03 22:26:18 +00:00
Balena CI
c4b2cb867e
v14.2.19 2022-11-03 21:20:53 +00:00
bulldozer-balena[bot]
ff7f43c7f2
Merge pull request #2052 from balena-os/run-sv-in-container
Run the built supervisor as part of docker-compose tests
2022-11-03 21:17:21 +00:00
Felipe Lalanne
46fa7321c0 Run the built supervisor as part of docker-compose tests
This allows to test that the supervisor build actually runs and opens up the
possibility of running more exhaustive API tests against a working supervisor.

Change-type: patch
2022-11-03 15:45:39 -03:00
Felipe Lalanne
460c3ba0aa Remove DOCKER_ROOT assignments from entry.sh
These variables are not used anywhere and they don't seem to serve any
purpose. Cleaning these assingments as dead code
2022-11-03 10:33:51 -03:00
Balena CI
0bb3f0ad1f
v14.2.18 2022-11-02 19:00:54 +00:00
bulldozer-balena[bot]
9549491922
Merge pull request #2051 from balena-os/update-before-dbus-install
Update apt repositories before installing dbus
2022-11-02 18:59:24 +00:00
Christina Ying Wang
574f2ffb14 Update apt repositories before installing dbus
GitHub actions are erroring due to the package not being found;
Updating the repository listings shoud fix this.

Change-type: patch
Signed-off-by: Christina Ying Wang <christina@balena.io>
2022-11-02 11:19:52 -07:00
Vipul Gupta (@vipulgupta2048)
63bd9605cf patch: Update locks behavior for config changes
Signed-off-by: Vipul Gupta (@vipulgupta2048) <vipul@balena.io>
2022-11-02 11:50:31 +00:00
Balena CI
9e2d912fa1
v14.2.17 2022-11-01 21:47:55 +00:00
bulldozer-balena[bot]
849eee6cea
Merge pull request #2044 from balena-os/migrate-core-api-tests
Migrate core API tests to unit/integration excluding v1/v2 routes
2022-11-01 21:46:22 +00:00
Balena CI
636d623151
v14.2.16 2022-10-27 15:00:47 +00:00
bulldozer-balena[bot]
2d01123112
Merge pull request #2045 from balena-os/add_agx_orin_to_supported_fdt
config/backends: Add Jetson AGX Orin Devkit to the list of DTs that support configurable device-trees
2022-10-27 14:59:18 +00:00
Alexandru Costache
ea92fa9162 config/backends: Add Jetson AGX Orin Devkit to the list of DTs that support configurable device-tree
Change-type: patch
Signed-off-by: Alexandru Costache <alexandru@balena.io>
2022-10-26 12:35:01 +03:00
Christina Ying Wang
532e75a77e Migrate API tests to unit/integration
This excludes route tests or refactoring. Also, created tests
for API middleware.

Change-type: patch
Signed-off-by: Christina Ying Wang <christina@balena.io>
2022-10-25 19:06:39 +00:00
Balena CI
fd285b8f25
v14.2.15 2022-10-20 14:43:06 +00:00