BUILDID replaced by buildGuid in cloudformation
parent
0c0e0ae9af
commit
53a84c2c08
|
|
@ -1402,7 +1402,7 @@ class AWSTemplates {
|
||||||
${p1}Secret:
|
${p1}Secret:
|
||||||
Type: AWS::SecretsManager::Secret
|
Type: AWS::SecretsManager::Secret
|
||||||
Properties:
|
Properties:
|
||||||
Name: !Join [ "", [ '${p1}', !Ref BUILDID ] ]
|
Name: !Join [ "", [ '${p1}', !Ref buildGuid ] ]
|
||||||
SecretString: !Ref ${p1}
|
SecretString: !Ref ${p1}
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
@ -1495,7 +1495,7 @@ class AWSBuildEnvironment {
|
||||||
defaultSecretsArray) {
|
defaultSecretsArray) {
|
||||||
return __awaiter(this, void 0, void 0, function* () { });
|
return __awaiter(this, void 0, void 0, function* () { });
|
||||||
}
|
}
|
||||||
runTask(buildId, image, commands, mountdir, workingdir, environment, secrets) {
|
runTask(buildGuid, image, commands, mountdir, workingdir, environment, secrets) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
process.env.AWS_REGION = __1.Input.region;
|
process.env.AWS_REGION = __1.Input.region;
|
||||||
const ECS = new SDK.ECS();
|
const ECS = new SDK.ECS();
|
||||||
|
|
@ -1504,12 +1504,12 @@ class AWSBuildEnvironment {
|
||||||
const entrypoint = ['/bin/sh'];
|
const entrypoint = ['/bin/sh'];
|
||||||
const startTimeMs = Date.now();
|
const startTimeMs = Date.now();
|
||||||
yield new aws_base_stack_1.AWSBaseStack(this.baseStackName).setupBaseStack(CF);
|
yield new aws_base_stack_1.AWSBaseStack(this.baseStackName).setupBaseStack(CF);
|
||||||
const taskDef = yield new aws_job_stack_1.AWSJobStack(this.baseStackName).setupCloudFormations(CF, buildId, image, entrypoint, commands, mountdir, workingdir, secrets);
|
const taskDef = yield new aws_job_stack_1.AWSJobStack(this.baseStackName).setupCloudFormations(CF, buildGuid, image, entrypoint, commands, mountdir, workingdir, secrets);
|
||||||
let postRunTaskTimeMs;
|
let postRunTaskTimeMs;
|
||||||
try {
|
try {
|
||||||
const postSetupStacksTimeMs = Date.now();
|
const postSetupStacksTimeMs = Date.now();
|
||||||
cloud_runner_logger_1.default.log(`Setup job time: ${Math.floor((postSetupStacksTimeMs - startTimeMs) / 1000)}s`);
|
cloud_runner_logger_1.default.log(`Setup job time: ${Math.floor((postSetupStacksTimeMs - startTimeMs) / 1000)}s`);
|
||||||
yield aws_task_runner_1.default.runTask(taskDef, ECS, CF, environment, buildId, commands);
|
yield aws_task_runner_1.default.runTask(taskDef, ECS, CF, environment, buildGuid, commands);
|
||||||
postRunTaskTimeMs = Date.now();
|
postRunTaskTimeMs = Date.now();
|
||||||
cloud_runner_logger_1.default.log(`Run job time: ${Math.floor((postRunTaskTimeMs - postSetupStacksTimeMs) / 1000)}s`);
|
cloud_runner_logger_1.default.log(`Run job time: ${Math.floor((postRunTaskTimeMs - postSetupStacksTimeMs) / 1000)}s`);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -14,7 +14,7 @@ export class AWSTemplates {
|
||||||
${p1}Secret:
|
${p1}Secret:
|
||||||
Type: AWS::SecretsManager::Secret
|
Type: AWS::SecretsManager::Secret
|
||||||
Properties:
|
Properties:
|
||||||
Name: !Join [ "", [ '${p1}', !Ref BUILDID ] ]
|
Name: !Join [ "", [ '${p1}', !Ref buildGuid ] ]
|
||||||
SecretString: !Ref ${p1}
|
SecretString: !Ref ${p1}
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ Parameters:
|
||||||
Type: String
|
Type: String
|
||||||
Default: development
|
Default: development
|
||||||
Description: 'Your deployment environment: DEV, QA , PROD'
|
Description: 'Your deployment environment: DEV, QA , PROD'
|
||||||
BUILDID:
|
buildGuid:
|
||||||
Type: String
|
Type: String
|
||||||
Default: ''
|
Default: ''
|
||||||
StackName:
|
StackName:
|
||||||
|
|
@ -34,7 +34,7 @@ Resources:
|
||||||
DeleteCFNLambda:
|
DeleteCFNLambda:
|
||||||
Type: 'AWS::Lambda::Function'
|
Type: 'AWS::Lambda::Function'
|
||||||
Properties:
|
Properties:
|
||||||
FunctionName: !Join ['', ['DeleteCFNLambda', !Ref BUILDID]]
|
FunctionName: !Join ['', ['DeleteCFNLambda', !Ref buildGuid]]
|
||||||
Code:
|
Code:
|
||||||
ZipFile: |
|
ZipFile: |
|
||||||
import boto3
|
import boto3
|
||||||
|
|
@ -74,7 +74,7 @@ Resources:
|
||||||
- GenerateCronExpression
|
- GenerateCronExpression
|
||||||
Type: 'AWS::Events::Rule'
|
Type: 'AWS::Events::Rule'
|
||||||
Properties:
|
Properties:
|
||||||
Name: !Join ['', ['DeleteStackEventRule', !Ref BUILDID]]
|
Name: !Join ['', ['DeleteStackEventRule', !Ref buildGuid]]
|
||||||
Description: Delete stack event
|
Description: Delete stack event
|
||||||
ScheduleExpression: !GetAtt GenerateCronExpression.cron_exp
|
ScheduleExpression: !GetAtt GenerateCronExpression.cron_exp
|
||||||
State: 'ENABLED'
|
State: 'ENABLED'
|
||||||
|
|
@ -86,14 +86,14 @@ Resources:
|
||||||
DependsOn:
|
DependsOn:
|
||||||
- DeleteStackEventRule
|
- DeleteStackEventRule
|
||||||
Properties:
|
Properties:
|
||||||
FunctionName: !Join ['', ['DeleteCFNLambda', !Ref BUILDID]]
|
FunctionName: !Join ['', ['DeleteCFNLambda', !Ref buildGuid]]
|
||||||
Action: 'lambda:InvokeFunction'
|
Action: 'lambda:InvokeFunction'
|
||||||
Principal: 'events.amazonaws.com'
|
Principal: 'events.amazonaws.com'
|
||||||
SourceArn: !GetAtt DeleteStackEventRule.Arn
|
SourceArn: !GetAtt DeleteStackEventRule.Arn
|
||||||
GenerateCronExpLambda:
|
GenerateCronExpLambda:
|
||||||
Type: 'AWS::Lambda::Function'
|
Type: 'AWS::Lambda::Function'
|
||||||
Properties:
|
Properties:
|
||||||
FunctionName: !Join ['', ['GenerateCronExpressionLambda', !Ref BUILDID]]
|
FunctionName: !Join ['', ['GenerateCronExpressionLambda', !Ref buildGuid]]
|
||||||
Code:
|
Code:
|
||||||
ZipFile: |
|
ZipFile: |
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
|
@ -137,6 +137,6 @@ Resources:
|
||||||
Type: 'Custom::GenerateCronExpression'
|
Type: 'Custom::GenerateCronExpression'
|
||||||
Version: '1.0'
|
Version: '1.0'
|
||||||
Properties:
|
Properties:
|
||||||
Name: !Join ['', ['GenerateCronExpression', !Ref BUILDID]]
|
Name: !Join ['', ['GenerateCronExpression', !Ref buildGuid]]
|
||||||
ServiceToken: !GetAtt GenerateCronExpLambda.Arn
|
ServiceToken: !GetAtt GenerateCronExpLambda.Arn
|
||||||
ttl: !Ref 'TTL'
|
ttl: !Ref 'TTL'
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ Parameters:
|
||||||
Type: Number
|
Type: Number
|
||||||
Default: 2048
|
Default: 2048
|
||||||
Description: How much memory in megabytes to give the container
|
Description: How much memory in megabytes to give the container
|
||||||
BUILDID:
|
buildGuid:
|
||||||
Type: String
|
Type: String
|
||||||
Default: ''
|
Default: ''
|
||||||
Command:
|
Command:
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ class AWSBuildEnvironment implements CloudRunnerProviderInterface {
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async runTask(
|
async runTask(
|
||||||
buildId: string,
|
buildGuid: string,
|
||||||
image: string,
|
image: string,
|
||||||
commands: string,
|
commands: string,
|
||||||
mountdir: string,
|
mountdir: string,
|
||||||
|
|
@ -56,7 +56,7 @@ class AWSBuildEnvironment implements CloudRunnerProviderInterface {
|
||||||
await new AWSBaseStack(this.baseStackName).setupBaseStack(CF);
|
await new AWSBaseStack(this.baseStackName).setupBaseStack(CF);
|
||||||
const taskDef = await new AWSJobStack(this.baseStackName).setupCloudFormations(
|
const taskDef = await new AWSJobStack(this.baseStackName).setupCloudFormations(
|
||||||
CF,
|
CF,
|
||||||
buildId,
|
buildGuid,
|
||||||
image,
|
image,
|
||||||
entrypoint,
|
entrypoint,
|
||||||
commands,
|
commands,
|
||||||
|
|
@ -69,7 +69,7 @@ class AWSBuildEnvironment implements CloudRunnerProviderInterface {
|
||||||
try {
|
try {
|
||||||
const postSetupStacksTimeMs = Date.now();
|
const postSetupStacksTimeMs = Date.now();
|
||||||
CloudRunnerLogger.log(`Setup job time: ${Math.floor((postSetupStacksTimeMs - startTimeMs) / 1000)}s`);
|
CloudRunnerLogger.log(`Setup job time: ${Math.floor((postSetupStacksTimeMs - startTimeMs) / 1000)}s`);
|
||||||
await AWSTaskRunner.runTask(taskDef, ECS, CF, environment, buildId, commands);
|
await AWSTaskRunner.runTask(taskDef, ECS, CF, environment, buildGuid, commands);
|
||||||
postRunTaskTimeMs = Date.now();
|
postRunTaskTimeMs = Date.now();
|
||||||
CloudRunnerLogger.log(`Run job time: ${Math.floor((postRunTaskTimeMs - postSetupStacksTimeMs) / 1000)}s`);
|
CloudRunnerLogger.log(`Run job time: ${Math.floor((postRunTaskTimeMs - postSetupStacksTimeMs) / 1000)}s`);
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue