Commit Graph

3656 Commits

Author SHA1 Message Date
Felipe Lalanne
104a8006fb Update apiSecret table to id services by name
It adds a migration replacing the serviceId column by serviceName and
populates serviceNames from services in the target state.
2021-07-28 09:57:38 -04:00
Felipe Lalanne
50aab3ba78 Update tests removing dependency on db ids 2021-07-28 09:57:38 -04:00
Felipe Lalanne
b67f94802d Remove comparison based on image, release, and service ids
Preparing for the new v3 target state, where the supervisor will make environment
dependent ids optional and rely on using general UUIDs and user known identifiers
for comparison. This PR moves forward in that direction by removing some of those
comparisons for v2 target state.

- imageId to be replaced with imageName
- serviceId to be replace by serviceName
- releaseId to be replaced by commit (future release_uuid)

This is a backwards compatible change, meaning it doesn't completely get rid of
these identifiers (which are still being used by supervisor API and for state
patch), but will not depend on those identifiers for calculating steps to target state.

Change-type: minor
2021-07-28 09:57:38 -04:00
Felipe Lalanne
77070712a4 Remove image manager appUpdatePollInterval listener 2021-07-28 09:57:36 -04:00
Felipe Lalanne
a1d098d8f3 Refactor image "volatile state" to use state pattern
This replaces stored `volatileState` with a more declarative ImageTask API.
An ImageTask stores volatile image state for operations that cannot be
obtained through an engine query, such as fetching and removing an
image, state that can be updated while the task is running.

Image controller methods can now use the `reportEvent` method to create
and update the state of a longer running task.
2021-07-28 09:56:38 -04:00
Balena CI
06c3f488e5 v12.9.6 2021-07-26 17:05:14 +03:00
bulldozer-balena[bot]
51748c5f44
Merge pull request #1749 from balena-os/1616-old-images
Use tags instead of dockerIds to track supervised images in docker
2021-07-26 14:02:52 +00:00
Felipe Lalanne
f1bd4b8d9b Use tags to track supervised images in docker
The image manager module now uses tags instead of docker IDs as the main
way to identify docker images on the engine. That is, if the target
state image has a name `imageName:tag@digest`, the supervisor will always use
the given `imageName` and `tag` (which may be empty) to tag the image on
the engine after fetching. This PR also adds checkups to ensure
consistency is maintained between the database and the engine.

Using tags allows to simplify query and removal operations, since now
removing the image now means removing tags matching the image name.

Before this change the supervisor relied only on information in the
supervisor database, and used that to remove images by docker ID. However, the docker
id is not a reliable identifier, since images retain the same id between
releases or between services in the same release.

List of squashed commits
- Remove custom type NormalizedImageInfo
- Remove dependency on docker-toolbelt
- Use tags to traack supervised images in docker
- Ensure tag removal occurs in sequence
- Only save database image after download confirmed

Relates-to: #1616 #1579
Change-type: patch
2021-07-26 09:52:25 -04:00
Balena CI
19bcc6232b v12.9.5 2021-07-22 19:02:51 +03:00
bulldozer-balena[bot]
17d09b91ae
Merge pull request #1756 from balena-os/1755-delta-logs
Log the delta URL that will be downloaded on update
2021-07-22 16:00:16 +00:00
Felipe Lalanne
c05c5803f0 Log the delta URL that will be downloaded on update
Change-type: patch
Closes: #1755
2021-07-22 11:05:00 -04:00
Balena CI
f6774be127 v12.9.4 2021-07-08 22:26:09 +03:00
bulldozer-balena[bot]
a220b87804
Merge pull request #1745 from balena-os/db-helper-fix
Fix db-helper module for tests
2021-07-08 19:24:21 +00:00
Felipe Lalanne
357d1baf61 Fix db-helper module for tests
The previous module was using `rewire` to get the knex instance from the
db module but that was leading to issues when running tests using `test:fast`.
This provides a fix for the test module that just removes the destroy
call entirely (it turns out it is not necessary).

Change-type: patch
2021-07-08 14:43:13 -04:00
Balena CI
74ba1823c5 v12.9.3 2021-07-08 15:15:39 +03:00
bulldozer-balena[bot]
5334e93212
Merge pull request #1738 from balena-os/patch-hup-breadcrumbs-allow-force
Allow users to override HUP lock if device is stuck in invalid state
2021-07-08 12:13:25 +00:00
Christina Wang
17e740a4ba
Allow users to override HUP lock if device is stuck in invalid state
This functionality is needed when breadcrumbs aren't deleted after a HUP
rollback for whatever reason. Also rename HUP lock function.

Change-type: patch
Connects-to: #1459
Signed-off-by: Christina Wang <christina@balena.io>
2021-07-08 12:43:32 +09:00
Balena CI
3caf608158 v12.9.2 2021-07-07 16:54:35 +03:00
bulldozer-balena[bot]
1d10d324ca
Merge pull request #1736 from balena-os/override-lock-config-var
Point users to the configuration page for overriding update locks
2021-07-07 13:52:27 +00:00
Thodoris Greasidis
3e960f0f09 Point users to the configuration page for overriding update locks
Change-type: patch
See: https://jel.ly.fish/32cc2ee4-c5a7-4ec8-8e91-1ba4f1379bc4
See: https://www.flowdock.com/app/rulemotion/r-product/threads/9mk8QcdNp4UAwKeEUpXPHVxYM_c
Signed-off-by: Thodoris Greasidis thodoris@balena.io
Co-authored-by: Kyle Harding <kyle@balena.io>
2021-07-07 15:46:38 +03:00
Balena CI
3cdab68df5 v12.9.1 2021-07-06 03:51:12 +03:00
bulldozer-balena[bot]
5ad1917300
Merge pull request #1741 from balena-os/clarify-temp-action
Clarify that /v2/applications/:appId/stop-service is temporary
2021-07-06 00:49:09 +00:00
Miguel Casqueira
3bc3274001 Clarify that /v2/applications/:appId/stop-service is temporary
Change-type: patch
Signed-off-by: Miguel Casqueira <miguel@balena.io>
2021-07-05 19:25:04 -04:00
Balena CI
41e745ce85 v12.9.0 2021-07-06 01:50:32 +03:00
bulldozer-balena[bot]
cb76877c1a
Merge pull request #1696 from balena-os/compose-test-improvements
Improve testing for supervisor composition modules
2021-07-05 22:48:45 +00:00
Felipe Lalanne
e04e64763f Improve testing for supervisor composition modules
This PR cleans up testing for supervisor compose modules. It also fixes broken
tests for application manager and removes a lot of dependencies for those tests
on DB and other unnecessary mocks. There are probably a lot of cases that tests
are missing but this should make writing new tests a lot easier.

This PR also creates a new mock dockerode (mockerode) module that should make it
easier to test operations that interact with the engine. All references
to the old mock-dockerode have not yet been removed but that should come
soon in another PR

List of squashed commits:
- Add tests for network create/remove
- Move compose service tests to test/src/compose and reorganize test descriptions
- Add support for image creation to mockerode
- Add additional tests for compose volumes
- Update mockerode so unimplemented fake methods throw. This is to ensure
  tests using mockerode fail if an unimplemented method is used
- Update tests for volume-manager with mockerode
- Update tests for compose/images
- Simplify tests using mockerode
- Clean up compose/app tests
- Create application manager tests

Change-type: minor
2021-07-05 17:50:52 -04:00
Balena CI
5bd53db905 v12.8.12 2021-07-02 01:35:43 +03:00
bulldozer-balena[bot]
765275657c
Merge pull request #1731 from balena-os/dependabot/npm_and_yarn/color-string-1.5.5
Bump color-string from 1.5.3 to 1.5.5
2021-07-01 22:33:57 +00:00
dependabot[bot]
4518c93fca Bump color-string from 1.5.3 to 1.5.5
Bumps [color-string](https://github.com/Qix-/color-string) from 1.5.3 to 1.5.5.
- [Release notes](https://github.com/Qix-/color-string/releases)
- [Changelog](https://github.com/Qix-/color-string/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Qix-/color-string/commits/1.5.5)

---
updated-dependencies:
- dependency-name: color-string
  dependency-type: indirect
...

Change-type: patch
Signed-off-by: dependabot[bot] <support@github.com>
2021-07-01 18:27:22 -04:00
Balena CI
71555f7a4d v12.8.11 2021-06-30 18:42:56 +03:00
bulldozer-balena[bot]
b05493d9ad
Merge pull request #1734 from balena-os/remove-codeowners
Remove codeowners file
2021-06-30 15:39:51 +00:00
Miguel Casqueira
3d4c720d0b Remove codeowners file
Change-type: patch
Signed-off-by: Miguel Casqueira <miguel@balena.io>
2021-06-30 11:31:50 -04:00
Balena CI
b397ccef35 v12.8.10 2021-06-30 08:12:20 +03:00
bulldozer-balena[bot]
a53f584049
Merge pull request #1723 from balena-os/1459-lock-while-hup-breadcrumbs
Prevent updates/reboots with locks when HUP breadcrumbs present
2021-06-30 05:08:47 +00:00
Christina Wang
a9028e58ec
Prevent updates/reboots with locks when HUP breadcrumbs present
On HUP, some healthceck services need to complete before
it's safe for the Supervisor to reboot the device when
applying state changes. rollback-{health|altboot}-breadcrumb
are the two files that Supervisor looks for and locks the device
on when present in this patch.

Not closing issue 1459 because there is a possible case where,
on altboot rollback, the breadcrumbs are not present. 1459
may be closed when this edge case is investigated.

Change-type: patch
Connects-to: #1459
See: https://www.flowdock.com/app/rulemotion/r-supervisor/threads/cL7YfNOLSfTPfw05h59GEW0kfOt
Signed-off-by: Christina Wang <christina@balena.io>
2021-06-30 13:27:03 +09:00
Balena CI
5223262557 v12.8.9 2021-06-29 08:36:50 +03:00
bulldozer-balena[bot]
168f5df2dd
Merge pull request #1730 from balena-os/wrong-delta-source
Fix supervisor using wrong source for deltas
2021-06-29 05:35:08 +00:00
Felipe Lalanne
2fa0d3dc43 Fix supervisor using wrong source for deltas
This fixes a specific issue when the supervisor cannot find the right
source for deltas (e.g. after the DB gets deleted), where legacy
behavior was to look for any image in the app.

Change-type: patch
Relates-to: #1729
2021-06-25 16:24:51 -04:00
Balena CI
cacbcfd2b1 v12.8.8 2021-06-18 15:15:45 +03:00
bulldozer-balena[bot]
1bfcd6b791
Merge pull request #1725 from balena-os/add_revpi_boards_to_raspberrypi_variants
Add revpi-connect, revpi-core-3 to Raspberry Pi variants
2021-06-18 12:13:52 +00:00
Florin Sarbu
7c26480ada
Add revpi-connect, revpi-core-3 to Raspberry Pi variants
We need the supervisor to be able to manage config.txt changes for these
Revolution Pi boards too.

Change-type: patch
Signed-off-by: Florin Sarbu <florin@balena.io>
2021-06-18 20:33:27 +09:00
Balena CI
5486a74b82 v12.8.7 2021-06-14 14:15:43 +03:00
bulldozer-balena[bot]
ac957c07a7
Merge pull request #1722 from balena-os/dependabot/npm_and_yarn/normalize-url-4.5.1
Bump normalize-url from 4.5.0 to 4.5.1
2021-06-14 11:11:06 +00:00
dependabot[bot]
ece3be6d45
Bump normalize-url from 4.5.0 to 4.5.1
Bumps [normalize-url](https://github.com/sindresorhus/normalize-url) from 4.5.0 to 4.5.1.
- [Release notes](https://github.com/sindresorhus/normalize-url/releases)
- [Commits](https://github.com/sindresorhus/normalize-url/commits)

---
updated-dependencies:
- dependency-name: normalize-url
  dependency-type: indirect
...

Change-type: patch
Signed-off-by: dependabot[bot] <support@github.com>
2021-06-14 19:24:08 +09:00
Balena CI
3974aacdc7 v12.8.6 2021-06-14 13:18:55 +03:00
bulldozer-balena[bot]
aea770ebe8
Merge pull request #1721 from balena-os/firewall-documentation
Document the current state of HOST_FIREWALL_MODE
2021-06-14 10:16:48 +00:00
Christina Wang
3961fbf1e7
Document the current state of HOST_FIREWALL_MODE
This set of docs can provide info for support agents until
issue 1482 is resolved. Expect this document to change as firewall
implementation is improved.

Connects-to: #1482
Connects-to: #1525
Change-type: patch
Signed-off-by: Christina Wang <christina@balena.io>
2021-06-09 16:56:17 +09:00
Balena CI
7db799efa4 v12.8.5 2021-06-08 23:02:15 +03:00
bulldozer-balena[bot]
f5382be077
Merge pull request #1720 from balena-os/device-state-typings
Improve target state typings
2021-06-08 20:00:29 +00:00
Pagan Gazzard
ee4d919fca Improve target state typings
Change-type: patch
2021-06-08 13:45:44 +01:00