Share nocache and tag build options between build and deploy

`resin build` had access to the `--nocache` and `--tag` options for
building with docker, but `resin deploy` did not. This commit adds the
options to the shared dockerUtils.appendOptions function.

Change-type: patch
Signed-off-by: Cameron Diver <cameron@resin.io>
This commit is contained in:
Cameron Diver 2017-04-24 20:05:18 +01:00
parent 284030d83d
commit 4fa1a9c1c6
No known key found for this signature in database
GPG Key ID: E76D7ACBEE436E12
6 changed files with 29 additions and 29 deletions

View File

@ -40,15 +40,6 @@ module.exports = {
parameter: 'application', parameter: 'application',
description: 'The target resin.io application this build is for', description: 'The target resin.io application this build is for',
alias: 'a' 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) { action: function(params, options, done) {

View File

@ -1,8 +1,10 @@
// Generated by CoffeeScript 1.12.5 // 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'); Promise = require('bluebird');
dockerUtils = require('../utils/docker');
getBuilderPushEndpoint = function(baseUrl, owner, app) { getBuilderPushEndpoint = function(baseUrl, owner, app) {
var escApp, escOwner; var escApp, escOwner;
escOwner = encodeURIComponent(owner); escOwner = encodeURIComponent(owner);
@ -115,7 +117,7 @@ module.exports = {
description: 'Deploy a container to a resin.io application', 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', 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', permission: 'user',
options: [ options: dockerUtils.appendOptions([
{ {
signature: 'build', signature: 'build',
boolean: true, boolean: true,
@ -127,14 +129,13 @@ module.exports = {
description: 'The source directory to use when building the image', description: 'The source directory to use when building the image',
alias: 's' alias: 's'
} }
], ]),
action: function(params, options, done) { action: function(params, options, done) {
var _, docker, dockerUtils, resin, tmp, tmpNameAsync; var _, docker, resin, tmp, tmpNameAsync;
_ = require('lodash'); _ = require('lodash');
tmp = require('tmp'); tmp = require('tmp');
tmpNameAsync = Promise.promisify(tmp.tmpName); tmpNameAsync = Promise.promisify(tmp.tmpName);
resin = require('resin-sdk-preconfigured'); resin = require('resin-sdk-preconfigured');
dockerUtils = require('../utils/docker');
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) {

View File

@ -30,6 +30,15 @@ exports.appendOptions = function(opts) {
signature: 'key', signature: 'key',
parameter: 'key', parameter: 'key',
description: 'Docker host TLS key file' 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' description: 'The target resin.io application this build is for'
alias: 'a' 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) -> action: (params, options, done) ->
dockerUtils.runBuild(params, options, getBundleInfo) dockerUtils.runBuild(params, options, getBundleInfo)

View File

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

View File

@ -40,7 +40,18 @@ exports.appendOptions = (opts) ->
signature: 'key' signature: 'key'
parameter: 'key' parameter: 'key'
description: 'Docker host TLS key file' 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) -> exports.generateConnectOpts = generateConnectOpts = (opts) ->