Also fix livepush logging when a new container is created (previously
the logs of the commands would stop working after this has happened)
Change-type: minor
Signed-off-by: Cameron Diver <cameron@balena.io>
Both the tunnel and SSH commands require a full UUID for an online
device. A single code path was added to provide this, taking either
an application name or a partial UUID as a search parameter.
In the event of an application name being provided, a device select
form is presented to the user to pick from the online devices at that
time.
Change-type: patch
Signed-off-by: Rich Bayliss <rich@balena.io>
zero in device UUID).
This commit is fairly chunky because it adds the oclif dependency for
the first time, and refactors the CLI help and docs generation code to
accommodate both Capitano and oclif.
Change-type: patch
Signed-off-by: Paulo Castro <paulo@balena.io>
Also append the QEMU version to the locally cached copy, so the
CLI can correctly bump version whenever QEMU_VERSION is bumped
in the future.
Change-type: minor
Signed-off-by: Gergely Imreh <gergely@balena.io>
the installation instructions to INSTALL.md, and update the markdown
generation scripts.
Change-type: minor
Signed-off-by: Paulo Castro <paulo@balena.io>
Now if you pass both --live and --detached, the logs won't be displayed
but livepush will continue to run.
Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
It allows the selection of an alternative Dockerfile in single-
container projects that do not include a docker-compose file.
Change-type: minor
Signed-off-by: Paulo Castro <paulo@balena.io>
The new resin-multibuild and docker-progress versions widen the range
of errors caught by the 'balena push' and 'balena build' commands.
Change-type: patch
Signed-off-by: Paulo Castro <paulo@balena.io>
This allows a user to easily use the tunneling service
to open connections into their balena-managed devices.
Signed-off-by: Rich Bayliss <rich@balena.io>
Change-type: patch
This access is used to cross mount the old layers, rather than
reuploading the layers each time.
Connects-to: #1045
Change-type: minor
Signed-off-by: Matthew McGinn <mamcgi@gmail.com>
`version` used to be optional but it seems we recently had to make it a required parameter. However it really feels redundant when all it’s used for is to determine whether the command should issue a legacy user API key or a provisioning key.
This makes version optional but tries to figure it out by itself by reading os-release from the image's boot partition. This is not foul-proof however, and while it'll work with most recent images it won't work with all and in that case it'll bail out and only then warn the user to specify it via the --version argument.
Change-type: minor
When building with emulation mode enabled, this downloads the version of qemu
appropriate to the architecture of the project (either arm or aarch64).
Change-type: minor
These files are not supported by any other part of the resin
infrastructure, and it could cause confusion with it not being
supported everywhere. The idea was originally added because we
thought we might need to make extensions on docker-compose, but
that hasn't happened.
Change-type: major
Signed-off-by: Cameron Diver <cameron@resin.io>
This commit brings in the ignore and dockerignore libraries, which when
provided with the patterns in the aforementioned files will ignore them.
Change-type: major
Closes: 889
Signed-off-by: Cameron Diver <cameron@resin.io>
The push command was relying on the output from the builder to indicate
the build status, but this isn't helpful for CI. This commit makes the
remote build module respect the `isError` flag which the builder sends
in any errors. Any errors which come from the builder indicate the
release will not be deployed.
Change-type: patch
Signed-off-by: Cameron Diver <cameron@resin.io>
If for whatever reason resin-image-fs is not importable — eg. if it’s built for another arch — any command that imports `helpers.ts` will just quit without any error/traceback.
Both commands work with local devices by remotely invoking the `os-config` executable via SSH. This requires an as of yet unreleased resinOS (that will most likely be v2.14) and the commands ascertain compatibility merely by looking for the `os-config` executable in the device, and bail out if it’s not present.
`join` and `leave` accept a couple of optional arguments and implement a wizard-style interface if these are not given. They allow to interactively select the device and the application to promote to. If the user has no apps, `join` will offer the user to create one. `join` will also offer the user to login or create an account if they’re not logged in already without exiting the wizard.
`resin-sync` (that's used internally to discover local devices) requires admin privileges. If no device has been specified as an argument, the commands will launch the device scanning process in a privileged subprocess via two new internal commands: `internal sudo` and `internal scanDevices`. This avoids having the user to invoke the commands with sudo and only request escalation if truly needed. This commit also removes the dependency to “president”, implementing “sudo” functionality within the CLI.
Change-Type: minor
This doesn't fix actual usage of image fs, just makes it possible to
stop commands that don't use it from failing entirely.
Connects-To: #869
Change-Type: patch
This mostly reverts the removal of the legacy deploy code that pushed image tars via the builder. It’s needed for users to avoid having to switch between CLI versions in order to push to legacy apps as well.
Note: this pins resin-sdk to 9.0.0-beta14 as I couldn’t get it to install otherwise — npm would always install 9.0.0-beta9 instead.
Change-Type: minor
This makes sure build logs don’t leak escape sequences and new lines and they don’t break the output. Also improved “inline” logs by normalising the stream before passing it to “transpose build stream”.
Fixes: #808
Change-Type: patch
Legacy behaviour is mostly retained. The most notable change in behaviour is that invoking `resin deploy` without options is now allowed (see help string how it behaves).
In this commit there are also the following notable changes:
- Deploy/Build are promoted to primary commands
- Extracts QEMU-related code to a new file
- Adds a utility file to retrieve the CLI version and its parts
- Adds a helper that can be used to manipulate display on capable clients
- Declares several new dependencies. Most are already indirectly installed via some dependency
Change-Type: minor
New version is 3.1.0.
The updated version is not backwards compatible as it removes all *Async methods that are in wide use in the CLI. The workaround for now is to manually promisify the client and replace all `new Docker()` calls with a shared function that returns a promisified client.
There are very few plugins in real-world use, we're not actively working
on this at all, and the current approach won't work once we move to
standalone node-less binary installation anyway.
Change-Type: major
* require('resin-sdk') => multicontainer SDK
* require('resin-sdk-preconfigured') => 6.15.0 SDK
* all 'resin-sdk' requires replaced with 'resin-sdk-preconfigured'
* resin-sdk-preconfigured TS typings are copy pasted from the current resin-sdk master
The idea is to progressively replace all 'resin-sdk-preconfigured'
requires with 'resin-sdk' (multicontainer sdk) and eventually remove
resin-sdk-preconfigured from package.json.
Change-Type: patch
Before this commit, the docker daemon would recieve the filename of the
.pem files, which would be interpreted as the body and would fail. This
commit ensures that the actual body of the pem files are sent to the
daemon.
Change-type: patch
Connects-to: #562
Signed-off-by: Cameron Diver <cameron@resin.io>
This commit adds the ability to run a Docker build for an architecture
which is not the host architecture, using qemu-linux-user. Currently
this is only supported for linux.
Added:
* Installation of qemu which supports propagated execve flags
* Copying of qemu binary into the build context
* Transposing the given Dockerfile to use the qemu binary
* Intercepting of the build stream, so the output looks *almost* exactly
the same.
Change-type: minor
Signed-off-by: Cameron Diver <cameron@resin.io>
This gives the user enough notice to stay well updated, but won't spam
them if they're using resin-cli frequently.
Connects-to: #485
Change-type: patch
Signed-off-by: Cameron Diver <cameron@resin.io>
This commit will highlight the usage of the cache when doing a docker
build via `resin build`, which not only helps the user understand what
the build is doing, but also achieves more parity with the cloud
builder.
Change-type: patch
Signed-off-by: Cameron Diver <cameron@resin.io>
If build is ran through `resin deploy`, then logs will be stored and
uploaded to the database, where the dashboard can display them
Change-type: minor
Signed-off-by: Cameron Diver <cameron@resin.io>
`resin build` had access to the `--nocache` and `--tag` options for
building with docker, but `resin deploy` did not. This commit adds the
options to the shared dockerUtils.appendOptions function.
Change-type: patch
Signed-off-by: Cameron Diver <cameron@resin.io>
Upon changing the name of the source parameter from `context`, some
places weren't changed, this commit fixes that.
Change-type: patch
Signed-off-by: Cameron Diver <cameron@resin.io>
Using `resin build` a user can now build an image on their own docker
daemon. The daemon can be accessed via a local socket, a remote host and
a remote host over a TLS socket. Project type resolution is supported.
Nocache and tagging of images is also supported.
Using `resin deploy` a user can now deploy an image to their fleet. The
image can either be built by `resin-cli`, plain Docker, or from a remote
source.
Change-type: minor
Signed-off-by: Cameron Diver <cameron@resin.io>
New images will ship a `device-type.json` file in the first partition,
which we can use instead of querying the API for certain configuration
and initialisation commands.
If the file is not found, or is malformed, we still fallback to the API.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
This PR adds functionality to `resin sync` to try to infer what the
device uuid is as follows:
- If the argument to `resin sync` is an app, get all the devices from
that application. If there is only one, auto-select it, otherwise show
an interactive drive selection widget.
- If the argument to `resin sync` is a uuid, use it directly, without
trying to infer anything.
- If no argument is passed to `resin sync`, display an interactive
selection widget showing all your devices from all your applications.
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
Currently, such error will be thrown when
`resin.auth.twoFactor.challenge()` rejects, but an invalid code is not
the only thing this function can reject for.
If `updateCheckInterval` has any meanginful value, the alert will be
shown one out of ten times, or something like that, making the user
likely to miss updates.
The underlying issue is that `update-notifier`, if it detects a cached
update notification, it deletes it, and only attempts to show it back if
`updateCheckInterval` is greater than `Date.now() - lastUpdateCheck`.
Some CLI commans prompt to select an existing application, presending a
dropdown with all the application names, however it's hard to remember
which application belon to which device type, which makes it easier to
select the wrong application.
The last part of `quickstart` feels weird. By consensus, we remove the
part that attempts to create a project directory and leave that step to
the user.
We get a weird error message from pine otherwise:
ResinRequestError: Request error: It is necessary that each app name
that is of a user (Auth), has a Length (Type) that is greater than or
equal to 4.
Current has the following problems:
- Our custom message gets printed even if the notifier doesn't contain
an update.
- The notifier box is deferred, therefore it's printed at the end of the
command. Since our custom message is printed at the beginning, it makes
no sense at all.
If the spinner message doesn't fit in your terminal, each spinner
position will be printed in different lines.
We mitigate this by dramatically shortenning the message.
Currently, the fact that `os initialize` requires elevated permissions
forced us to require calling commands that reuse it, such as `device
init` and `quickstart` with administrator permissions as well.
This ended up causing issues like saving images in the cache that belong
to root, or initializing git repositories that requires `sudo` to
commit.
The solution is to call `os initialize` as a child process preppending
`sudo` within `device init`.
Fixes: https://github.com/resin-io/resin-cli/issues/109
Currently, if `device init` was ran without an application argument, we
attempted to get the application name from the current directory, given
it was a git repository.
This approach led to confusions from time to time, so now we prompt the
user to select one of it's own applications from a dropdown instead of
checking the current directory in this edge case.
Fixes: https://github.com/resin-io/resin-cli/issues/197
`update-notifier` persist its update check results in a file, which is
then read when running again the application.
If this file gets written when the application is being run as root, we
get ugly EPERM issues.
For this we use the `update-notifier` module with its default settings.
This module will print a nice banner prompting the user to run the
corresponding npm command to update.
- Add helpers.confirm() to abstract the process of asking for
confirmation.
- Add helpers.selectDeviceType() to abstract the form needed to ask for
device types.
The functions on this module are reused by app actions.