mirror of
https://github.com/game-ci/unity-builder.git
synced 2026-06-13 09:23:52 -07:00
fix
This commit is contained in:
+34
-36
@@ -1573,39 +1573,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.AWSBaseStack = void 0;
|
||||
const cloud_runner_logger_1 = __importDefault(__nccwpck_require__(42864));
|
||||
const cloud_runner_options_1 = __importDefault(__nccwpck_require__(66965));
|
||||
const core = __importStar(__nccwpck_require__(42186));
|
||||
const client_cloudformation_1 = __nccwpck_require__(15650);
|
||||
const base_stack_formation_1 = __nccwpck_require__(29643);
|
||||
const node_crypto_1 = __importDefault(__nccwpck_require__(6005));
|
||||
const LOCALSTACK_ENDPOINT_PATTERN = /localstack|localhost|127\.0\.0\.1/i;
|
||||
const LOCALSTACK_WAIT_TIME_SECONDS = 600;
|
||||
const DEFAULT_STACK_WAIT_TIME_SECONDS = 200;
|
||||
function detectLocalStackEnvironment() {
|
||||
const endpoints = [
|
||||
process.env.AWS_ENDPOINT,
|
||||
process.env.AWS_S3_ENDPOINT,
|
||||
process.env.AWS_CLOUD_FORMATION_ENDPOINT,
|
||||
process.env.AWS_ECS_ENDPOINT,
|
||||
process.env.AWS_KINESIS_ENDPOINT,
|
||||
process.env.AWS_CLOUD_WATCH_LOGS_ENDPOINT,
|
||||
cloud_runner_options_1.default.awsEndpoint,
|
||||
cloud_runner_options_1.default.awsS3Endpoint,
|
||||
cloud_runner_options_1.default.awsCloudFormationEndpoint,
|
||||
cloud_runner_options_1.default.awsEcsEndpoint,
|
||||
cloud_runner_options_1.default.awsKinesisEndpoint,
|
||||
cloud_runner_options_1.default.awsCloudWatchLogsEndpoint,
|
||||
]
|
||||
.filter((endpoint) => endpoint !== undefined && endpoint !== '')
|
||||
.join(' ');
|
||||
return LOCALSTACK_ENDPOINT_PATTERN.test(endpoints);
|
||||
}
|
||||
function determineStackWaitTime(isLocalStack) {
|
||||
const DEFAULT_STACK_WAIT_TIME_SECONDS = 600;
|
||||
function getStackWaitTime() {
|
||||
const overrideValue = Number(process.env.CLOUD_RUNNER_AWS_STACK_WAIT_TIME ?? '');
|
||||
if (!Number.isNaN(overrideValue) && overrideValue > 0) {
|
||||
return overrideValue;
|
||||
}
|
||||
return isLocalStack ? LOCALSTACK_WAIT_TIME_SECONDS : DEFAULT_STACK_WAIT_TIME_SECONDS;
|
||||
return DEFAULT_STACK_WAIT_TIME_SECONDS;
|
||||
}
|
||||
class AWSBaseStack {
|
||||
constructor(baseStackName) {
|
||||
@@ -1613,11 +1591,7 @@ class AWSBaseStack {
|
||||
}
|
||||
async setupBaseStack(CF) {
|
||||
const baseStackName = this.baseStackName;
|
||||
const isLocalStack = detectLocalStackEnvironment();
|
||||
const stackWaitTimeSeconds = determineStackWaitTime(isLocalStack);
|
||||
if (isLocalStack) {
|
||||
cloud_runner_logger_1.default.log(`LocalStack endpoints detected; will wait up to ${stackWaitTimeSeconds}s for CloudFormation transitions`);
|
||||
}
|
||||
const stackWaitTimeSeconds = getStackWaitTime();
|
||||
const baseStack = base_stack_formation_1.BaseStackFormation.formation;
|
||||
// Cloud Formation Input
|
||||
const describeStackInput = {
|
||||
@@ -1645,7 +1619,13 @@ class AWSBaseStack {
|
||||
Capabilities: ['CAPABILITY_IAM'],
|
||||
};
|
||||
const stacks = await CF.send(new client_cloudformation_1.ListStacksCommand({
|
||||
StackStatusFilter: ['CREATE_IN_PROGRESS', 'UPDATE_IN_PROGRESS', 'UPDATE_COMPLETE', 'CREATE_COMPLETE', 'ROLLBACK_COMPLETE'],
|
||||
StackStatusFilter: [
|
||||
'CREATE_IN_PROGRESS',
|
||||
'UPDATE_IN_PROGRESS',
|
||||
'UPDATE_COMPLETE',
|
||||
'CREATE_COMPLETE',
|
||||
'ROLLBACK_COMPLETE',
|
||||
],
|
||||
}));
|
||||
const stackNames = stacks.StackSummaries?.map((x) => x.StackName) || [];
|
||||
const stackExists = stackNames.includes(baseStackName);
|
||||
@@ -1937,6 +1917,14 @@ const cloud_runner_1 = __importDefault(__nccwpck_require__(79144));
|
||||
const cleanup_cron_formation_1 = __nccwpck_require__(26162);
|
||||
const cloud_runner_options_1 = __importDefault(__nccwpck_require__(66965));
|
||||
const task_definition_formation_1 = __nccwpck_require__(97647);
|
||||
const DEFAULT_STACK_WAIT_TIME_SECONDS = 600;
|
||||
function getStackWaitTime() {
|
||||
const overrideValue = Number(process.env.CLOUD_RUNNER_AWS_STACK_WAIT_TIME ?? '');
|
||||
if (!Number.isNaN(overrideValue) && overrideValue > 0) {
|
||||
return overrideValue;
|
||||
}
|
||||
return DEFAULT_STACK_WAIT_TIME_SECONDS;
|
||||
}
|
||||
class AWSJobStack {
|
||||
constructor(baseStackName) {
|
||||
this.baseStackName = baseStackName;
|
||||
@@ -2029,11 +2017,12 @@ class AWSJobStack {
|
||||
Parameters: parameters,
|
||||
};
|
||||
try {
|
||||
cloud_runner_logger_1.default.log(`Creating job aws formation ${taskDefStackName}`);
|
||||
const stackWaitTimeSeconds = getStackWaitTime();
|
||||
cloud_runner_logger_1.default.log(`Creating job aws formation ${taskDefStackName} (waiting up to ${stackWaitTimeSeconds}s for completion)`);
|
||||
await CF.send(new client_cloudformation_1.CreateStackCommand(createStackInput));
|
||||
await (0, client_cloudformation_1.waitUntilStackCreateComplete)({
|
||||
client: CF,
|
||||
maxWaitTime: 200,
|
||||
maxWaitTime: stackWaitTimeSeconds,
|
||||
}, { StackName: taskDefStackName });
|
||||
const describeStack = await CF.send(new client_cloudformation_1.DescribeStacksCommand({ StackName: taskDefStackName }));
|
||||
for (const parameter of parameters) {
|
||||
@@ -3124,6 +3113,14 @@ const task_service_1 = __nccwpck_require__(67205);
|
||||
const cloud_runner_options_1 = __importDefault(__nccwpck_require__(66965));
|
||||
const aws_client_factory_1 = __nccwpck_require__(30161);
|
||||
const resource_tracking_1 = __importDefault(__nccwpck_require__(28819));
|
||||
const DEFAULT_STACK_WAIT_TIME_SECONDS = 600;
|
||||
function getStackWaitTime() {
|
||||
const overrideValue = Number(process.env.CLOUD_RUNNER_AWS_STACK_WAIT_TIME ?? '');
|
||||
if (!Number.isNaN(overrideValue) && overrideValue > 0) {
|
||||
return overrideValue;
|
||||
}
|
||||
return DEFAULT_STACK_WAIT_TIME_SECONDS;
|
||||
}
|
||||
class AWSBuildEnvironment {
|
||||
constructor(buildParameters) {
|
||||
this.baseStackName = buildParameters.awsStackName;
|
||||
@@ -3207,20 +3204,21 @@ class AWSBuildEnvironment {
|
||||
}
|
||||
}
|
||||
async cleanupResources(CF, taskDef) {
|
||||
cloud_runner_logger_1.default.log('Cleanup starting');
|
||||
const stackWaitTimeSeconds = getStackWaitTime();
|
||||
cloud_runner_logger_1.default.log(`Cleanup starting (waiting up to ${stackWaitTimeSeconds}s for stack deletion)`);
|
||||
await CF.send(new client_cloudformation_1.DeleteStackCommand({ StackName: taskDef.taskDefStackName }));
|
||||
if (cloud_runner_options_1.default.useCleanupCron) {
|
||||
await CF.send(new client_cloudformation_1.DeleteStackCommand({ StackName: `${taskDef.taskDefStackName}-cleanup` }));
|
||||
}
|
||||
await (0, client_cloudformation_1.waitUntilStackDeleteComplete)({
|
||||
client: CF,
|
||||
maxWaitTime: 200,
|
||||
maxWaitTime: stackWaitTimeSeconds,
|
||||
}, {
|
||||
StackName: taskDef.taskDefStackName,
|
||||
});
|
||||
await (0, client_cloudformation_1.waitUntilStackDeleteComplete)({
|
||||
client: CF,
|
||||
maxWaitTime: 200,
|
||||
maxWaitTime: stackWaitTimeSeconds,
|
||||
}, {
|
||||
StackName: `${taskDef.taskDefStackName}-cleanup`,
|
||||
});
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user