in src/tasks/BeanstalkDeployApplication/TaskOperations.ts [104:152]
private async updateEnvironment(
bucketName: string,
key: string,
application: string,
environment: string,
versionLabel: string,
description: string,
isExistingVersion: boolean
): Promise<void> {
if (!isExistingVersion) {
const sourceBundle: ElasticBeanstalk.S3Location = {
S3Bucket: bucketName,
S3Key: key
}
const versionRequest: ElasticBeanstalk.CreateApplicationVersionMessage = {
ApplicationName: application,
VersionLabel: versionLabel,
SourceBundle: sourceBundle
}
if (this.taskParameters.description) {
versionRequest.Description = this.taskParameters.description
}
await this.beanstalkClient.createApplicationVersion(versionRequest).promise()
if (description) {
console.log(
tl.loc(
'CreatedApplicationVersionWithDescription',
versionRequest.VersionLabel,
description,
application
)
)
} else {
console.log(tl.loc('CreatedApplicationVersion', versionRequest.VersionLabel, application))
}
} else {
console.log(tl.loc('DeployingExistingVersion', versionLabel))
}
const request: ElasticBeanstalk.UpdateEnvironmentMessage = {
ApplicationName: application,
EnvironmentName: environment,
VersionLabel: versionLabel
}
await this.beanstalkClient.updateEnvironment(request).promise()
console.log(tl.loc('StartingApplicationDeployment', request.VersionLabel))
}