stop git detatched head info
parent
44966a7ba6
commit
a35c029939
|
|
@ -53,6 +53,7 @@ jobs:
|
||||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||||
AWS_DEFAULT_REGION: eu-west-2
|
AWS_DEFAULT_REGION: eu-west-2
|
||||||
DEBUG: true
|
DEBUG: true
|
||||||
|
baseStackName: game-ci
|
||||||
with:
|
with:
|
||||||
remoteBuildCluster: aws
|
remoteBuildCluster: aws
|
||||||
projectPath: ${{ matrix.projectPath }}
|
projectPath: ${{ matrix.projectPath }}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,10 @@ Parameters:
|
||||||
Type: String
|
Type: String
|
||||||
Default: development
|
Default: development
|
||||||
Description: "Your deployment environment: DEV, QA , PROD"
|
Description: "Your deployment environment: DEV, QA , PROD"
|
||||||
|
Storage:
|
||||||
|
Type: String
|
||||||
|
Default: development
|
||||||
|
Description: "Your deployment environment: DEV, QA , PROD"
|
||||||
|
|
||||||
# ContainerPort:
|
# ContainerPort:
|
||||||
# Type: Number
|
# Type: Number
|
||||||
|
|
@ -352,7 +356,7 @@ Resources:
|
||||||
Type: 'AWS::S3::Bucket'
|
Type: 'AWS::S3::Bucket'
|
||||||
DeletionPolicy: Retain
|
DeletionPolicy: Retain
|
||||||
Properties:
|
Properties:
|
||||||
BucketName: game-ci-storage
|
BucketName: !Ref Storage
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -925,6 +925,7 @@ class AWSBuildEnvironment {
|
||||||
commands[1] += `
|
commands[1] += `
|
||||||
echo "${logid}"
|
echo "${logid}"
|
||||||
`;
|
`;
|
||||||
|
yield this.setupBaseStack(CF);
|
||||||
const taskDefStackName = `${this.stackName}-${buildUid}`;
|
const taskDefStackName = `${this.stackName}-${buildUid}`;
|
||||||
let taskDefCloudFormation = this.readTaskCloudFormationTemplate();
|
let taskDefCloudFormation = this.readTaskCloudFormationTemplate();
|
||||||
const cleanupTaskDefStackName = `${taskDefStackName}-cleanup`;
|
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) {
|
handleStackCreationFailure(error, CF, taskDefStackName, taskDefCloudFormation, secrets) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
core.info(JSON.stringify(secrets, undefined, 4));
|
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] += `
|
commands[1] += `
|
||||||
echo "${logid}"
|
echo "${logid}"
|
||||||
`;
|
`;
|
||||||
|
await this.setupBaseStack(CF);
|
||||||
const taskDefStackName = `${this.stackName}-${buildUid}`;
|
const taskDefStackName = `${this.stackName}-${buildUid}`;
|
||||||
let taskDefCloudFormation = this.readTaskCloudFormationTemplate();
|
let taskDefCloudFormation = this.readTaskCloudFormationTemplate();
|
||||||
const cleanupTaskDefStackName = `${taskDefStackName}-cleanup`;
|
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(
|
async handleStackCreationFailure(
|
||||||
error: any,
|
error: any,
|
||||||
CF: SDK.CloudFormation,
|
CF: SDK.CloudFormation,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue