mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-02-21 17:56:57 +00:00
Respect source parameter in resin build
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>
This commit is contained in:
parent
d55ce853a7
commit
9050cb1975
@ -15,7 +15,7 @@ formatImageName = function(image) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
parseInput = Promise.method(function(params, options) {
|
parseInput = Promise.method(function(params, options) {
|
||||||
var appName, context, image;
|
var appName, image, source;
|
||||||
if (params.appName == null) {
|
if (params.appName == null) {
|
||||||
throw new Error('Need an application to deploy to!');
|
throw new Error('Need an application to deploy to!');
|
||||||
}
|
}
|
||||||
@ -28,11 +28,11 @@ parseInput = Promise.method(function(params, options) {
|
|||||||
options.build = false;
|
options.build = false;
|
||||||
image = params.image;
|
image = params.image;
|
||||||
} else if (options.build) {
|
} else if (options.build) {
|
||||||
context = options.source || '.';
|
source = options.source || '.';
|
||||||
} else {
|
} else {
|
||||||
throw new Error('Need either an image or a build flag!');
|
throw new Error('Need either an image or a build flag!');
|
||||||
}
|
}
|
||||||
return [appName, options.build, context, image];
|
return [appName, options.build, source, image];
|
||||||
});
|
});
|
||||||
|
|
||||||
pushProgress = function(imageSize, request, timeout) {
|
pushProgress = function(imageSize, request, timeout) {
|
||||||
@ -138,14 +138,14 @@ module.exports = {
|
|||||||
tmp.setGracefulCleanup();
|
tmp.setGracefulCleanup();
|
||||||
docker = dockerUtils.getDocker(options);
|
docker = dockerUtils.getDocker(options);
|
||||||
return parseInput(params, options).then(function(arg) {
|
return parseInput(params, options).then(function(arg) {
|
||||||
var appName, build, context, imageName;
|
var appName, build, imageName, source;
|
||||||
appName = arg[0], build = arg[1], context = arg[2], imageName = arg[3];
|
appName = arg[0], build = arg[1], source = arg[2], imageName = arg[3];
|
||||||
return tmpNameAsync().then(function(tmpPath) {
|
return tmpNameAsync().then(function(tmpPath) {
|
||||||
options = _.assign({}, options, {
|
options = _.assign({}, options, {
|
||||||
appName: appName
|
appName: appName
|
||||||
});
|
});
|
||||||
params = _.assign({}, params, {
|
params = _.assign({}, params, {
|
||||||
context: context
|
source: source
|
||||||
});
|
});
|
||||||
return Promise["try"](function() {
|
return Promise["try"](function() {
|
||||||
if (build) {
|
if (build) {
|
||||||
|
@ -94,10 +94,10 @@ exports.runBuild = function(params, options, getBundleInfo) {
|
|||||||
Promise = require('bluebird');
|
Promise = require('bluebird');
|
||||||
dockerBuild = require('resin-docker-build');
|
dockerBuild = require('resin-docker-build');
|
||||||
resolver = require('resin-bundle-resolve');
|
resolver = require('resin-bundle-resolve');
|
||||||
if (params.context == null) {
|
if (params.source == null) {
|
||||||
params.context = '.';
|
params.source = '.';
|
||||||
}
|
}
|
||||||
return tarDirectory(params.context).then(function(tarStream) {
|
return tarDirectory(params.source).then(function(tarStream) {
|
||||||
return new Promise(function(resolve, reject) {
|
return new Promise(function(resolve, reject) {
|
||||||
var builder, connectOpts, hooks, opts;
|
var builder, connectOpts, hooks, opts;
|
||||||
hooks = {
|
hooks = {
|
||||||
|
@ -19,11 +19,11 @@ parseInput = Promise.method (params, options) ->
|
|||||||
options.build = false
|
options.build = false
|
||||||
image = params.image
|
image = params.image
|
||||||
else if options.build
|
else if options.build
|
||||||
context = options.source || '.'
|
source = options.source || '.'
|
||||||
else
|
else
|
||||||
throw new Error('Need either an image or a build flag!')
|
throw new Error('Need either an image or a build flag!')
|
||||||
|
|
||||||
return [appName, options.build, context, image]
|
return [appName, options.build, source, image]
|
||||||
|
|
||||||
pushProgress = (imageSize, request, timeout = 250) ->
|
pushProgress = (imageSize, request, timeout = 250) ->
|
||||||
process.stdout.write('Initialising...')
|
process.stdout.write('Initialising...')
|
||||||
@ -127,13 +127,13 @@ module.exports =
|
|||||||
docker = dockerUtils.getDocker(options)
|
docker = dockerUtils.getDocker(options)
|
||||||
# Check input parameters
|
# Check input parameters
|
||||||
parseInput(params, options)
|
parseInput(params, options)
|
||||||
.then ([appName, build, context, imageName]) ->
|
.then ([appName, build, source, imageName]) ->
|
||||||
tmpNameAsync()
|
tmpNameAsync()
|
||||||
.then (tmpPath) ->
|
.then (tmpPath) ->
|
||||||
|
|
||||||
# Setup the build args for how the build routine expects them
|
# Setup the build args for how the build routine expects them
|
||||||
options = _.assign({}, options, { appName })
|
options = _.assign({}, options, { appName })
|
||||||
params = _.assign({}, params, { context })
|
params = _.assign({}, params, { source })
|
||||||
|
|
||||||
Promise.try ->
|
Promise.try ->
|
||||||
if build
|
if build
|
||||||
|
@ -107,10 +107,10 @@ exports.runBuild = (params, options, getBundleInfo) ->
|
|||||||
resolver = require('resin-bundle-resolve')
|
resolver = require('resin-bundle-resolve')
|
||||||
|
|
||||||
# The default build context is the current directory
|
# The default build context is the current directory
|
||||||
params.context ?= '.'
|
params.source ?= '.'
|
||||||
|
|
||||||
# Tar up the directory, ready for the build stream
|
# Tar up the directory, ready for the build stream
|
||||||
tarDirectory(params.context)
|
tarDirectory(params.source)
|
||||||
.then (tarStream) ->
|
.then (tarStream) ->
|
||||||
new Promise (resolve, reject) ->
|
new Promise (resolve, reject) ->
|
||||||
hooks =
|
hooks =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user