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

disableRollback added to cloudFormationExecuteChangeSet #494

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "Feature",
"description": "Added DisableRollback boolean paramater to cloudFormationExecuteChangeSet so that we can optionally disable rollback when executing a changeset through a pipeline."
}
159 changes: 9 additions & 150 deletions 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
Expand Up @@ -82,7 +82,7 @@
"dependencies": {
"@typescript-eslint/typescript-estree": "^4.17.0",
"adm-zip": "^0.5.3",
"aws-sdk": "^2.916.0",
"aws-sdk": "^2.956.0",
"azure-pipelines-task-lib": "^3.3.1",
"base-64": "^0.1.0",
"https-proxy-agent": "^5.0.0",
Expand Down
14 changes: 10 additions & 4 deletions src/tasks/CloudFormationExecuteChangeSet/TaskOperations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ export class TaskOperations {
public async execute(): Promise<void> {
const changeSet = await this.verifyResourcesExist(
this.taskParameters.changeSetName,
this.taskParameters.stackName
this.taskParameters.stackName,
this.taskParameters.disableRollback
)
let waitForUpdate = false
const stackId = changeSet.StackId || ''
Expand Down Expand Up @@ -51,12 +52,13 @@ export class TaskOperations {
}
} else {
console.log(
tl.loc('ExecutingChangeSet', this.taskParameters.changeSetName, this.taskParameters.stackName)
tl.loc('ExecutingChangeSet', this.taskParameters.changeSetName, this.taskParameters.stackName, this.taskParameters.disableRollback)
)
await this.cloudFormationClient
.executeChangeSet({
ChangeSetName: this.taskParameters.changeSetName,
StackName: this.taskParameters.stackName
StackName: this.taskParameters.stackName,
DisableRollback: this.taskParameters.disableRollback
})
.promise()

Expand Down Expand Up @@ -90,7 +92,8 @@ export class TaskOperations {

private async verifyResourcesExist(
changeSetName: string,
stackName: string
stackName: string,
disableRollback: boolean
): Promise<CloudFormation.DescribeChangeSetOutput> {
try {
const request: CloudFormation.DescribeChangeSetInput = {
Expand All @@ -99,6 +102,9 @@ export class TaskOperations {
if (stackName) {
request.StackName = stackName
}
if (disableRollback) {
request.DisableRollback = disableRollback
}

return await this.cloudFormationClient.describeChangeSet(request).promise()
} catch (err) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export interface TaskParameters {
outputVariable: string
captureStackOutputs: string
captureAsSecuredVars: boolean
disableRollback: boolean
}

export function buildTaskParameters(): TaskParameters {
Expand All @@ -31,7 +32,8 @@ export function buildTaskParameters(): TaskParameters {
deleteEmptyChangeSet: getBoolInput('deleteEmptyChangeSet', false),
outputVariable: getInputOrEmpty('outputVariable'),
captureStackOutputs: getInputOrEmpty('captureStackOutputs'),
captureAsSecuredVars: getBoolInput('captureAsSecuredVars', false)
captureAsSecuredVars: getBoolInput('captureAsSecuredVars', false),
disableRollback: getBoolInput('disableRollback', false)
}

return parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ const defaultTaskParameters: TaskParameters = {
deleteEmptyChangeSet: false,
outputVariable: '',
captureStackOutputs: '',
captureAsSecuredVars: false
captureAsSecuredVars: false,
disableRollback: true
}

const changeSetNotFound = {
Expand Down