Skip to content

Commit

Permalink
GitHub #91, add an option to suppress the warning when no work was re…
Browse files Browse the repository at this point in the history
…quired
  • Loading branch information
stevejroberts committed Jul 26, 2018
1 parent 9ba584c commit 5d5a9df
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
7 changes: 7 additions & 0 deletions Docs/cloudformation-create-update.rst
Expand Up @@ -291,6 +291,13 @@ Disable Rollback
If checked, disables rollback of the stack if stack creation failed. You can specify
:code:`DisableRollback` or :code:`OnFailure`, but not both.

Log warning during stack update if AWS CloudFormation reports no work to be done
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

If selected and an update stack operation, with or without a change set, results in no changes being reported by the service
then a warning message is emitted into the task logs. When not selected the message from the service is ignored and no warning
emitted.

Output Variable
~~~~~~~~~~~~~~~

Expand Down
Expand Up @@ -457,7 +457,9 @@ export class TaskOperations {
}

if (noWorkToDo) {
tl.warning(tl.loc('NoWorkToDo'));
if (this.taskParameters.warnWhenNoWorkNeeded) {
tl.warning(tl.loc('NoWorkToDo'));
}
return true;
}
// tslint:disable-next-line:no-empty
Expand Down Expand Up @@ -566,7 +568,7 @@ export class TaskOperations {
try {
console.log(tl.loc('CheckingForExistingChangeSet', changeSetName, stackName));
const response = await this.cloudFormationClient.describeChangeSet({ ChangeSetName: changeSetName, StackName: stackName}).promise();
console.log(tl.loc('ChangeSetExists ', changeSetName, response.Status));
console.log(tl.loc('ChangeSetExists', changeSetName, response.Status));
return true;
} catch (err) {
console.log(tl.loc('ChangeSetLookupFailed', changeSetName, err.message));
Expand Down
Expand Up @@ -48,6 +48,7 @@ export class TaskParameters extends AWSTaskParametersBase {
public rollbackTriggerARNs: string[];

public onFailure: string;
public warnWhenNoWorkNeeded: boolean;
public outputVariable: string;

public timeoutInMins: number = TaskParameters.defaultTimeoutInMins;
Expand Down Expand Up @@ -137,6 +138,7 @@ export class TaskParameters extends AWSTaskParametersBase {
}

this.onFailure = tl.getInput('onFailure');
this.warnWhenNoWorkNeeded = tl.getBoolInput('warnWhenNoWorkNeeded');
this.outputVariable = tl.getInput('outputVariable', false);

const t = tl.getInput('timeoutInMins', false);
Expand Down
9 changes: 9 additions & 0 deletions Tasks/CloudFormationCreateOrUpdateStack/task.json
Expand Up @@ -297,6 +297,15 @@
"required": false,
"helpMarkDown": "Set to true to disable rollback of the stack if stack creation failed.\n\n Default: false"
},
{
"name": "warnWhenNoWorkNeeded",
"type": "boolean",
"label": "Log warning during stack update if AWS CloudFormation reports no work to be done",
"defaultValue": "true",
"groupName": "Options",
"required": false,
"helpMarkDown": "When this option is selected and the task is updating a stack, with or without a change set, if AWS CloudFormation detects that no work was required a warning message is emitted into the task log. When this option is not selected the task will ignore the message from the service and emit no warning into the logs."
},
{
"name": "outputVariable",
"type": "string",
Expand Down

0 comments on commit 5d5a9df

Please sign in to comment.