Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added -z, --zeroDowntimeDelay option (default = 60) #189

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
2fa362f
Fix for issue #144, added Target Server commands
kurtkanaskie Mar 28, 2019
86e6a81
Merge branch 'master' of github.com:apigee/apigeetool-node
kurtkanaskie Sep 12, 2019
f8f32c7
Fixes for issues 158,159,160,161,162,163, improved local and remote t…
kurtkanaskie Sep 17, 2019
db6ebe7
Fixed issue #165, all remotetests run correctly and leave no remnants
kurtkanaskie Sep 20, 2019
5fa6049
Fix #165 - plus additional issues 158,160,161,and 163
kurtkanaskie Sep 20, 2019
a9a4485
Fix #165 - plus additional issues 158,160,161,and 163
kurtkanaskie Sep 20, 2019
f4459af
Synced with key and cert file changes
kurtkanaskie Sep 23, 2019
92146a0
Merged conflicts
kurtkanaskie Sep 23, 2019
4b45e36
Made key and cert file options default
kurtkanaskie Sep 23, 2019
a010f42
Implemented Issue #159 - Flow Hooks
kurtkanaskie Sep 24, 2019
d11585f
Implemented Issue #162 - Target Server Get and List
kurtkanaskie Sep 24, 2019
20fbd15
Implemented Issue #167 - Roles, Permissions and User assignment
kurtkanaskie Sep 24, 2019
473fa73
Updated version to 0.13 and devDependency for Jasmine
kurtkanaskie Sep 25, 2019
ace2d5a
npm audit fix
kurtkanaskie Sep 25, 2019
fc75c94
Adding --json option back
kurtkanaskie Oct 11, 2019
021fa41
Syncing with 0.14.1
kurtkanaskie Oct 22, 2019
9587b5b
Fix issue #173 regression
kurtkanaskie Oct 22, 2019
34918b7
Adjusted help output for -t and -N overrides
kurtkanaskie Oct 23, 2019
4f4f7b3
Removed out-of-scope changes
kurtkanaskie Oct 23, 2019
e300f0c
Merge branch 'master' of github.com:apigee/apigeetool-node
kurtkanaskie Oct 28, 2019
6803988
Merge remote-tracking branch 'upstream/master'
kurtkanaskie Apr 10, 2020
06d7108
Parameterized Deployment Delay, default=0
kurtkanaskie Apr 23, 2020
b870d40
Updated to version 0.14.3
kurtkanaskie May 13, 2020
84eb9bd
Restored default to 60, changed option to -Z, --zeroDowntimeDelay
kurtkanaskie May 13, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions lib/commands/deployExistingRevision.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var defaults = require('../defaults');
var options = require('../options');
var parseDeployments = require('./parsedeployments');

var DeploymentDelay = 60;
var DefaultDeploymentDelay = 0;
var descriptor = defaults.defaultDescriptor({
api: {
name: 'API Name',
Expand All @@ -28,6 +28,12 @@ var descriptor = defaults.defaultDescriptor({
shortOption: 'r',
required: true,
prompt: true
},
deploymentDelay: {
name: 'DeploymentDelay (default=' + DefaultDeploymentDelay + ")",
shortOption: 'z',
required: false,
prompt: true
}
});
module.exports.descriptor = descriptor;
Expand Down Expand Up @@ -74,9 +80,12 @@ module.exports.run = function(opts, cb) {
}

function deployProxy(opts, request, done) {
if( !opts.deploymentDelay ) {
opts.deploymentDelay = DefaultDeploymentDelay;
}
if (opts.verbose) {
console.log('Deploying revision %d of %s to %s', opts.revision,
opts.api, opts.environments);
console.log('Deploying revision %d of %s to %s, delaying %s',
opts.revision, opts.api, opts.environments, opts.deploymentDelay);
}

var environments = opts.environments.split(',');
Expand All @@ -87,7 +96,7 @@ function deployProxy(opts, request, done) {
opts.baseuri, opts.organization, environment, opts.api, opts.revision);
if (opts.debug) { console.log('Going to POST to %s', uri); }

var deployCmd = util.format('action=deploy&override=true&delay=%d', DeploymentDelay);
var deployCmd = util.format('action=deploy&override=true&delay=%d', opts.deploymentDelay);
if (opts['base-path']) {
deployCmd = util.format('%s&basepath=%s', deployCmd, opts['base-path']);
}
Expand Down
6 changes: 6 additions & 0 deletions lib/commands/deployhostedtarget.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ var descriptor = defaults.defaultDescriptor({
name: 'Upload Modules',
shortOption: 'U',
toggle: true
},
zeroDowntimeDelay: {
name: 'Delay N seconds for zero downtime deployment (default=60)',
shortOption: 'Z',
required: false,
prompt: true
}
});
module.exports.descriptor = descriptor;
Expand Down
20 changes: 15 additions & 5 deletions lib/commands/deployproxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var cleanResults = require('../utils').cleanResults;

var ProxyBase = 'apiproxy';
var XmlExp = /(.+)\.xml$/i;
var DeploymentDelay = 60;
var DefaultZeroDowntimeDelay = 60;
var BASE_PATH_REGEXP = /<BasePath[^>]*>(.*?)<\/BasePath>/;

// By default, do not run NPM remotely
Expand Down Expand Up @@ -71,6 +71,12 @@ var descriptor = defaults.defaultDescriptor({
name: 'Wait N seconds after importing proxy before deploying',
shortOption: 'W',
required: false
},
zeroDowntimeDelay: {
name: 'Delay N seconds for zero downtime deployment (default=' + DefaultZeroDowntimeDelay + ")",
shortOption: 'Z',
required: false,
prompt: true
}
});
module.exports.descriptor = descriptor;
Expand Down Expand Up @@ -693,9 +699,13 @@ function deployProxy(opts, request, done) {
return;
}

if( !opts.zeroDowntimeDelay ) {
opts.zeroDowntimeDelay = DefaultZeroDowntimeDelay;
}

if (opts.verbose) {
console.log('Deploying revision %d of %s to %s', opts.deploymentVersion,
opts.api, opts.environments);
console.log('Deploying revision %d of %s to %s, delaying %s seconds for zero downtime deployment.',
opts.deploymentVersion, opts.api, opts.environments, opts.zeroDowntimeDelay);
}

var environments = opts.environments.split(',');
Expand All @@ -706,7 +716,7 @@ function deployProxy(opts, request, done) {
opts.baseuri, opts.organization, environment, opts.api, opts.deploymentVersion);
if (opts.debug) { console.log('Going to POST to %s', uri); }

var deployCmd = util.format('action=deploy&override=true&delay=%d', DeploymentDelay);
var deployCmd = util.format('action=deploy&override=true&delay=%d', opts.zeroDowntimeDelay);
if (opts['base-path']) {
deployCmd = util.format('%s&basepath=%s', deployCmd, opts['base-path']);
}
Expand Down Expand Up @@ -753,7 +763,7 @@ function deployProxy(opts, request, done) {
tasks[env] = deployToEnvironment.bind(this, env);
});

if (opts.verbose) { console.log('Delaying deployment for %d seconds', opts.waitAfterImportDelay); }
if (opts.verbose) { console.log('Waiting %d seconds after import to deploy', opts.waitAfterImportDelay); }
setTimeout(function () {
async.parallel(tasks, done);
}, opts.waitAfterImportDelay*1000);
Expand Down
18 changes: 14 additions & 4 deletions lib/commands/deploysharedflow.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var parseDeployments = require('./parsedeployments');

var SharedFlowBase = 'sharedflowbundle';
var XmlExp = /(.+)\.xml$/i;
var DeploymentDelay = 60;
var DefaultZeroDowntimeDelay = 60;

var descriptor = defaults.defaultDescriptor({
name: {
Expand All @@ -39,6 +39,12 @@ var descriptor = defaults.defaultDescriptor({
name: 'Import Only',
shortOption: 'i',
toggle: true
},
zeroDowntimeDelay: {
name: 'Delay N seconds for zero downtime deployment (default=' + DefaultZeroDowntimeDelay + ")",
shortOption: 'Z',
required: false,
prompt: true
}
});
module.exports.descriptor = descriptor;
Expand Down Expand Up @@ -434,9 +440,13 @@ function deploySharedFlow(opts, request, done) {
return;
}

if( !opts.zeroDowntimeDelay ) {
opts.zeroDowntimeDelay = DefaultZeroDowntimeDelay;
}

if (opts.verbose) {
console.log('Deploying revision %d of %s to %s', opts.deploymentVersion,
opts.name, opts.environments);
console.log('Deploying revision %d of %s to %s, delaying %s seconds for zero downtime deployment.',
opts.deploymentVersion, opts.name, opts.environments, opts.zeroDowntimeDelay);
}

var environments = opts.environments.split(',');
Expand All @@ -449,7 +459,7 @@ function deploySharedFlow(opts, request, done) {
console.log('Going to POST to %s', uri);
}

var deployCmd = util.format('action=deploy&override=true&delay=%d', DeploymentDelay);
var deployCmd = util.format('action=deploy&override=true&delay=%d', opts.zeroDowntimeDelay);
if (opts['base-path']) {
deployCmd = util.format('%s&basepath=%s', deployCmd, opts['base-path']);
}
Expand Down
12 changes: 8 additions & 4 deletions lib/deploycommon.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ tmp.setGracefulCleanup();

var ziputils = require('./ziputils');

var DeploymentDelay = 60
var DefaultZeroDowntimeDelay = 60;
var ProxyBase = 'apiproxy';

module.exports.createApiProxy = function(opts, request, done) {
Expand Down Expand Up @@ -104,9 +104,13 @@ module.exports.deployProxy = function(opts, request, done) {
return;
}

if( !opts.zeroDowntimeDelay ) {
opts.zeroDowntimeDelay = DefaultZeroDowntimeDelay;
}

if (opts.verbose) {
console.log('Deploying revision %d of %s to %s', opts.deploymentVersion,
opts.api, opts.environments);
console.log('Deploying revision %d of %s to %s, delaying %s seconds for zero downtime deployment.',
opts.deploymentVersion, opts.api, opts.environments, opts.zeroDowntimeDelay);
}

var environments = opts.environments.split(',');
Expand All @@ -120,7 +124,7 @@ module.exports.deployProxy = function(opts, request, done) {
if (opts.debug) { console.log('Going to POST to %s', uri); }

// Unlike "deployproxy" command, ignore the base path here, because we baked it into the proxy definition.
var deployCmd = util.format('action=deploy&override=true&delay=%d', DeploymentDelay);
var deployCmd = util.format('action=deploy&override=true&delay=%d', opts.zeroDowntimeDelay);

if (opts.debug) { console.log('Going go send command %s', deployCmd); }

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "apigeetool",
"version": "0.14.2",
"version": "0.14.3",
"description": "A CLI for Apigee Edge",
"main": "lib/main.js",
"bin": {
Expand Down