Commit Graph

4458 Commits

Author SHA1 Message Date
Pagan Gazzard
fd135214fe Use got for fetching the target state in order to have brotli support
Change-type: patch
2022-12-15 21:15:11 +00:00
Balena CI
ac3812aa9f
v14.4.7 2022-12-15 20:39:49 +00:00
Balena CI
a9d920c4c7
Merge pull request #2079 from balena-os/clarify-api-docs-for-api-key-regenerate-endpoint
patch: Update API.md
2022-12-15 15:38:03 -05:00
Christina Wang
24e5996b56 Update API.md
Clarify that only containers on a single device will be restarted following API key refresh,
not the whole fleet. Each device has its own distinct API key.

Change-type: patch
Signed-off-by: Christina Ying Wang <christina@balena.io>
2022-12-13 19:18:33 -08:00
Balena CI
a482174aa0
v14.4.6 2022-12-08 18:39:59 +00:00
Christina Wang
577fec7ef6
Merge pull request #2073 from balena-os/host-config
Make readFromBoot behave more like Node readFile
2022-12-08 10:38:27 -08:00
Balena CI
cb72b8337b
v14.4.5 2022-12-07 19:29:25 +00:00
Felipe Lalanne
5c9b896c82
Merge pull request #2069 from balena-os/local-journalctl
Stop using host journalctl
2022-12-07 16:28:02 -03:00
Felipe Lalanne
77cd15f131 Sanitize output when writing to redsocks.conf
Properties with values including quotes (`"`) would not get sanitized
and written verbatim on the config file, causing redsocks to fail.

Closes: #2072
2022-12-07 18:36:25 +00:00
Felipe Lalanne
0605e996c9 Make readFromBoot behave more like Node readFile
The `readFromBoot` function replaced calls to readFile in the codebase
when the target location is under `/mnt/boot` in order to use `fatrw`
to check for corruption. Unfortunately this function behaved a little
differently with regards to errors. While `readFile` returns a code `ENOENT`
when the file is not found, `readFromBoot` would just throw an exception
with whatever code was given by fatrw. This would cause confusion for
some calls that were behaving differently with a `ENOENT`, causing some
issues.

Closes: #2071
Change-type: patch
2022-12-07 18:30:34 +00:00
Felipe Lalanne
91b119cbae Stop using host journalctl
The supervisor had to chroot into the host root in order to read the
journal logs. This won't be possible anymore once the supervisor becomes
an app. This commit copies the journalctl binary and necessary libraries
from a debian image into the supervisor image in order to be able to use
the tool on runtime.

Change-type: patch
2022-12-05 17:09:20 -03:00
Balena CI
3e1b1b0be1
v14.4.4 2022-11-22 15:22:26 +00:00
bulldozer-balena[bot]
d2cc2e4b38
Merge pull request #2067 from balena-os/module-resolution
Enable node16 module resolution in tsconfig to ease the ESM transition
2022-11-22 15:20:51 +00:00
Pagan Gazzard
836f6ab754 Enable node16 module resolution in tsconfig to ease the ESM transition
This means that dynamic import statements will emit actual `import`
statements rather than being translated to `require`, the benefit being
that we can now import ES modules via dynamic imports

Change-type: patch
2022-11-22 11:01:03 -03:00
Balena CI
db1c806d33
v14.4.3 2022-11-22 02:54:22 +00:00
bulldozer-balena[bot]
cf5a668fe5
Merge pull request #2060 from balena-os/timers-promises
Use timers/promises for promisified setTimeout
2022-11-22 02:52:59 +00:00
Christina Ying Wang
e0f77b660d Fix config test typo
Signed-off-by: Christina Ying Wang <christina@balena.io>
2022-11-21 18:18:15 -05:00
Pagan Gazzard
b8891ebb08 Use timers/promises for promisified setTimeout
Change-type: patch
2022-11-21 18:17:34 -05:00
Balena CI
80f52b796a
v14.4.2 2022-11-21 20:02:28 +00:00
bulldozer-balena[bot]
13ca0ebb25
Merge pull request #2061 from balena-os/unnecessary-reduce
Remove some unnecessary usage of `.reduce`
2022-11-21 20:00:39 +00:00
Pagan Gazzard
3dea88c74e Remove some unnecessary usage of .reduce
Change-type: patch
2022-11-18 17:10:36 +00:00
Balena CI
e64166a583
v14.4.1 2022-11-18 16:08:16 +00:00
bulldozer-balena[bot]
40d19520e5
Merge pull request #2049 from balena-os/decrease_metrics_frequency
Limit metrics reporting maximum frequency to 5 minutes
2022-11-18 16:06:54 +00:00
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