in src/tasks/CodeDeployDeployApplication/TaskOperations.ts [190:245]
private async deployRevision(bundleKey: string): Promise<string> {
console.log(tl.loc('DeployingRevision'))
// use bundle key as taskParameters.revisionBundle might be pointing at a folder
let archiveType: string = path.extname(bundleKey)
if (archiveType && archiveType.length > 1) {
// let the service error out if the type is not one they currently support
archiveType = archiveType.substring(1).toLowerCase()
tl.debug(`Setting archive type to ${archiveType} based on bundle file extension`)
} else {
tl.debug('Unable to determine archive type, assuming zip')
archiveType = 'zip'
}
try {
const request: CodeDeploy.CreateDeploymentInput = {
applicationName: this.taskParameters.applicationName,
deploymentGroupName: this.taskParameters.deploymentGroupName,
fileExistsBehavior: this.taskParameters.fileExistsBehavior,
ignoreApplicationStopFailures: this.taskParameters.ignoreApplicationStopFailures,
updateOutdatedInstancesOnly: this.taskParameters.updateOutdatedInstancesOnly,
revision: {
revisionType: 'S3',
s3Location: {
bucket: this.taskParameters.bucketName,
key: bundleKey,
bundleType: archiveType
}
}
}
if (this.taskParameters.description) {
request.description = this.taskParameters.description
}
const response: CodeDeploy.CreateDeploymentOutput = await this.codeDeployClient
.createDeployment(request)
.promise()
console.log(
tl.loc(
'DeploymentStarted',
this.taskParameters.deploymentGroupName,
this.taskParameters.applicationName,
response.deploymentId
)
)
if (!response.deploymentId) {
return ''
}
return response.deploymentId
} catch (err) {
console.error(tl.loc('DeploymentError', (err as Error).message), err)
throw err
}
}