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 <scott@balena.io>
This commit is contained in:
Scott Lowe 2020-04-01 12:39:30 +02:00
parent 77873cf919
commit d2fd1ec80a
2 changed files with 13 additions and 10 deletions

View File

@ -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). the balena Dockerfile pre-processor (e.g. Dockerfile.template -> Dockerfile).
This command will look into the given source directory (or the current working 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, directory if one isn't specified) for a docker-compose.yml file, and if found,
this command will build each service defined in the compose file. If a compose each service defined in the compose file will be built. If a compose file isn't
file isn't found, the command will look for a Dockerfile[.template] file (or found, it will look for a Dockerfile[.template] file (or alternative Dockerfile
alternative Dockerfile specified with the `-f` option), and if yet that isn't specified with the `--dockerfile` option), and if no dockerfile is found, it
found, it will try to generate one. will try to generate one.
The --registry-secrets option specifies a JSON or YAML file containing private The --registry-secrets option specifies a JSON or YAML file containing private
Docker registry usernames and passwords to be used when pulling base images. Docker registry usernames and passwords to be used when pulling base images.

View File

@ -77,11 +77,11 @@ module.exports =
the balena Dockerfile pre-processor (e.g. Dockerfile.template -> Dockerfile). the balena Dockerfile pre-processor (e.g. Dockerfile.template -> Dockerfile).
This command will look into the given source directory (or the current working 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, directory if one isn't specified) for a docker-compose.yml file, and if found,
this command will build each service defined in the compose file. If a compose each service defined in the compose file will be built. If a compose file isn't
file isn't found, the command will look for a Dockerfile[.template] file (or found, it will look for a Dockerfile[.template] file (or alternative Dockerfile
alternative Dockerfile specified with the `-f` option), and if yet that isn't specified with the `--dockerfile` option), and if no dockerfile is found, it
found, it will try to generate one. will try to generate one.
#{registrySecretsHelp} #{registrySecretsHelp}
@ -121,6 +121,7 @@ module.exports =
sdk = getBalenaSdk() sdk = getBalenaSdk()
{ ExpectedError } = require('../errors') { ExpectedError } = require('../errors')
{ checkLoggedIn } = require('../utils/patterns')
{ validateProjectDirectory } = require('../utils/compose_ts') { validateProjectDirectory } = require('../utils/compose_ts')
helpers = require('../utils/helpers') helpers = require('../utils/helpers')
Logger = require('../utils/logger') Logger = require('../utils/logger')
@ -141,6 +142,8 @@ module.exports =
Promise.try -> Promise.try ->
if (not (arch? and deviceType?) and not application?) or (application? and (arch? or deviceType?)) 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') throw new ExpectedError('You must specify either an application or an arch/deviceType pair to build for')
if (application)
checkLoggedIn()
.then -> .then ->
validateProjectDirectory(sdk, { validateProjectDirectory(sdk, {
dockerfilePath: options.dockerfile, dockerfilePath: options.dockerfile,