Merge pull request #497 from resin-io/share-build-opts

Share nocache and tag build options between build and deploy
This commit is contained in:
CameronDiver 2017-04-24 20:56:41 +01:00 committed by GitHub
commit be0d6d5a99
6 changed files with 29 additions and 29 deletions

View File

@ -40,15 +40,6 @@ module.exports = {
parameter: 'application',
description: 'The target resin.io application this build is for',
alias: 'a'
}, {
signature: 'tag',
parameter: 'tag',
description: 'The alias to the generated image',
alias: 't'
}, {
signature: 'nocache',
description: "Don't use docker layer caching when building",
boolean: true
}
]),
action: function(params, options, done) {

View File

@ -1,8 +1,10 @@
// Generated by CoffeeScript 1.12.5
var Promise, formatImageName, getBuilderPushEndpoint, getBundleInfo, parseInput, performUpload, pushProgress, uploadToPromise;
var Promise, dockerUtils, formatImageName, getBuilderPushEndpoint, getBundleInfo, parseInput, performUpload, pushProgress, uploadToPromise;
Promise = require('bluebird');
dockerUtils = require('../utils/docker');
getBuilderPushEndpoint = function(baseUrl, owner, app) {
var escApp, escOwner;
escOwner = encodeURIComponent(owner);
@ -115,7 +117,7 @@ module.exports = {
description: 'Deploy a container to a resin.io application',
help: 'Use this command to deploy and optionally build an image to an application.\n\nUsage: deploy <appName> ([image] | --build [--source build-dir])\n\nNote: If building with this command, all options supported by `resin build`\nare also support with this command.\n\nExamples:\n$ resin deploy myApp --build --source myBuildDir/\n$ resin deploy myApp myApp/myImage',
permission: 'user',
options: [
options: dockerUtils.appendOptions([
{
signature: 'build',
boolean: true,
@ -127,14 +129,13 @@ module.exports = {
description: 'The source directory to use when building the image',
alias: 's'
}
],
]),
action: function(params, options, done) {
var _, docker, dockerUtils, resin, tmp, tmpNameAsync;
var _, docker, resin, tmp, tmpNameAsync;
_ = require('lodash');
tmp = require('tmp');
tmpNameAsync = Promise.promisify(tmp.tmpName);
resin = require('resin-sdk-preconfigured');
dockerUtils = require('../utils/docker');
tmp.setGracefulCleanup();
docker = dockerUtils.getDocker(options);
return parseInput(params, options).then(function(arg) {

View File

@ -30,6 +30,15 @@ exports.appendOptions = function(opts) {
signature: 'key',
parameter: 'key',
description: 'Docker host TLS key file'
}, {
signature: 'tag',
parameter: 'tag',
description: 'The alias to the generated image',
alias: 't'
}, {
signature: 'nocache',
description: "Don't use docker layer caching when building",
boolean: true
}
]);
};

View File

@ -56,17 +56,6 @@ module.exports =
description: 'The target resin.io application this build is for'
alias: 'a'
},
{
signature: 'tag'
parameter: 'tag'
description: 'The alias to the generated image'
alias: 't'
},
{
signature: 'nocache'
description: "Don't use docker layer caching when building"
boolean: true
},
]
action: (params, options, done) ->
dockerUtils.runBuild(params, options, getBundleInfo)

View File

@ -1,4 +1,5 @@
Promise = require('bluebird')
dockerUtils = require('../utils/docker')
getBuilderPushEndpoint = (baseUrl, owner, app) ->
escOwner = encodeURIComponent(owner)
@ -99,7 +100,7 @@ module.exports =
$ resin deploy myApp myApp/myImage
'''
permission: 'user'
options: [
options: dockerUtils.appendOptions [
{
signature: 'build'
boolean: true
@ -119,8 +120,6 @@ module.exports =
tmpNameAsync = Promise.promisify(tmp.tmpName)
resin = require('resin-sdk-preconfigured')
dockerUtils = require('../utils/docker')
# Ensure the tmp files gets deleted
tmp.setGracefulCleanup()

View File

@ -40,7 +40,18 @@ exports.appendOptions = (opts) ->
signature: 'key'
parameter: 'key'
description: 'Docker host TLS key file'
}
},
{
signature: 'tag'
parameter: 'tag'
description: 'The alias to the generated image'
alias: 't'
},
{
signature: 'nocache'
description: "Don't use docker layer caching when building"
boolean: true
},
]
exports.generateConnectOpts = generateConnectOpts = (opts) ->