mirror of
https://github.com/game-ci/unity-builder.git
synced 2026-06-05 13:40:16 -07:00
fix
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
cloud runner build workflow starting
|
||||
cloud runner build workflow starting
|
||||
cloud runner build workflow starting
|
||||
|
||||
@@ -27,6 +27,8 @@ env:
|
||||
DEBUG: true
|
||||
PROJECT_PATH: test-project
|
||||
USE_IL2CPP: false
|
||||
# Increase CloudFormation stack wait time (GitHub Actions runners can be slow)
|
||||
CLOUD_RUNNER_AWS_STACK_WAIT_TIME: 900
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
|
||||
3
.github/workflows/cloud-runner-integrity.yml
vendored
3
.github/workflows/cloud-runner-integrity.yml
vendored
@@ -23,6 +23,8 @@ env:
|
||||
DEBUG: true
|
||||
PROJECT_PATH: test-project
|
||||
USE_IL2CPP: false
|
||||
# Increase CloudFormation stack wait time (GitHub Actions runners can be slow)
|
||||
CLOUD_RUNNER_AWS_STACK_WAIT_TIME: 900
|
||||
|
||||
jobs:
|
||||
cloud-runner-tests:
|
||||
@@ -183,7 +185,6 @@ jobs:
|
||||
exit 1
|
||||
fi
|
||||
- run: yarn install --frozen-lockfile
|
||||
|
||||
# ==========================================
|
||||
# K8S TESTS SECTION
|
||||
# ==========================================
|
||||
|
||||
70
dist/index.js
generated
vendored
70
dist/index.js
generated
vendored
@@ -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`,
|
||||
});
|
||||
|
||||
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,5 +1,4 @@
|
||||
import CloudRunnerLogger from '../../services/core/cloud-runner-logger';
|
||||
import CloudRunnerOptions from '../../options/cloud-runner-options';
|
||||
import * as core from '@actions/core';
|
||||
import {
|
||||
CloudFormation,
|
||||
@@ -21,37 +20,14 @@ 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;
|
||||
const DEFAULT_STACK_WAIT_TIME_SECONDS = 600;
|
||||
|
||||
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 {
|
||||
function getStackWaitTime(): 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;
|
||||
return DEFAULT_STACK_WAIT_TIME_SECONDS;
|
||||
}
|
||||
|
||||
export class AWSBaseStack {
|
||||
@@ -62,14 +38,7 @@ 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 stackWaitTimeSeconds = getStackWaitTime();
|
||||
|
||||
const baseStack = BaseStackFormation.formation;
|
||||
|
||||
@@ -101,7 +70,13 @@ export class AWSBaseStack {
|
||||
|
||||
const stacks = await CF.send(
|
||||
new 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) || [];
|
||||
|
||||
@@ -18,6 +18,16 @@ import { CleanupCronFormation } from './cloud-formations/cleanup-cron-formation'
|
||||
import CloudRunnerOptions from '../../options/cloud-runner-options';
|
||||
import { TaskDefinitionFormation } from './cloud-formations/task-definition-formation';
|
||||
|
||||
const DEFAULT_STACK_WAIT_TIME_SECONDS = 600;
|
||||
|
||||
function getStackWaitTime(): number {
|
||||
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;
|
||||
}
|
||||
|
||||
export class AWSJobStack {
|
||||
private baseStackName: string;
|
||||
constructor(baseStackName: string) {
|
||||
@@ -148,12 +158,15 @@ export class AWSJobStack {
|
||||
Parameters: parameters,
|
||||
};
|
||||
try {
|
||||
CloudRunnerLogger.log(`Creating job aws formation ${taskDefStackName}`);
|
||||
const stackWaitTimeSeconds = getStackWaitTime();
|
||||
CloudRunnerLogger.log(
|
||||
`Creating job aws formation ${taskDefStackName} (waiting up to ${stackWaitTimeSeconds}s for completion)`,
|
||||
);
|
||||
await CF.send(new CreateStackCommand(createStackInput));
|
||||
await waitUntilStackCreateComplete(
|
||||
{
|
||||
client: CF,
|
||||
maxWaitTime: 200,
|
||||
maxWaitTime: stackWaitTimeSeconds,
|
||||
},
|
||||
{ StackName: taskDefStackName },
|
||||
);
|
||||
|
||||
@@ -17,6 +17,16 @@ import CloudRunnerOptions from '../../options/cloud-runner-options';
|
||||
import { AwsClientFactory } from './aws-client-factory';
|
||||
import ResourceTracking from '../../services/core/resource-tracking';
|
||||
|
||||
const DEFAULT_STACK_WAIT_TIME_SECONDS = 600;
|
||||
|
||||
function getStackWaitTime(): number {
|
||||
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 implements ProviderInterface {
|
||||
private baseStackName: string;
|
||||
|
||||
@@ -133,7 +143,8 @@ class AWSBuildEnvironment implements ProviderInterface {
|
||||
}
|
||||
|
||||
async cleanupResources(CF: CloudFormation, taskDef: CloudRunnerAWSTaskDef) {
|
||||
CloudRunnerLogger.log('Cleanup starting');
|
||||
const stackWaitTimeSeconds = getStackWaitTime();
|
||||
CloudRunnerLogger.log(`Cleanup starting (waiting up to ${stackWaitTimeSeconds}s for stack deletion)`);
|
||||
await CF.send(new DeleteStackCommand({ StackName: taskDef.taskDefStackName }));
|
||||
if (CloudRunnerOptions.useCleanupCron) {
|
||||
await CF.send(new DeleteStackCommand({ StackName: `${taskDef.taskDefStackName}-cleanup` }));
|
||||
@@ -142,7 +153,7 @@ class AWSBuildEnvironment implements ProviderInterface {
|
||||
await waitUntilStackDeleteComplete(
|
||||
{
|
||||
client: CF,
|
||||
maxWaitTime: 200,
|
||||
maxWaitTime: stackWaitTimeSeconds,
|
||||
},
|
||||
{
|
||||
StackName: taskDef.taskDefStackName,
|
||||
@@ -151,7 +162,7 @@ class AWSBuildEnvironment implements ProviderInterface {
|
||||
await waitUntilStackDeleteComplete(
|
||||
{
|
||||
client: CF,
|
||||
maxWaitTime: 200,
|
||||
maxWaitTime: stackWaitTimeSeconds,
|
||||
},
|
||||
{
|
||||
StackName: `${taskDef.taskDefStackName}-cleanup`,
|
||||
|
||||
@@ -174,9 +174,7 @@ class Kubernetes implements ProviderInterface {
|
||||
|
||||
for (const NODE of K3D_NODE_CONTAINERS) {
|
||||
// Remove all stopped containers (this frees runtime space but keeps images)
|
||||
cleanupCommands.push(
|
||||
`docker exec ${NODE} sh -c "crictl rm --all 2>/dev/null || true" || true`,
|
||||
);
|
||||
cleanupCommands.push(`docker exec ${NODE} sh -c "crictl rm --all 2>/dev/null || true" || true`);
|
||||
// Remove non-Unity images only (preserve unityci/editor images to avoid re-pulling 3.9GB)
|
||||
// This is safe because we explicitly exclude Unity images from deletion
|
||||
cleanupCommands.push(
|
||||
|
||||
@@ -44,7 +44,7 @@ describe('Cloud Runner pre-built S3 steps', () => {
|
||||
it('Run build and prebuilt s3 cache pull, cache push and upload build', async () => {
|
||||
const cacheKey = `test-case-${uuidv4()}`;
|
||||
const buildGuid = `test-build-${uuidv4()}`;
|
||||
|
||||
|
||||
// Use customJob to run only S3 hooks without a full Unity build
|
||||
// This is a quick validation test for S3 operations, not a full build test
|
||||
const overrides = {
|
||||
|
||||
@@ -34,3 +34,21 @@
|
||||
[Client] Error: Command failed: rclone lsf local:./temp/rclone-remote
|
||||
2026/01/03 15:36:12 CRITICAL: Failed to create file system for "local:./temp/rclone-remote": didn't find section in config file ("local")
|
||||
|
||||
[Client] bash -lc 'mkdir -p /data/cache/$CACHE_KEY/Library/ ; mkdir -p /data/cache/$CACHE_KEY/lfs/ ; if command -v rclone > /dev/null 2>&1; then ; rclone copy local:./temp/rclone-remote/cloud-runner-cache/$CACHE_KEY/Library /data/cache/$CACHE_KEY/Library/ || true ; rclone copy local:./temp/rclone-remote/cloud-runner-cache/$CACHE_KEY/lfs /data/cache/$CACHE_KEY/lfs/ || true ; else ; echo "rclone not available, skipping rclone-pull-cache" ; fi'
|
||||
[Client] [0]
|
||||
[Client] The system cannot find the path specified.
|
||||
[Client]
|
||||
[Client] bash -lc 'echo "cloud runner build workflow starting" ; # skipping apt-get in local-docker or non-container provider ; # skipping toolchain setup in local-docker or non-container provider ; export GITHUB_WORKSPACE="/data/0-linux64-03js/repo" ; # skipping df on /data in non-container provider ; export LOG_FILE=$(pwd)/temp/job-log.txt ; export GIT_DISCOVERY_ACROSS_FILESYSTEM=1 ; mkdir -p "$(dirname "$LOG_FILE")" ; echo "log start" >> "$LOG_FILE" ; echo "CACHE_KEY=$CACHE_KEY" ; echo "game ci start" ; echo "game ci start" >> "$LOG_FILE" ; timeout 3s node C:/unity-builder/dist/index.js -m remote-cli-log-stream --logFile "$LOG_FILE" || true ; node C:/unity-builder/dist/index.js -m remote-cli-post-build'
|
||||
[Client] [0]
|
||||
[Client]
|
||||
[Client] bash -lc 'if command -v rclone > /dev/null 2>&1; then ; rclone copy /data/cache/$CACHE_KEY/build/build-0-linux64-03js.tar local:./temp/rclone-remote/cloud-runner-cache/$CACHE_KEY/build/ || true ; rm /data/cache/$CACHE_KEY/build/build-0-linux64-03js.tar || true ; else ; echo "rclone not available, skipping rclone-upload-build" ; fi'
|
||||
[Client] [0]
|
||||
[Client] The system cannot find the path specified.
|
||||
[Client]
|
||||
[Client] bash -lc 'if command -v rclone > /dev/null 2>&1; then ; rclone copy /data/cache/$CACHE_KEY/lfs local:./temp/rclone-remote/cloud-runner-cache/$CACHE_KEY/lfs || true ; rm -r /data/cache/$CACHE_KEY/lfs || true ; rclone copy /data/cache/$CACHE_KEY/Library local:./temp/rclone-remote/cloud-runner-cache/$CACHE_KEY/Library || true ; rm -r /data/cache/$CACHE_KEY/Library || true ; else ; echo "rclone not available, skipping rclone-upload-cache" ; fi'
|
||||
[Client] [0]
|
||||
[Client] The system cannot find the path specified.
|
||||
[Client]
|
||||
[Client] Error: Command failed: rclone lsf local:./temp/rclone-remote
|
||||
2026/01/26 09:04:07 CRITICAL: Failed to create file system for "local:./temp/rclone-remote": didn't find section in config file ("local")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user