mirror of
https://github.com/game-ci/unity-builder.git
synced 2026-01-29 12:19:06 +08:00
fixes
This commit is contained in:
41
dist/index.js
generated
vendored
41
dist/index.js
generated
vendored
@@ -1573,16 +1573,51 @@ 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 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;
|
||||
}
|
||||
class AWSBaseStack {
|
||||
constructor(baseStackName) {
|
||||
this.baseStackName = baseStackName;
|
||||
}
|
||||
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 baseStack = base_stack_formation_1.BaseStackFormation.formation;
|
||||
// Cloud Formation Input
|
||||
const describeStackInput = {
|
||||
@@ -1645,9 +1680,10 @@ class AWSBaseStack {
|
||||
}
|
||||
const stackVersion = stack.Parameters?.find((x) => x.ParameterKey === 'Version')?.ParameterValue;
|
||||
if (stack.StackStatus === 'CREATE_IN_PROGRESS') {
|
||||
cloud_runner_logger_1.default.log(`Waiting up to ${stackWaitTimeSeconds}s for '${baseStackName}' CloudFormation creation to finish`);
|
||||
await (0, client_cloudformation_1.waitUntilStackCreateComplete)({
|
||||
client: CF,
|
||||
maxWaitTime: 200,
|
||||
maxWaitTime: stackWaitTimeSeconds,
|
||||
}, describeStackInput);
|
||||
}
|
||||
if (stackExists) {
|
||||
@@ -1676,9 +1712,10 @@ class AWSBaseStack {
|
||||
throw new Error(`Base stack doesn't exist, even after updating and creation, stackExists check: ${stackExists}`);
|
||||
}
|
||||
if (stack.StackStatus === 'UPDATE_IN_PROGRESS') {
|
||||
cloud_runner_logger_1.default.log(`Waiting up to ${stackWaitTimeSeconds}s for '${baseStackName}' CloudFormation update to finish`);
|
||||
await (0, client_cloudformation_1.waitUntilStackUpdateComplete)({
|
||||
client: CF,
|
||||
maxWaitTime: 200,
|
||||
maxWaitTime: stackWaitTimeSeconds,
|
||||
}, describeStackInput);
|
||||
}
|
||||
}
|
||||
|
||||
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
@@ -1,4 +1,5 @@
|
||||
import CloudRunnerLogger from '../../services/core/cloud-runner-logger';
|
||||
import CloudRunnerOptions from '../../options/cloud-runner-options';
|
||||
import * as core from '@actions/core';
|
||||
import {
|
||||
CloudFormation,
|
||||
@@ -20,6 +21,39 @@ import {
|
||||
import { BaseStackFormation } from './cloud-formations/base-stack-formation';
|
||||
import crypto from 'node:crypto';
|
||||
|
||||
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(): boolean {
|
||||
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,
|
||||
CloudRunnerOptions.awsEndpoint,
|
||||
CloudRunnerOptions.awsS3Endpoint,
|
||||
CloudRunnerOptions.awsCloudFormationEndpoint,
|
||||
CloudRunnerOptions.awsEcsEndpoint,
|
||||
CloudRunnerOptions.awsKinesisEndpoint,
|
||||
CloudRunnerOptions.awsCloudWatchLogsEndpoint,
|
||||
]
|
||||
.filter((endpoint) => endpoint !== undefined && endpoint !== '')
|
||||
.join(' ');
|
||||
return LOCALSTACK_ENDPOINT_PATTERN.test(endpoints);
|
||||
}
|
||||
|
||||
function determineStackWaitTime(isLocalStack: boolean): number {
|
||||
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;
|
||||
}
|
||||
|
||||
export class AWSBaseStack {
|
||||
constructor(baseStackName: string) {
|
||||
this.baseStackName = baseStackName;
|
||||
@@ -28,6 +62,14 @@ export class AWSBaseStack {
|
||||
|
||||
async setupBaseStack(CF: CloudFormation) {
|
||||
const baseStackName = this.baseStackName;
|
||||
const isLocalStack = detectLocalStackEnvironment();
|
||||
const stackWaitTimeSeconds = determineStackWaitTime(isLocalStack);
|
||||
|
||||
if (isLocalStack) {
|
||||
CloudRunnerLogger.log(
|
||||
`LocalStack endpoints detected; will wait up to ${stackWaitTimeSeconds}s for CloudFormation transitions`,
|
||||
);
|
||||
}
|
||||
|
||||
const baseStack = BaseStackFormation.formation;
|
||||
|
||||
@@ -94,10 +136,13 @@ export class AWSBaseStack {
|
||||
const stackVersion = stack.Parameters?.find((x) => x.ParameterKey === 'Version')?.ParameterValue;
|
||||
|
||||
if (stack.StackStatus === 'CREATE_IN_PROGRESS') {
|
||||
CloudRunnerLogger.log(
|
||||
`Waiting up to ${stackWaitTimeSeconds}s for '${baseStackName}' CloudFormation creation to finish`,
|
||||
);
|
||||
await waitUntilStackCreateComplete(
|
||||
{
|
||||
client: CF,
|
||||
maxWaitTime: 200,
|
||||
maxWaitTime: stackWaitTimeSeconds,
|
||||
},
|
||||
describeStackInput,
|
||||
);
|
||||
@@ -128,10 +173,13 @@ export class AWSBaseStack {
|
||||
);
|
||||
}
|
||||
if (stack.StackStatus === 'UPDATE_IN_PROGRESS') {
|
||||
CloudRunnerLogger.log(
|
||||
`Waiting up to ${stackWaitTimeSeconds}s for '${baseStackName}' CloudFormation update to finish`,
|
||||
);
|
||||
await waitUntilStackUpdateComplete(
|
||||
{
|
||||
client: CF,
|
||||
maxWaitTime: 200,
|
||||
maxWaitTime: stackWaitTimeSeconds,
|
||||
},
|
||||
describeStackInput,
|
||||
);
|
||||
|
||||
BIN
temp/gh-logs/integrity_21321196620.log
Normal file
BIN
temp/gh-logs/integrity_21321196620.log
Normal file
Binary file not shown.
Reference in New Issue
Block a user