briareus
Version:
Briareus assists with Feature Branch deploys to ECS
68 lines (60 loc) • 1.82 kB
JavaScript
const async = require('async');
const _ = require('lodash');
const CLI = require('../');
const Variant = require('../variant');
const Renderer = require('../renderer');
var cmd = {
setup(yargs, output, cb) {
yargs.command('deploy', 'Deploy a project with Briareus', function (yargs) {
return yargs
.option('authtoken', {
required: true,
description: 'Authtoken'
})
.option('slug', {
required: true,
description: 'A normalized slug name to identify this variant'
})
.option('image', {
required: true,
description: 'The Docker image:tag to deploy'
})
.option('cleanup', {
default: true,
description: 'Do not clean this variant during cleanup'
})
.option('build-url', {
description: 'The Build URL'
})
.option('pull-request-id', {
description: 'Github pull request id'
})
.option('git-repo', {
description: 'The git repository belonging to this build '
})
.option('git-branch', {
description: 'The git branch belonging to this build'
})
.option('git-commit', {
description: 'The git commit belonging to this build'
})
}, (argv) => cmd.run(new CLI(argv, output), cb));
},
run(cli, cb) {
const variant = new Variant(cli);
const renderer = new Renderer(variant, cli.output);
variant.on('error', (error) => {
cli.log.debug(error);
process.exit(2);
});
async.series([
(next) => variant.init(next),
(next) => variant.deploy(next),
], (err) => {
if (err) return cb(err);
// Do nothing. Wait for end event from variant
});
},
}
module.exports = cmd;