From d2fd1ec80a3aa9081489a4bfbdc6c97aceb9b23b Mon Sep 17 00:00:00 2001 From: Scott Lowe Date: Wed, 1 Apr 2020 12:39:30 +0200 Subject: [PATCH] Check logged in for `balena build` if application specified Correct eroneous -f flag in `balena build` help Change-type: patch Signed-off-by: Scott Lowe --- doc/cli.markdown | 10 +++++----- lib/actions/build.coffee | 13 ++++++++----- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/doc/cli.markdown b/doc/cli.markdown index 11348aaa..cb27e68d 100644 --- a/doc/cli.markdown +++ b/doc/cli.markdown @@ -1888,11 +1888,11 @@ You must provide either an application or a device-type/architecture pair to use the balena Dockerfile pre-processor (e.g. Dockerfile.template -> Dockerfile). This command will look into the given source directory (or the current working -directory if one isn't specified) for a docker-compose.yml file. If it is found, -this command will build each service defined in the compose file. If a compose -file isn't found, the command will look for a Dockerfile[.template] file (or -alternative Dockerfile specified with the `-f` option), and if yet that isn't -found, it will try to generate one. +directory if one isn't specified) for a docker-compose.yml file, and if found, +each service defined in the compose file will be built. If a compose file isn't +found, it will look for a Dockerfile[.template] file (or alternative Dockerfile +specified with the `--dockerfile` option), and if no dockerfile is found, it +will try to generate one. The --registry-secrets option specifies a JSON or YAML file containing private Docker registry usernames and passwords to be used when pulling base images. diff --git a/lib/actions/build.coffee b/lib/actions/build.coffee index 50ca18d8..f34f82b7 100644 --- a/lib/actions/build.coffee +++ b/lib/actions/build.coffee @@ -77,11 +77,11 @@ module.exports = the balena Dockerfile pre-processor (e.g. Dockerfile.template -> Dockerfile). This command will look into the given source directory (or the current working - directory if one isn't specified) for a docker-compose.yml file. If it is found, - this command will build each service defined in the compose file. If a compose - file isn't found, the command will look for a Dockerfile[.template] file (or - alternative Dockerfile specified with the `-f` option), and if yet that isn't - found, it will try to generate one. + directory if one isn't specified) for a docker-compose.yml file, and if found, + each service defined in the compose file will be built. If a compose file isn't + found, it will look for a Dockerfile[.template] file (or alternative Dockerfile + specified with the `--dockerfile` option), and if no dockerfile is found, it + will try to generate one. #{registrySecretsHelp} @@ -121,6 +121,7 @@ module.exports = sdk = getBalenaSdk() { ExpectedError } = require('../errors') + { checkLoggedIn } = require('../utils/patterns') { validateProjectDirectory } = require('../utils/compose_ts') helpers = require('../utils/helpers') Logger = require('../utils/logger') @@ -141,6 +142,8 @@ module.exports = Promise.try -> if (not (arch? and deviceType?) and not application?) or (application? and (arch? or deviceType?)) throw new ExpectedError('You must specify either an application or an arch/deviceType pair to build for') + if (application) + checkLoggedIn() .then -> validateProjectDirectory(sdk, { dockerfilePath: options.dockerfile,