Fix project directory validation for 'balena deploy' with pre-built image

Change-type: patch
This commit is contained in:
Paulo Castro 2020-04-02 19:44:27 +01:00
parent ff319d67f3
commit 96e28f3d45

View File

@ -198,7 +198,7 @@ module.exports =
require('events').defaultMaxListeners = 1000
sdk = getBalenaSdk()
{ ExpectedError } = require('../errors')
{ validateProjectDirectory } = require('../utils/compose_ts')
{ getRegistrySecrets, validateProjectDirectory } = require('../utils/compose_ts')
helpers = require('../utils/helpers')
Logger = require('../utils/logger')
@ -225,6 +225,11 @@ module.exports =
if image? and options.build
throw new ExpectedError('Build option is not applicable when specifying an image')
.then ->
if image
getRegistrySecrets(sdk, options['registry-secrets'])
.then (registrySecrets) ->
options['registry-secrets'] = registrySecrets
else
validateProjectDirectory(sdk, {
dockerfilePath: options.dockerfile,
noParentCheck: options['noparent-check'] || false,
@ -234,7 +239,7 @@ module.exports =
.then ({ dockerfilePath, registrySecrets }) ->
options.dockerfile = dockerfilePath
options['registry-secrets'] = registrySecrets
.then ->
Promise.join(
helpers.getApplication(appName)
helpers.getArchAndDeviceType(appName)