Commit Graph

157 Commits

Author SHA1 Message Date
Pagan Gazzard
17a5d8dd49 Isolate target state fetching to its own module which emits on update
Change-type: minor
2020-06-03 17:37:38 -04:00
Cameron Diver
aad20e2c2f Make docker module a singleton
Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2020-06-02 17:57:18 +01:00
Cameron Diver
ff4a31a0e6 Make the config module a singleton
Change-type: patch
Co-authored-by: Pagan Gazzard <page@balena.io>
Signed-off-by: Cameron Diver <cameron@balena.io>
2020-06-02 14:29:05 +01:00
Miguel Casqueira
5550a3a330 Refactor device-state healthchecks to log reason for failure
Closes: #1292
Change-type: minor
Signed-off-by: Miguel Casqueira <miguel@balena.io>
2020-05-29 16:24:01 -04:00
Miguel Casqueira
ef83acdaeb Refactor api-binder healthchecks to log reason for failure
Signed-off-by: Miguel Casqueira <miguel@balena.io>
2020-05-29 16:14:58 -04:00
Miguel Casqueira
f494178b2b Added test coverage for GET /v1/healthy
Signed-off-by: Miguel Casqueira <miguel@balena.io>
2020-05-29 16:14:15 -04:00
Cameron Diver
1d7381327e Make the db module a singleton
We were treating the database class as a singleton, but still having to pass
around the db instance. Now we can simply require the db module and have
access to the database handle.

Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2020-05-29 15:02:38 +01:00
Cameron Diver
eaaa9c257e check for 409 status code, rather than string matching uuid conflicts
Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2020-05-21 14:57:26 -04:00
Miguel Casqueira
db7c27037c Improved handling of invalid appId in V2 state endpoint
Closes: #1294
Change-type: patch
Signed-off-by: Miguel Casqueira <miguel@balena.io>
2020-05-19 10:53:19 -04:00
Miguel Casqueira
466c7999db Remove CoffeeScript tests and all CoffeeScript tools
Closes: #1318
Change-Type: patch
Signed-off-by: Miguel Casqueira <miguel@balena.io>
2020-05-15 13:01:51 -04:00
Pagan Gazzard
758f3caa48 Update to @balena/lint 5.x
Change-type: patch
2020-05-15 12:08:42 +01:00
Miguel Casqueira
838c1ebba4 Correctly check if value is a valid Integer
Closes: #1180
Change-type: patch
Signed-off-by: Miguel Casqueira <miguel@balena.io>
2020-05-12 12:42:14 -04:00
Miguel Casqueira
8295858b32 Added endpoint to check if VPN is connected
Change-type: minor
Signed-off-by: Miguel Casqueira <miguel@balena.io>
2020-05-11 21:21:44 -04:00
Miguel Casqueira
f6aa4dd015 Fixed stubs for test suite
Closes: #1280
Change-type: patch
Signed-off-by: Miguel Casqueira <miguel@balena.io>
2020-05-11 18:16:22 -04:00
Pagan Gazzard
913418bb37 Remove unnecessary config.json keys
Change-type: patch
2020-05-08 12:56:42 +01:00
Miguel Casqueira
60c07fc2fc Move SupervisorAPI state change logs to appropriate functions
Closes: #1277
Change-type: patch
Signed-off-by: Miguel Casqueira <miguel@balena.io>
2020-05-07 13:48:12 -04:00
Cameron Diver
31957566e5 Remove legacy fallback to DROP rule in iptables
This has not been necessary for a long time, and wwe can now remove it.

Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2020-05-05 12:15:19 +01:00
Cameron Diver
7b1f03ced5 Add an ESTABLISHED flag to API iptables rules
This allows a response to an input with dport=`supevisor api port` and
is required when the host OS is doing stateful firewalling.

This should not affect things when stateful firewalling is not in
effect, as the standard OUTPUT chain policy is ACCEPT, so we're just
being explicit about it.

Change-type: patch
Backport-to: next, current, sunset
Signed-off-by: Cameron Diver <cameron@balena.io>
2020-05-05 12:15:12 +01:00
Miguel Casqueira
2007a98940 Added Bearer Authorization spec
Closes: #1249
Change-type: minor
Signed-off-by: Miguel Casqueira <miguel@balena.io>
2020-05-04 13:22:58 -04:00
Miguel Casqueira
698435a5c8 Added spec for current auth implementation
Signed-off-by: Miguel Casqueira <miguel@balena.io>
2020-05-04 10:49:09 -04:00
Cameron Diver
a43d71d1ac 📄 Upgrade knex to avoid CVE-2019-10757
Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2020-04-15 13:37:50 +01:00
Cameron Diver
37feb7e325 Move from dbus-native to dbus
Closes: #1049
Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2020-04-13 10:07:14 +01:00
Cameron Diver
c9c0e650cb Support matching on device type within contracts
Closes: #1191
Change-type: minor
Signed-off-by: Cameron Diver <cameron@balena.io>
2020-04-09 10:45:07 +01:00
Pagan Gazzard
a59af6abe8 Workaround a circular dependency
Change-type: patch
2020-04-08 17:40:39 +01:00
Pagan Gazzard
a2ec35456b Convert application-manager.coffee to javascript
Change-type: patch
2020-04-08 12:15:06 +01:00
Cameron Diver
0950b66c52 Allow spaces in volume definitions
Closes: #1247
Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2020-04-07 10:35:34 +01:00
Pagan Gazzard
81927d7861 Update to balena-register-device 6.0.1
Change-type: patch
2020-04-06 17:45:03 +01:00
Pagan Gazzard
d3221ca235 Convert test/18-startup.coffee to typescript
Change-type: patch
2020-04-02 14:25:26 +01:00
Pagan Gazzard
70b0705551 Convert test/19-compose-utils.coffee to javascript
Change-type: patch
2020-04-02 14:25:25 +01:00
Pagan Gazzard
98e956831a Convert test/18-compose-network.coffee to javascript
Change-type: patch
2020-04-02 14:25:24 +01:00
Pagan Gazzard
d3cf650ac4 Convert test/17-config-utils.spec.coffee to javascript
Change-type: patch
2020-04-02 14:25:23 +01:00
Pagan Gazzard
dcb01cb863 Convert test/16-ports.spec.coffee to typescript
Change-type: patch
2020-04-02 14:25:21 +01:00
Pagan Gazzard
515fb059f4 Convert test/15-conversions.spec.coffee to javascript
Change-type: patch
2020-03-31 16:38:07 +01:00
Pagan Gazzard
fd4cec31e7 Convert test/12-logger.spec.coffee to javascript
Change-type: patch
2020-03-31 16:25:57 +01:00
Cameron Diver
3af89cd13f Add BALENA_DEVICE_ARCH environment variable for containers
Closes: #1232
Change-type: minor
Signed-off-by: Cameron Diver <cameron@balena.io>
2020-03-30 16:40:02 +01:00
Pagan Gazzard
7e6d32516d Tests: Add missing await
Change-type: patch
2020-03-23 19:02:17 +00:00
Cameron Diver
5c50f656c3 Allow semver comparison on l4t versions in contracts
We add an implicit .0 to the end of l4t versions which do not fulfill
semver, which allows us to always match using comparison operators, such
as < and <=.

Change-type: minor
Signed-off-by: Cameron Diver <cameron@balena.io>
2020-03-06 15:54:04 +00:00
Rich Bayliss
e0d2bdfaa9
config: Support loading SSDT via ConfigFS
Change-type: patch
Signed-off-by: Rich Bayliss <rich@balena.io>
2020-03-05 13:30:06 +00:00
Cameron Diver
c21da8f3db
Convert device-state module to typescript
Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2020-02-25 14:50:21 +07:00
Ivan
f5c51be07d Add unit test to ensure journalctl process is spawned with expected
arguments.

Signed-off-by: Ivan <ivan@mish.guru>
2020-02-22 16:44:11 -07:00
Cameron Diver
426d8cd10a
Ensure that we always have the pi4 overlay assigned
Change-type: patch
Closes: #1171
Signed-off-by: Cameron Diver <cameron@balena.io>
2020-01-08 17:06:19 +00:00
Cameron Diver
6db1f03411
fix: ⬇️ Force a regular pull when moving from v2 to v3 deltas
Change-type: patch
Fixes: #1072
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-12-16 10:42:46 +00:00
Roman Mazur
d9c669ebad
Hide init method in configJson
ConfigJson users now don't need to worry about initialization.
It's done lazily on the first public method call.

Implementation is also rewritten to follow async/await pattern.

Change-type: patch
Signed-off-by: Roman Mazur <roman@balena.io>
2019-12-11 19:19:47 +02:00
Rich Bayliss
c3cf8fbca2
volumes: Allow the use of the 'driver' setting in volumes
A compose file can now contain a volume which uses a different driver
from the default one; local.

Change-type: patch
Signed-off-by: Rich Bayliss <rich@balena.io>
2019-12-02 11:59:44 +00:00
Roman Mazur
f487711ba4
Add regression test for app manager init
If we had it eearlier, it would have prevented #1148.
When init is called, withImagesFromDockerAndDB in images.ts is called as well.

Change-type: patch
Signed-off-by: Roman Mazur <roman@balena.io>
2019-11-27 13:51:15 +02:00
Cameron Diver
1a6c9d489a
Consider linux4tegra versions in container contracts
Also remove ability to match on OS versions

Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-11-27 10:22:35 +00:00
Theodor Gherzan
d6adfa189f
Do not polute test output with unncessarry stack trace
Signed-off-by: Theodor Gherzan <theodor@balena.io>
2019-11-19 09:48:56 +00:00
Theodor Gherzan
8589dbf3d1
Refactor code to use async/await syntax
Signed-off-by: Theodor Gherzan <theodor@balena.io>
2019-11-16 19:43:22 +00:00
Theodor Gherzan
54e9c2edd8
Run new prettier on code base
Signed-off-by: Theodor Gherzan <theodor@balena.io>
2019-11-15 14:51:24 +00:00
Cameron Diver
09a8231fde
Extract loadTargetFromFile function to preload module
Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-11-07 09:47:19 +00:00