Commit Graph

4033 Commits

Author SHA1 Message Date
bulldozer-balena[bot]
13195050fd
Merge pull request #2010 from balena-os/flowzone
Switch from balenaCI to flowzone
2022-09-14 20:27:40 +00:00
Pagan Gazzard
dff4da28c9 Specify job name for flowzone branch protections 2022-09-14 21:03:37 +01:00
Felipe Lalanne
1586b7a424 Enable branch protection 2022-09-14 13:21:25 -03:00
Christina Ying Wang
aad0d1f45e Clarify Flowzone job names
Signed-off-by: Christina Ying Wang <christina@balena.io>
2022-09-14 13:21:03 -03:00
Christina Ying Wang
efc04296ce Add staging environment workflow
Signed-off-by: Christina Ying Wang <christina@balena.io>
2022-09-14 12:22:14 -03:00
Christina Ying Wang
7788180df3 Rename Dockerfile.null to Dockerfile
The Docker Flowzone CI job currently only runs successfully
with `Dockerfile` and not any variants, by design.

Signed-off-by: Christina Ying Wang <christina@balena.io>
2022-09-14 12:22:14 -03:00
Christina Ying Wang
82b4a7fe1e Modify npm scripts for Flowzone
Replace test with test:base to make sure integration tests don't run in CI.
Integration tests for the Supervisor fail when not run in container, leading
to an error-exit and cause the Flowzone CI job for Node to fail.

By returning true, the Flowzone Node CI job succeeds, and this is fine even if tests
fail because they will be caught in the Docker job anyway.

Also, combine original npm test script with test:node.

Signed-off-by: Christina Ying Wang <christina@balena.io>
2022-09-14 12:22:14 -03:00
Christina Ying Wang
728724ce46 Remove balena-ci.yml and add balenaCloud slugs
Signed-off-by: Christina Ying Wang <christina@balena.io>
2022-09-14 12:22:14 -03:00
Christina Ying Wang
670b9ff563 Automate dbus lib installation depending on system
Signed-off-by: Christina Ying Wang <christina@balena.io>
2022-09-14 12:22:14 -03:00
Pagan Gazzard
044fa5a038 Switch from balenaCI to flowzone
Change-type: patch
2022-09-14 12:22:14 -03:00
Balena CI
86aece8d29 v14.0.22 2022-09-14 11:19:10 -04:00
bulldozer-balena[bot]
ba9beef1cf
Merge pull request #2015 from balena-os/only-install-running-false
Only install service if running is set to false
2022-09-14 15:16:52 +00:00
Felipe Lalanne
f7bc30a310 Remove unnecessary check for docker status code 2022-09-14 10:41:32 -03:00
Felipe Lalanne
c6f911c36b Only install service if running is set to false
The supervisor supports target state `running: false` for services.
This state indicates that the service should be stopped if already
running, or that the container should just be created and never started
if the container does not exist. This commit fixes the latter behavior.

Although nothing in our platform currently sends this target state, this
enables some potential use cases, e.g. only starting some services
in manufacturing and starting the rest of the services when the device
actually connects.

Change-type: patch
Closes: #2014
2022-09-14 10:15:51 -03:00
Balena CI
2ec9274b78 v14.0.21 2022-09-13 16:43:37 -04:00
bulldozer-balena[bot]
9160a8b269
Merge pull request #2013 from balena-os/running-false-target
Fix withDefault type helper to work with boolean
2022-09-13 20:40:55 +00:00
Felipe Lalanne
3e45e9561e Fix withDefault type helper to work with boolean
`withDefault` is a type helper that allows to create a type that
defaults to a default value when trying to decode a nullish value.
That type was not correctly working with boolean types, causing `false`
values to be replaced by true. This would specifically cause issues when
parsing the target state, where a `running: false` in a service would
become a `running: true` due to the type decoding.

Change-type: patch
2022-09-13 20:08:32 +00:00
Balena CI
efa400c5a6 v14.0.20 2022-09-13 16:07:08 -04:00
bulldozer-balena[bot]
b27f6e7dda
Merge pull request #2012 from balena-os/supervisor-filter
Fix filtering of the supervisor app on the target state
2022-09-13 20:05:04 +00:00
Felipe Lalanne
5a57647450 Fix filtering of the supervisor app on the target state
Under some conditions, an aarch64 device may get a reference to a armv7hf
supervisor on the target state. One of the ways this can happen is if
an aarch64 device is added to an armv7hf fleet and the target supervisor
is set before the device fully provisions.

If that happens, the previous filtering for the supervisor app (which
relied on the architecture in device-type.json) would
fail and the user would end up with two supervisor containers, one
running correctly and the other crash looping.

This fixes the filtering and just checks if the supervisor uuid/service
name belongs to a group of known uuids.

Closes: #2006
Change-type: patch
2022-09-12 16:28:22 -03:00
Balena CI
39cf98243f v14.0.19 2022-09-12 08:17:51 -04:00
bulldozer-balena[bot]
64380003d3
Merge pull request #2009 from balena-os/update-blinking
Update blinking to 0.0.5
2022-09-12 12:16:11 +00:00
Pagan Gazzard
45f71b38d0 Update blinking to 0.0.5
Change-type: patch
2022-09-12 13:01:32 +01:00
Balena CI
7d2df0646e v14.0.18 2022-09-07 11:53:28 -04:00
bulldozer-balena[bot]
63840648a3
Merge pull request #2004 from balena-os/use-es-version
Set desired es-version for downstream modules that support it
2022-09-07 15:47:07 +00:00
Thodoris Greasidis
725a1c9156 Update & deduplicate pinejs-client-request to 7.3.5
Update pinejs-client-request from 7.2.1 to 7.3.5
2022-09-07 17:09:19 +03:00
Thodoris Greasidis
fadd514463 Set desired es-version for downstream modules that support it
Change-type: patch
2022-09-07 17:07:16 +03:00
Balena CI
42dd4f75ac v14.0.17 2022-09-06 21:05:01 -04:00
bulldozer-balena[bot]
5b0438ae49
Merge pull request #2003 from balena-os/module-side-effects
Remove side effects for module imports
2022-09-07 01:03:17 +00:00
Felipe Lalanne
48e0733c7e Remove side effects for module imports
The supervisor uses the following pattern for async module
initialization

```typescript
// module.ts

export const initialised = (async () => {
    // do some async initialization
})();

// somewhere else
import * as module from 'module';

async function setup() {
  await module.initialise;
}
```

The above pattern means that whenever the module is imported, the
initialisation procedure will be ran, which is an anti-pattern.

This converts any instance of this pattern into a function

```typescript
export const initialised = _.once(async () => {
    // do some async initialization
});
```

And anywhere else on the code it replaces the call with a

```typescript
await module.initialised();
```

Change-type: patch
2022-09-06 15:48:18 -04:00
Balena CI
6b36ccfddf v14.0.16 2022-09-06 13:48:02 -04:00
bulldozer-balena[bot]
5b7831f0c9
Merge pull request #2002 from balena-os/add_imx8mm_var_som
Add custom DTB support for imx8mm-var-som
2022-09-06 17:46:17 +00:00
Alexandru Costache
36544b7d6e Add custom DTB support for imx8mm-var-som
Change-type: patch
Signed-off-by: Alexandru Costache <alexandru@balena.io>
2022-09-06 16:33:35 +02:00
Balena CI
ba66b10c0e v14.0.15 2022-08-24 17:33:20 -04:00
bulldozer-balena[bot]
222c097d4b
Merge pull request #1997 from balena-os/unit-integr
Split test suite into unit and integration tests
2022-08-24 21:30:37 +00:00
Felipe Lalanne
e0e1eacc6e Migrate lockfile tests to testfs
Since tests are ran in a container, lockfile tests no longer need to
mock the behavior of the `lockfile` binary.
2022-08-24 16:07:25 -04:00
Felipe Lalanne
6d004f0994 Setup docker-compose.test
This allows to run integration tests during development and on CI
with the right dependencies. There are several changes that this
involves, but the gist of it is that a test environment is setup using
`docker-compose.test.yml`. This file is loaded by `resin-ci` during the
build, and ensures that integration tests are ran after setting up all
requirements. This commit also defines a test environment command that
can be setup using `npm run test:env` in order to run tests in a local
development machine.
2022-08-24 16:07:20 -04:00
Felipe Lalanne
ba51ca5fc0 Add mocha-pod for running integration tests
This ensure that whenever integration tests are ran, they
are executed in a containerized environment.
2022-08-24 14:29:17 -04:00
Felipe Lalanne
44f3e9ccdb Add command to spawn a development environment
For development, now doing `npm run dev` will spawn containers with the
necessary dependencies for developing and testing the supervisor.
2022-08-24 14:29:17 -04:00
Felipe Lalanne
c1e6dadeb4 Create test/unit and test/integration folders
This sets up the new `test/unit` and `test/integration` folders
and starts classification of some of the test files.

Note that unit tests include, `fs-utils` and `system-info` tests.

While these tests interact with the filesystem, the implementation
of these modules is simple enough, and the tests are fast enough to
allow these tests to fall under the `unit` test category (according to
test/README)

Change-type: patch
2022-08-24 14:28:36 -04:00
Felipe Lalanne
e1e35eb83b Move the current test suite under test/legacy
We are refactoring the supervisor test suite into unit tests (for
algorithms an domain model tests) and integration
tests (for interaction with out-of-process dependencies).
This means the current test suite needs to be classified into
these two categories, and fixed whenever possible.

This commit moves the test suite under the `test/legacy` folder, this
folder should be progressively migrated and eventually removed.
Subsequent commits will begin to split these files into unit and
integration whenever possible.

Depends-on: #1996
Change-type: patch
2022-08-22 17:21:51 -04:00
Balena CI
0d42ec5698 v14.0.14 2022-08-23 00:02:38 +03:00
bulldozer-balena[bot]
b092fa9cb0
Merge pull request #1996 from balena-os/test-in-docker
Refactor test suite to use tsconfig paths instead of relative paths
2022-08-22 21:00:05 +00:00
Felipe Lalanne
c9667f81f0 Update README 2022-08-22 16:22:11 -04:00
Felipe Lalanne
382cdb0cfa Refactor test suite to use tsconfig paths
This replaces all relative paths in the test suite  (e.g
`../src/compose/service.ts`) with the aliased path configured through
tsconfig.

This is a big change but it doesn't affect any functionality
2022-08-18 13:05:10 -04:00
Felipe Lalanne
71eaa3327e Use tsconfig-paths for easier access to the source
Currently, tests only can import source code modules through relative
paths `../../`. This makes it very difficult to refactor and organize
tests in folders as the paths change.

[tsconfig-paths](https://www.npmjs.com/package/tsconfig-paths) allows to
reference the source through an alias defined in the "paths" section of
tsconfig.json
2022-08-18 12:23:31 -04:00
Felipe Lalanne
1439ee30f2 Move sinon to dev dependencies
Sinon was added to the production dependencies by mistake in a previous
build. This is a module only used for testing so this fixes that error.
2022-08-18 12:23:31 -04:00
Felipe Lalanne
274503feb3 Simplify test commands in package.json
The supervisor used to perform tests both for the transpiled code (after
tsc) and one for the typescript code (using
ts-node/register/transpile-only). There is not really a reason for this
and this added complexity to the test configuration. This used to make
testing harder, as the built code didn't include source maps, meaning
the tests did not point to the right code.

Since we want to split tests in unit and integration tests as the next
test improvement, it makes sense to simplify these commands before
adding more complexity.

Change-type: patch
2022-08-18 12:23:20 -04:00
Balena CI
d83a37e6fd v14.0.13 2022-08-03 02:59:36 +04:00
bulldozer-balena[bot]
1c7110badb
Merge pull request #1992 from balena-os/1991-wait-for-stopping-services-in-funnel
Wait for Stopping services to stop before target apply success
2022-08-02 22:57:43 +00:00