BUILDID replaced by buildGuid in cloudformation

pull/310/head
Frostebite 2021-12-30 00:36:13 +00:00
parent 0c0e0ae9af
commit 53a84c2c08
6 changed files with 17 additions and 17 deletions

8
dist/index.js vendored
View File

@ -1402,7 +1402,7 @@ class AWSTemplates {
${p1}Secret:
Type: AWS::SecretsManager::Secret
Properties:
Name: !Join [ "", [ '${p1}', !Ref BUILDID ] ]
Name: !Join [ "", [ '${p1}', !Ref buildGuid ] ]
SecretString: !Ref ${p1}
`;
}
@ -1495,7 +1495,7 @@ class AWSBuildEnvironment {
defaultSecretsArray) {
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* () {
process.env.AWS_REGION = __1.Input.region;
const ECS = new SDK.ECS();
@ -1504,12 +1504,12 @@ class AWSBuildEnvironment {
const entrypoint = ['/bin/sh'];
const startTimeMs = Date.now();
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;
try {
const postSetupStacksTimeMs = Date.now();
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();
cloud_runner_logger_1.default.log(`Run job time: ${Math.floor((postRunTaskTimeMs - postSetupStacksTimeMs) / 1000)}s`);
}

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -14,7 +14,7 @@ export class AWSTemplates {
${p1}Secret:
Type: AWS::SecretsManager::Secret
Properties:
Name: !Join [ "", [ '${p1}', !Ref BUILDID ] ]
Name: !Join [ "", [ '${p1}', !Ref buildGuid ] ]
SecretString: !Ref ${p1}
`;
}

View File

@ -18,7 +18,7 @@ Parameters:
Type: String
Default: development
Description: 'Your deployment environment: DEV, QA , PROD'
BUILDID:
buildGuid:
Type: String
Default: ''
StackName:
@ -34,7 +34,7 @@ Resources:
DeleteCFNLambda:
Type: 'AWS::Lambda::Function'
Properties:
FunctionName: !Join ['', ['DeleteCFNLambda', !Ref BUILDID]]
FunctionName: !Join ['', ['DeleteCFNLambda', !Ref buildGuid]]
Code:
ZipFile: |
import boto3
@ -51,7 +51,7 @@ Resources:
stack.delete()
return "SUCCESS"
except:
return "ERROR"
return "ERROR"
def handler(event, context):
print("Received event:")
@ -74,7 +74,7 @@ Resources:
- GenerateCronExpression
Type: 'AWS::Events::Rule'
Properties:
Name: !Join ['', ['DeleteStackEventRule', !Ref BUILDID]]
Name: !Join ['', ['DeleteStackEventRule', !Ref buildGuid]]
Description: Delete stack event
ScheduleExpression: !GetAtt GenerateCronExpression.cron_exp
State: 'ENABLED'
@ -86,14 +86,14 @@ Resources:
DependsOn:
- DeleteStackEventRule
Properties:
FunctionName: !Join ['', ['DeleteCFNLambda', !Ref BUILDID]]
FunctionName: !Join ['', ['DeleteCFNLambda', !Ref buildGuid]]
Action: 'lambda:InvokeFunction'
Principal: 'events.amazonaws.com'
SourceArn: !GetAtt DeleteStackEventRule.Arn
GenerateCronExpLambda:
Type: 'AWS::Lambda::Function'
Properties:
FunctionName: !Join ['', ['GenerateCronExpressionLambda', !Ref BUILDID]]
FunctionName: !Join ['', ['GenerateCronExpressionLambda', !Ref buildGuid]]
Code:
ZipFile: |
from datetime import datetime, timedelta
@ -137,6 +137,6 @@ Resources:
Type: 'Custom::GenerateCronExpression'
Version: '1.0'
Properties:
Name: !Join ['', ['GenerateCronExpression', !Ref BUILDID]]
Name: !Join ['', ['GenerateCronExpression', !Ref buildGuid]]
ServiceToken: !GetAtt GenerateCronExpLambda.Arn
ttl: !Ref 'TTL'

View File

@ -30,7 +30,7 @@ Parameters:
Type: Number
Default: 2048
Description: How much memory in megabytes to give the container
BUILDID:
buildGuid:
Type: String
Default: ''
Command:

View File

@ -38,7 +38,7 @@ class AWSBuildEnvironment implements CloudRunnerProviderInterface {
) {}
async runTask(
buildId: string,
buildGuid: string,
image: string,
commands: string,
mountdir: string,
@ -56,7 +56,7 @@ class AWSBuildEnvironment implements CloudRunnerProviderInterface {
await new AWSBaseStack(this.baseStackName).setupBaseStack(CF);
const taskDef = await new AWSJobStack(this.baseStackName).setupCloudFormations(
CF,
buildId,
buildGuid,
image,
entrypoint,
commands,
@ -69,7 +69,7 @@ class AWSBuildEnvironment implements CloudRunnerProviderInterface {
try {
const postSetupStacksTimeMs = Date.now();
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();
CloudRunnerLogger.log(`Run job time: ${Math.floor((postRunTaskTimeMs - postSetupStacksTimeMs) / 1000)}s`);
} finally {