Skip to content

Commit

Permalink
Merge branch 'release/1.1.7'
Browse files Browse the repository at this point in the history
  • Loading branch information
stevejroberts committed Oct 23, 2018
2 parents bfd60dd + cdba472 commit 59e3a2a
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
### 1.1.7 (2018-10-24)

* Fixed issue #112, shell task not initialized correctly when a role-based credential endpoint was used.
* Issue #115, added option to the Elastic Beanstalk deployment task allowing configuration of event polling frequency during deployment. The default (and minimum) delay is 5 seconds. Users can now specify a custom delay of up to 5 minutes (300 seconds) to help avoid throttling errors from the service when multiple deployments are in progress, all polling for events.

### 1.1.6 (2018-10-01)

* Bug fix to remove duplicate webpacked copy of the AWS SDK for Node.js which was causing issues with the user agent string set by the tools.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export class TaskOperations {

const credentials = await this.taskParameters.getCredentials();
if (credentials) {
await credentials.getPromise();
tl.debug('configure credentials into environment variables');
env.AWS_ACCESS_KEY_ID = credentials.accessKeyId;
env.AWS_SECRET_ACCESS_KEY = credentials.secretAccessKey;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ export class TaskOperations {
this.taskParameters.description,
this.taskParameters.applicationType === TaskParameters.applicationTypeExistingVersion);

await this.waitForDeploymentCompletion(this.taskParameters.applicationName, this.taskParameters.environmentName, startingEventDate);
await this.waitForDeploymentCompletion(this.taskParameters.applicationName,
this.taskParameters.environmentName,
startingEventDate,
this.taskParameters.eventPollingDelay);

if (this.taskParameters.outputVariable) {
console.log(tl.loc('SettingOutputVariable', this.taskParameters.outputVariable, versionLabel));
Expand Down Expand Up @@ -137,7 +140,8 @@ export class TaskOperations {

private async waitForDeploymentCompletion(applicationName: string,
environmentName: string,
startingEventDate: Date): Promise<void> {
startingEventDate: Date,
eventPollDelay: number): Promise<void> {

const requestEnvironment: Beanstalk.DescribeEnvironmentsMessage = {
ApplicationName: applicationName,
Expand All @@ -153,12 +157,15 @@ export class TaskOperations {
let lastPrintedEventDate = startingEventDate;

console.log(tl.loc('WaitingForDeployment'));
console.log(tl.loc('ConfiguredEventPollDelay', eventPollDelay));

console.log(tl.loc('EventsComing'));

let success = true;
let environment: Beanstalk.EnvironmentDescription;
do {
await this.sleep(5000);
tl.debug(`...event poll sleep for ${eventPollDelay}s`);
await this.sleep(eventPollDelay * 1000);

const responseEnvironments = await this.beanstalkClient.describeEnvironments(requestEnvironment).promise();
if (responseEnvironments.Environments.length === 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@ export class TaskParameters extends AWSTaskParametersBase {
// options for applicationType
public static readonly applicationTypeAspNet: string = 'aspnet';
public static readonly applicationTypeAspNetCoreForWindows: string = 'aspnetCoreWindows';

public static readonly applicationTypeS3Archive: string = 's3';
public static readonly applicationTypeExistingVersion: string = 'version';

public static readonly defaultEventPollingDelay: number = 5; // seconds
public static readonly maxEventPollingDelay: number = 300; // seconds, 5 mins

public applicationName: string;
public environmentName: string;
public applicationType: string;
Expand All @@ -28,6 +32,7 @@ export class TaskParameters extends AWSTaskParametersBase {
public description: string;

public outputVariable: string;
public eventPollingDelay: number = TaskParameters.defaultEventPollingDelay;

constructor() {
super();
Expand Down Expand Up @@ -62,6 +67,22 @@ export class TaskParameters extends AWSTaskParametersBase {
this.versionLabel = tl.getInput('versionLabel', this.applicationType === TaskParameters.applicationTypeExistingVersion);
this.description = tl.getInput('description', false);
this.outputVariable = tl.getInput('outputVariable', false);
const pollDelay = tl.getInput('eventPollingDelay', false);
if (pollDelay) {
try {
const pollDelayValue = parseInt(pollDelay, 10);
if (pollDelayValue >= TaskParameters.defaultEventPollingDelay && pollDelayValue <= TaskParameters.maxEventPollingDelay) {
this.eventPollingDelay = pollDelayValue;
} else {
throw new Error();
}
} catch {
console.log(tl.loc('InvalidEventPollDelay',
pollDelay,
TaskParameters.defaultEventPollingDelay,
TaskParameters.maxEventPollingDelay));
}
}
} catch (error) {
throw new Error(error.message);
}
Expand Down
12 changes: 11 additions & 1 deletion Tasks/BeanstalkDeployApplication/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
"type": "string",
"required": false,
"defaultValue": "",
"helpMarkDown": "Optional description of the version"
"helpMarkDown": "Optional description of the version."
},
{
"name": "outputVariable",
Expand All @@ -136,6 +136,14 @@
"helpMarkDown": "The name of the variable that will contain the version label of the new application revision.",
"required": false
},
{
"name": "eventPollingDelay",
"type": "string",
"label": "Event poll delay (seconds)",
"defaultValue": "5",
"helpMarkDown": "The time, in seconds, to wait between calls to retrieve the latest events from the deployment to the environment.",
"required": false
},
{
"name": "logRequest",
"type": "boolean",
Expand Down Expand Up @@ -188,6 +196,8 @@
"SettingOutputVariable": "Setting output variable %s with the version label %s",
"ApplicationExistsQueryError": "DescribeApplications: error %s returned querying for existence of application %s",
"EnvironmentExistsQueryError": "DescribeEnvironments: error %s thrown querying for existence of environment %s for application %s",
"InvalidEventPollDelay": "Event polling delay setting of %s is invalid (minimum %s seconds, maximum %s seconds) - task will use minimum poll delay by default",
"ConfiguredEventPollDelay": "Task configured to wait %s seconds between queries for deployment events",
"TaskCompleted": "Deployment to application %s completed"
}
}
2 changes: 1 addition & 1 deletion _versioninfo.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"Major": "1",
"Minor": "1",
"Patch": "6"
"Patch": "7"
}

0 comments on commit 59e3a2a

Please sign in to comment.