We mark when the device is rebooting and avoid some steps in the update cycle that change the device
state, similarly to when the device is in local mode, to avoid problems with non-atomic operations.
This doesn't solve *all* the potential scenarios of a reboot happening in the middle of an update, but at least
should prevent the case where we start an app container and reboot the device before saving the containerId, potentially
causing a duplicated container issue.
We also correct the API docs to reflect the 202 response when reboot or shutdown are successful.
Change-Type: patch
Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
We used to store the uuid which would cause the supervisor to not attempt a provisioning even if offline mode
was turned off. This was to avoid preloaded apps being reloaded constantly leaving multiple containers.
We now avoid persisting the uuid, so that when the supervisor goes out of offline mode it can provision
without the need to wipe out the db. We avoid the problem with preloaded apps by not loading them
if there's apps already stored on the db.
(In the future, apps in the db will only represent target state and we can make preloaded apps be reloaded on every
start, but for now we can't do it as long as we store the containerId on the db - deleting an app on the db
means losing track of its containerId and therefore leaving an orphaned container)
Change-Type: patch
Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
This makes the Async suffix for docker functions unnecessary. It also allows us to remove dockerode as an
explicit dependency.
Change-Type: minor
Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
We now remove the quotes from the image name in the ExecStartPre of the supervisor dind service,
so that the images are properly pulled.
We also fix the parsing of arguments in dindctl so that it correctly parses all of the arguments (the last one was being missed if it didn't have a parameter).
Change-Type: patch
Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
The test for an exec format error caused a `err.json.trim` is not a function
error so the message shown didn't relate to what the problem actually was.
This makes the test for the exec format error safer.
Change-Type: patch
Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
Up to now, a new debian:jessie build would invalidate the cache for the base and gosuper images, slowing down Circle builds.
Change-Type: patch
Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
We should revisit this if we want to later copy those folders into the host and use Circle's caching system with them, or if https://github.com/moby/moby/issues/32507 gets implemented in which case we can use a bind mounted folder instead.
Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
Otherwise the step where we build them doesn't reuse what was built when building the supervisor,
because we're explicitly setting `--cache-from` options.
We also push the images as soon as they're built.
Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
Also, avoid building the dind builder twice, and try to get a reusable docker instance.
Change-Type: patch
Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
This makes it easier to use, as it's meant to be used constantly when developing. No need to change PATH
or type `./tools/dev/dindctl`, just run `./dindctl` now.
Change-Type: patch
Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
We change the Makefile and dinctl so that instead of having to deploy and then pull a supervisor image, we save it from the local
docker images and load it inside the dind container.
We also fix dind so that it uses the dind hack script from the docker repo as official dind images do (this avoids breaking the
permissions of /dev/pts/ptmx in the host as in https://github.com/kubernetes/kubernetes/issues/18230).
Change-Type: patch
Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
The current setup would cause the check to always fail - the consequence is not *that* bad since
the provisioning key still gets overwritten, but it's better to delete it if we can.
Change-Type: patch
Signed-off-by: Pablo Carranza Velez <pablo@resin.io>