stop git detatched head info
parent
44966a7ba6
commit
a35c029939
|
|
@ -53,6 +53,7 @@ jobs:
|
|||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||
AWS_DEFAULT_REGION: eu-west-2
|
||||
DEBUG: true
|
||||
baseStackName: game-ci
|
||||
with:
|
||||
remoteBuildCluster: aws
|
||||
projectPath: ${{ matrix.projectPath }}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,10 @@ Parameters:
|
|||
Type: String
|
||||
Default: development
|
||||
Description: "Your deployment environment: DEV, QA , PROD"
|
||||
Storage:
|
||||
Type: String
|
||||
Default: development
|
||||
Description: "Your deployment environment: DEV, QA , PROD"
|
||||
|
||||
# ContainerPort:
|
||||
# Type: Number
|
||||
|
|
@ -250,7 +254,7 @@ Resources:
|
|||
- 'logs:CreateLogStream'
|
||||
- 'logs:PutLogEvents'
|
||||
Resource: '*'
|
||||
|
||||
|
||||
DeleteCFNLambdaExecutionRole:
|
||||
Type: "AWS::IAM::Role"
|
||||
Properties:
|
||||
|
|
@ -352,7 +356,7 @@ Resources:
|
|||
Type: 'AWS::S3::Bucket'
|
||||
DeletionPolicy: Retain
|
||||
Properties:
|
||||
BucketName: game-ci-storage
|
||||
BucketName: !Ref Storage
|
||||
|
||||
|
||||
|
||||
|
|
@ -388,7 +392,7 @@ Outputs:
|
|||
Value: !GetAtt 'ECSTaskExecutionRole.Arn'
|
||||
Export:
|
||||
Name: !Sub ${EnvironmentName}:ECSTaskExecutionRole
|
||||
|
||||
|
||||
DeleteCFNLambdaExecutionRole:
|
||||
Description: Lambda execution role for cleaning up cloud formations
|
||||
Value: !GetAtt 'DeleteCFNLambdaExecutionRole.Arn'
|
||||
|
|
|
|||
|
|
@ -925,6 +925,7 @@ class AWSBuildEnvironment {
|
|||
commands[1] += `
|
||||
echo "${logid}"
|
||||
`;
|
||||
yield this.setupBaseStack(CF);
|
||||
const taskDefStackName = `${this.stackName}-${buildUid}`;
|
||||
let taskDefCloudFormation = this.readTaskCloudFormationTemplate();
|
||||
const cleanupTaskDefStackName = `${taskDefStackName}-cleanup`;
|
||||
|
|
@ -1020,6 +1021,34 @@ class AWSBuildEnvironment {
|
|||
};
|
||||
});
|
||||
}
|
||||
setupBaseStack(CF) {
|
||||
var _a;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let createBaseStack = true;
|
||||
const baseStackName = process.env.baseStackName || 'game-ci-base-stack-01';
|
||||
const baseStack = fs.readFileSync(`${__dirname}/cloud-formations/base-setup.yml`, 'utf8');
|
||||
for (const stack of ((_a = (yield CF.listStacks().promise())) === null || _a === void 0 ? void 0 : _a.StackSummaries) || []) {
|
||||
if (stack.StackName === baseStackName) {
|
||||
const updateInput = {
|
||||
StackName: baseStackName,
|
||||
TemplateBody: baseStack,
|
||||
};
|
||||
yield CF.updateStack(updateInput).promise();
|
||||
createBaseStack = false;
|
||||
}
|
||||
}
|
||||
if (createBaseStack) {
|
||||
yield CF.createStack({
|
||||
StackName: baseStackName,
|
||||
TemplateBody: baseStack,
|
||||
Parameters: [
|
||||
{ ParameterKey: 'EnvironmentName', ParameterValue: 'development' },
|
||||
{ ParameterKey: 'Storage', ParameterValue: `${baseStackName}-storage` },
|
||||
],
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
handleStackCreationFailure(error, CF, taskDefStackName, taskDefCloudFormation, secrets) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
core.info(JSON.stringify(secrets, undefined, 4));
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -112,6 +112,7 @@ class AWSBuildEnvironment implements RemoteBuilderProviderInterface {
|
|||
commands[1] += `
|
||||
echo "${logid}"
|
||||
`;
|
||||
await this.setupBaseStack(CF);
|
||||
const taskDefStackName = `${this.stackName}-${buildUid}`;
|
||||
let taskDefCloudFormation = this.readTaskCloudFormationTemplate();
|
||||
const cleanupTaskDefStackName = `${taskDefStackName}-cleanup`;
|
||||
|
|
@ -228,6 +229,34 @@ class AWSBuildEnvironment implements RemoteBuilderProviderInterface {
|
|||
};
|
||||
}
|
||||
|
||||
async setupBaseStack(CF: SDK.CloudFormation) {
|
||||
let createBaseStack: Boolean = true;
|
||||
const baseStackName = process.env.baseStackName || 'game-ci-base-stack-01';
|
||||
const baseStack = fs.readFileSync(`${__dirname}/cloud-formations/base-setup.yml`, 'utf8');
|
||||
for (const stack of (await CF.listStacks().promise())?.StackSummaries || []) {
|
||||
if (stack.StackName === baseStackName) {
|
||||
const updateInput: SDK.CloudFormation.UpdateStackInput = {
|
||||
StackName: baseStackName,
|
||||
TemplateBody: baseStack,
|
||||
};
|
||||
await CF.updateStack(updateInput).promise();
|
||||
createBaseStack = false;
|
||||
}
|
||||
}
|
||||
if (createBaseStack) {
|
||||
await CF.createStack({
|
||||
StackName: baseStackName,
|
||||
TemplateBody: baseStack,
|
||||
Parameters: [
|
||||
{ ParameterKey: 'EnvironmentName', ParameterValue: 'development' },
|
||||
{ ParameterKey: 'Storage', ParameterValue: `${baseStackName}-storage` },
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
// wait for base stack to be finished...
|
||||
}
|
||||
|
||||
async handleStackCreationFailure(
|
||||
error: any,
|
||||
CF: SDK.CloudFormation,
|
||||
|
|
|
|||
Loading…
Reference in New Issue