Commit Graph

4368 Commits

Author SHA1 Message Date
Balena CI
935a4fba59
v14.9.1 2023-02-15 14:13:58 +00:00
Page-
1b210d4fa6
Merge pull request #2132 from balena-os/lower-case-cpu-id
Always lower case the cpu id to avoid bouncing between casing when reporting
2023-02-15 14:13:12 +00:00
Pagan Gazzard
d356f979d3 Always lower case the cpu id to avoid bouncing between casing when reporting
Change-type: patch
2023-02-15 13:54:40 +00:00
Balena CI
5b0c8e6743
v14.9.0 2023-02-14 17:10:10 +00:00
Felipe Lalanne
f834c551a4
Merge pull request #2130 from balena-os/duplicate-networks
Find and remove duplicate networks
2023-02-14 12:09:22 -05:00
Felipe Lalanne
89175432af Find and remove duplicate networks
We have seen a few times devices with duplicated network names for some
reason. While we don't know the cause the networks get duplicates, this
can be disruptive for updates as trying to create a container referencing a duplicate
network results in a 400 error from the engine.

This commit finds and removes duplicate networks via the state engine,
this means that even if somehow a container could be referencing a
network that has been duplicated later somehow, this will remove the
container first.

While thies doesn't solve the problem of duplicate networks being
created in the first place, it will fix the state of the system to
correct the inconsistency.

Change-type: minor
Closes: #590
2023-02-10 20:24:36 -05:00
Felipe Lalanne
180c4ff31a Reference networks by Id instead of by name
We have seen a few times devices with duplicated network names for some
reason. While we don't know the cause the networks get duplicates,
this is disruptive of updates, as the supervisor usually queries
resource by name, resulting in a 400 error from the engine because of
the ambiguity.

This replaces those queries by name to queries by id. This includes
network removal. If a `removeNetwork` step is generated, the supervisor
opts to remove all instances of the network with the same name as it
cannot easily resolve the ambiguity.

This doesn't solve the problem of ambiguous networks, because even if
networks are referenced by id when creating a container, the engine will
throw an error (see https://github.com/balena-os/balena-supervisor/issues/590#issuecomment-1423557871)

Change-type: patch
Relates-to: #590
2023-02-10 20:24:36 -05:00
Balena CI
e7aaae9db9
v14.8.0 2023-02-10 23:01:04 +00:00
Christina Wang
c80f5b887a
Merge pull request #2105 from balena-os/remove-dependent-devices-code
Remove dependent devices content in codebase
2023-02-10 15:00:18 -08:00
Christina Ying Wang
c4f9d72172 Remove dependent devices content in codebase
This includes:
- proxyvisor.js
- references in docs
- references device-state, api-binder, compose modules, API
- references in tests

The commit also adds a migration to remove the 4 dependent device tables from the DB.

Change-type: minor
Signed-off-by: Christina Ying Wang <christina@balena.io>
2023-02-06 19:34:02 -08:00
Balena CI
cfd18a7620
v14.7.1 2023-02-07 00:59:07 +00:00
Christina Wang
6693a02d3e
Merge pull request #2129 from balena-os/patch-journalctl-date-format
patch: Convert internal timestamp passed to journalctl from number to string
2023-02-06 18:58:18 -06:00
Christina Ying Wang
9b26fc263a patch: Convert internal timestamp passed to journalctl from number to string
See: https://github.com/balena-os/balena-supervisor/pull/2084
Change-type: patch
Signed-off-by: Christina Ying Wang <christina@balena.io>
2023-02-06 15:59:16 -08:00
Balena CI
3d28f36fb2
v14.7.0 2023-02-03 00:06:05 +00:00
Christina Wang
e2383c8cca
Merge pull request #2084 from rkeulemans/feature/support_since_and_until_in_journald_supervisor_wrapper
Feature: Support `since` and `until` in supervisor journald wrapper
2023-02-01 17:04:12 -08:00
Ruben Keulemans
9a1cde7f44 Support since and until in supervisor journalctl wrapper API.
Signed-off-by: Ruben Keulemans ruben.keulemans@protonmail.com
Change-type: minor
Closes: #2083
2023-02-01 09:17:10 +01:00
Balena CI
8b7cecfd3e
v14.6.4 2023-01-31 19:43:30 +00:00
Balena CI
11952fd266
Merge pull request #2102 from balena-os/supervisor-sigterm
Add SIGTERM listener on supervisor start
2023-01-31 21:41:31 +02:00
Felipe Lalanne
4d74505087 Fix wait-for-it script to work with external signals
The wait-for-it script used during tests would setup a timer
that would send SIGUSR2 to the parent process after the timer ends.
Since node was ignoring additional signals, the timer ending would have
no effect after the node process had replaced the start script. However
when node has pid != 1, SIGUSR2 default behavior is to terminate the
process, meaning the tests would fail after 30 seconds.

The script is now updated so the timer is killed once the services are
ready for the tests.
2023-01-31 10:43:19 -03:00
Felipe Lalanne
6683bca07d Add SIGTERM listener on application start
As reported by issue #2100, the supervisor was not correctly reacting to
`SIGTERM` sent by the engine when terminating the process (for instance
before a reboot). This would lead to the supervisor requiring an
additional 10 seconds to terminate (after which the engine will send a
`SIGKILL`).

The reason for this is explained by the following info coming from Node

> Node.js was not designed to run as PID 1 which leads to unexpected behaviour when running inside of Docker. For example, a Node.js process running as PID 1 will not respond to `SIGINT` (`CTRL-C`) and similar signals. [reference](https://github.com/nodejs/docker-node/blob/main/docs/BestPractices.md#handling-kernel-signals)

On internal testing, it was discovered that simply adding a listener for
the signal on the Node process was enough to handle the signal, even
when the process runs as PID 1.

This adds a listener for `SIGTERM` before starting the supervisor main
loop.

Closes: #2100
Change-type: patch
2023-01-31 10:43:19 -03:00
Balena CI
f663e38697
v14.6.3 2023-01-30 18:59:40 +00:00
Christina Wang
17a85973d8
Merge pull request #2104 from balena-os/update-deploy-to-balena-action-v0.26
Update deploy-to-balena action to 0.26.0
2023-01-30 10:58:10 -08:00
Christina Ying Wang
2bd2879cc5 Update deploy-to-balena action to 0.26.0
Change-type: patch
Signed-off-by: Christina Ying Wang <christina@balena.io>
2023-01-30 12:27:53 -06:00
Balena CI
c833d016ff
v14.6.2 2023-01-26 20:58:35 +00:00
Christina Wang
5bf4ab297e
Merge pull request #2085 from balena-os/vipul/supervisor-docs
patch: Migrate Supervisor Debugging docs from masterclass
2023-01-26 12:57:19 -08:00
Christina Ying Wang
6d4f7cb32c Fix grammar and simplify some phrases
Signed-off-by: Christina Ying Wang <christina@balena.io>
2023-01-25 13:45:15 -08:00
Vipul Gupta (@vipulgupta2048)
a9045d5eda patch: Migrate Supervisor Debugging docs from masterclass
Signed-off-by: Vipul Gupta (@vipulgupta2048) <vipul@balena.io>
2023-01-25 13:45:15 -08:00
Balena CI
f94f06c7ff
v14.6.1 2023-01-24 20:34:01 +00:00
Balena CI
cca1bba113
Merge pull request #2099 from balena-os/flowzone-allow-external-custom-workflows
Remove custom action restriction for external contributors
2023-01-24 22:32:37 +02:00
Christina Ying Wang
b945142caa Remove custom action restriction for external contributors
Change-type: patch
Signed-off-by: Christina Ying Wang <christina@balena.io>
2023-01-24 10:58:41 -08:00
Balena CI
e715498ee7
v14.6.0 2023-01-20 20:51:25 +00:00
Balena CI
afc1372655
Merge pull request #2090 from balena-os/colon-config-vars
Allow using colon character in config vars
2023-01-20 22:49:53 +02:00
Felipe Lalanne
67d1503b54 Allow using colon character in config vars
The Raspberry Pi config.txt file defines the use of colon to configure
variables of the same name in different ports, for instance on those
devices with two hdmi ports. This syntax was previously not supported by
the supervisor. This change relaxes the syntax validation on config vars
to allow the use of the colon character.

Relates-to: #1573, #2046
Change-type: minor
2023-01-20 15:48:32 -03:00
Balena CI
072a9f6755
v14.5.2 2023-01-19 19:40:04 +00:00
Balena CI
74ce15d4ff
Merge pull request #2093 from balena-os/kyle/external-contributors
Allow external contribtions to execute checks
2023-01-19 21:38:19 +02:00
Kyle Harding
b26d2e0e7c
Allow external contribtions to execute checks
Change-type: patch
Signed-off-by: Kyle Harding <kyle@balena.io>
2023-01-19 12:17:48 -05:00
Balena CI
cf7a865647
v14.5.1 2023-01-18 11:58:56 +00:00
Balena CI
7313c114c5
Merge pull request #2092 from balena-os/fix-got-extend
Correctly use the extended got instance for target-state
2023-01-18 13:57:29 +02:00
Pagan Gazzard
63cc4ad58c Correctly use the extended got instance for target-state
In practice this fixes the missing user-agent

Change-type: patch
2023-01-18 11:40:06 +00:00
Balena CI
6c7193e0c1
v14.5.0 2023-01-17 19:28:46 +00:00
Christina Wang
3142196202
Merge pull request #2048 from balena-os/separate-route-and-action-tests
Separate route and action tests for Supervisor v1 API
2023-01-17 11:27:20 -08:00
Christina Ying Wang
e1bacda580 Update host-config, route, and action tests for host config endpoints
Change-type: minor
Signed-off-by: Christina Ying Wang <christina@balena.io>
2023-01-11 15:48:13 -08:00
Christina Ying Wang
250684d651 Use actions & write tests for GET /v1/device
Signed-off-by: Christina Ying Wang <christina@balena.io>
2023-01-11 15:48:13 -08:00
Christina Ying Wang
72c683d5ff Use actions & write tests for GET /v1/apps/:appId
Signed-off-by: Christina Ying Wang <christina@balena.io>
2023-01-11 15:48:13 -08:00
Christina Ying Wang
198d9ad638 Write update action and tests, remove isReadyForUpdate check
See: #1924
Signed-off-by: Christina Ying Wang <christina@balena.io>
2023-01-11 15:48:13 -08:00
Christina Ying Wang
85392f2a85 Move reboot/shutdown to actions and related tests to integration
Signed-off-by: Christina Ying Wang <christina@balena.io>
2023-01-11 15:48:13 -08:00
Christina Ying Wang
c6cf6a0136 Use executeServiceAction for v1/v2 service action endpoints
This includes:
- /v1/apps/:appId/(stop|start)
- /v2/applications/:appId/(restart|stop|start)-service

Signed-off-by: Christina Ying Wang <christina@balena.io>
2023-01-09 18:20:24 -08:00
Christina Ying Wang
fcd28591c6 Add tests for doPurge action and v1/v2 app purge routes
Signed-off-by: Christina Ying Wang <christina@balena.io>
2023-01-09 16:25:27 -08:00
Christina Ying Wang
a24d5acf7f Add tests for doRestart action and v1/v2 app restart routes
Signed-off-by: Christina Ying Wang <christina@balena.io>
2023-01-09 16:25:27 -08:00
Christina Ying Wang
d6298b2643 Use regenerateKey action for POST /v1/regenerate-api-key
This also adds a 500 response with the old key if the API key
refresh was unsuccessful. Previously, if the key refresh was
unsuccessful, this would result in an UnhandledPromiseRejection.
This is a new interface.

Signed-off-by: Christina Ying Wang <christina@balena.io>
2023-01-09 16:25:27 -08:00