pr feedback

pull/767/head
Frostebite 2025-12-09 20:44:47 +00:00
parent ebbb1d4150
commit 6e82b74240
12 changed files with 31 additions and 21 deletions

14
dist/index.js vendored
View File

@ -3213,6 +3213,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.TaskService = void 0; exports.TaskService = void 0;
const client_cloudformation_1 = __nccwpck_require__(15650); const client_cloudformation_1 = __nccwpck_require__(15650);
// eslint-disable-next-line import/named
const client_cloudwatch_logs_1 = __nccwpck_require__(31573); const client_cloudwatch_logs_1 = __nccwpck_require__(31573);
const client_ecs_1 = __nccwpck_require__(18209); const client_ecs_1 = __nccwpck_require__(18209);
const client_s3_1 = __nccwpck_require__(19250); const client_s3_1 = __nccwpck_require__(19250);
@ -4004,9 +4005,9 @@ class KubernetesPods {
errorDetails.push(`Recent events: ${JSON.stringify(events.slice(-5), undefined, 2)}`); errorDetails.push(`Recent events: ${JSON.stringify(events.slice(-5), undefined, 2)}`);
} }
// Check if only PreStopHook failed but container succeeded // Check if only PreStopHook failed but container succeeded
const hasPreStopHookFailure = events.some((e) => e.reason === 'FailedPreStopHook'); const hasPreStopHookFailure = events.some((event) => event.reason === 'FailedPreStopHook');
const wasKilled = events.some((e) => e.reason === 'Killing'); const wasKilled = events.some((event) => event.reason === 'Killing');
const hasExceededGracePeriod = events.some((e) => e.reason === 'ExceededGracePeriod'); const hasExceededGracePeriod = events.some((event) => event.reason === 'ExceededGracePeriod');
// If container succeeded (exit code 0), PreStopHook failure is non-critical // If container succeeded (exit code 0), PreStopHook failure is non-critical
// Also check if pod was killed but container might have succeeded // Also check if pod was killed but container might have succeeded
if (containerSucceeded && containerExitCode === 0) { if (containerSucceeded && containerExitCode === 0) {
@ -5622,7 +5623,8 @@ class RemoteClient {
} }
if (!build_parameters_1.default.shouldUseRetainedWorkspaceMode(cloud_runner_1.default.buildParameters)) { if (!build_parameters_1.default.shouldUseRetainedWorkspaceMode(cloud_runner_1.default.buildParameters)) {
const uniqueJobFolderLinux = cloud_runner_folders_1.CloudRunnerFolders.ToLinuxFolder(cloud_runner_folders_1.CloudRunnerFolders.uniqueCloudRunnerJobFolderAbsolute); const uniqueJobFolderLinux = cloud_runner_folders_1.CloudRunnerFolders.ToLinuxFolder(cloud_runner_folders_1.CloudRunnerFolders.uniqueCloudRunnerJobFolderAbsolute);
if (node_fs_1.default.existsSync(cloud_runner_folders_1.CloudRunnerFolders.uniqueCloudRunnerJobFolderAbsolute) || node_fs_1.default.existsSync(uniqueJobFolderLinux)) { if (node_fs_1.default.existsSync(cloud_runner_folders_1.CloudRunnerFolders.uniqueCloudRunnerJobFolderAbsolute) ||
node_fs_1.default.existsSync(uniqueJobFolderLinux)) {
await cloud_runner_system_1.CloudRunnerSystem.Run(`rm -r ${uniqueJobFolderLinux} || true`); await cloud_runner_system_1.CloudRunnerSystem.Run(`rm -r ${uniqueJobFolderLinux} || true`);
} }
else { else {
@ -6324,7 +6326,7 @@ class SharedWorkspaceLocking {
try { try {
const output = await SharedWorkspaceLocking.rclone(`lsjson ${path}`); const output = await SharedWorkspaceLocking.rclone(`lsjson ${path}`);
const json = JSON.parse(output); const json = JSON.parse(output);
return json.map((e) => (e.IsDir ? `${e.Name}/` : e.Name)); return json.map((entry) => (entry.IsDir ? `${entry.Name}/` : entry.Name));
} }
catch { catch {
return []; return [];
@ -7318,7 +7320,7 @@ git config --global filter.lfs.smudge "git-lfs smudge --skip -- %f"
git config --global filter.lfs.process "git-lfs filter-process --skip" git config --global filter.lfs.process "git-lfs filter-process --skip"
BRANCH="${cloud_runner_1.default.buildParameters.cloudRunnerBranch}" BRANCH="${cloud_runner_1.default.buildParameters.cloudRunnerBranch}"
REPO="${cloud_runner_folders_1.CloudRunnerFolders.unityBuilderRepoUrl}" REPO="${cloud_runner_folders_1.CloudRunnerFolders.unityBuilderRepoUrl}"
if [ -n "$(git ls-remote --heads \"$REPO\" \"$BRANCH\" 2>/dev/null)" ]; then if [ -n "$(git ls-remote --heads "$REPO" "$BRANCH" 2>/dev/null)" ]; then
git clone -q -b "$BRANCH" "$REPO" /builder git clone -q -b "$BRANCH" "$REPO" /builder
else else
echo "Remote branch $BRANCH not found in $REPO; falling back to a known branch" echo "Remote branch $BRANCH not found in $REPO; falling back to a known branch"

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -3,12 +3,16 @@ import * as core from '@actions/core';
import { import {
CloudFormation, CloudFormation,
CreateStackCommand, CreateStackCommand,
// eslint-disable-next-line import/named
CreateStackCommandInput, CreateStackCommandInput,
DescribeStacksCommand, DescribeStacksCommand,
// eslint-disable-next-line import/named
DescribeStacksCommandInput, DescribeStacksCommandInput,
ListStacksCommand, ListStacksCommand,
// eslint-disable-next-line import/named
Parameter, Parameter,
UpdateStackCommand, UpdateStackCommand,
// eslint-disable-next-line import/named
UpdateStackCommandInput, UpdateStackCommandInput,
waitUntilStackCreateComplete, waitUntilStackCreateComplete,
waitUntilStackUpdateComplete, waitUntilStackUpdateComplete,

View File

@ -1,6 +1,7 @@
import { import {
CloudFormation, CloudFormation,
CreateStackCommand, CreateStackCommand,
// eslint-disable-next-line import/named
CreateStackCommandInput, CreateStackCommandInput,
DescribeStackResourcesCommand, DescribeStackResourcesCommand,
DescribeStacksCommand, DescribeStacksCommand,

View File

@ -1,3 +1,4 @@
// eslint-disable-next-line import/named
import { StackResource } from '@aws-sdk/client-cloudformation'; import { StackResource } from '@aws-sdk/client-cloudformation';
class CloudRunnerAWSTaskDef { class CloudRunnerAWSTaskDef {

View File

@ -4,6 +4,7 @@ import {
ListStacksCommand, ListStacksCommand,
} from '@aws-sdk/client-cloudformation'; } from '@aws-sdk/client-cloudformation';
import type { StackSummary } from '@aws-sdk/client-cloudformation'; import type { StackSummary } from '@aws-sdk/client-cloudformation';
// eslint-disable-next-line import/named
import { DescribeLogGroupsCommand, DescribeLogGroupsCommandInput } from '@aws-sdk/client-cloudwatch-logs'; import { DescribeLogGroupsCommand, DescribeLogGroupsCommandInput } from '@aws-sdk/client-cloudwatch-logs';
import type { LogGroup } from '@aws-sdk/client-cloudwatch-logs'; import type { LogGroup } from '@aws-sdk/client-cloudwatch-logs';
import { DescribeTasksCommand, ListClustersCommand, ListTasksCommand } from '@aws-sdk/client-ecs'; import { DescribeTasksCommand, ListClustersCommand, ListTasksCommand } from '@aws-sdk/client-ecs';
@ -201,9 +202,9 @@ export class TaskService {
public static async getLocks(): Promise<Array<{ Key: string }>> { public static async getLocks(): Promise<Array<{ Key: string }>> {
process.env.AWS_REGION = Input.region; process.env.AWS_REGION = Input.region;
if (CloudRunner.buildParameters.storageProvider === 'rclone') { if (CloudRunner.buildParameters.storageProvider === 'rclone') {
const objects = await ( // eslint-disable-next-line no-unused-vars
SharedWorkspaceLocking as unknown as { listObjects(prefix: string): Promise<string[]> } type ListObjectsFunction = (prefix: string) => Promise<string[]>;
).listObjects(''); const objects = await (SharedWorkspaceLocking as unknown as { listObjects: ListObjectsFunction }).listObjects('');
return objects.map((x: string) => ({ Key: x })); return objects.map((x: string) => ({ Key: x }));
} }

View File

@ -61,9 +61,9 @@ class KubernetesPods {
} }
// Check if only PreStopHook failed but container succeeded // Check if only PreStopHook failed but container succeeded
const hasPreStopHookFailure = events.some((e) => e.reason === 'FailedPreStopHook'); const hasPreStopHookFailure = events.some((event) => event.reason === 'FailedPreStopHook');
const wasKilled = events.some((e) => e.reason === 'Killing'); const wasKilled = events.some((event) => event.reason === 'Killing');
const hasExceededGracePeriod = events.some((e) => e.reason === 'ExceededGracePeriod'); const hasExceededGracePeriod = events.some((event) => event.reason === 'ExceededGracePeriod');
// If container succeeded (exit code 0), PreStopHook failure is non-critical // If container succeeded (exit code 0), PreStopHook failure is non-critical
// Also check if pod was killed but container might have succeeded // Also check if pod was killed but container might have succeeded

View File

@ -143,7 +143,10 @@ export class RemoteClient {
const uniqueJobFolderLinux = CloudRunnerFolders.ToLinuxFolder( const uniqueJobFolderLinux = CloudRunnerFolders.ToLinuxFolder(
CloudRunnerFolders.uniqueCloudRunnerJobFolderAbsolute, CloudRunnerFolders.uniqueCloudRunnerJobFolderAbsolute,
); );
if (fs.existsSync(CloudRunnerFolders.uniqueCloudRunnerJobFolderAbsolute) || fs.existsSync(uniqueJobFolderLinux)) { if (
fs.existsSync(CloudRunnerFolders.uniqueCloudRunnerJobFolderAbsolute) ||
fs.existsSync(uniqueJobFolderLinux)
) {
await CloudRunnerSystem.Run(`rm -r ${uniqueJobFolderLinux} || true`); await CloudRunnerSystem.Run(`rm -r ${uniqueJobFolderLinux} || true`);
} else { } else {
RemoteClientLogger.log(`Skipping cleanup; unique job folder missing`); RemoteClientLogger.log(`Skipping cleanup; unique job folder missing`);

View File

@ -81,7 +81,7 @@ export class SharedWorkspaceLocking {
const output = await SharedWorkspaceLocking.rclone(`lsjson ${path}`); const output = await SharedWorkspaceLocking.rclone(`lsjson ${path}`);
const json = JSON.parse(output) as { Name: string; IsDir: boolean }[]; const json = JSON.parse(output) as { Name: string; IsDir: boolean }[];
return json.map((e) => (e.IsDir ? `${e.Name}/` : e.Name)); return json.map((entry) => (entry.IsDir ? `${entry.Name}/` : entry.Name));
} catch { } catch {
return []; return [];
} }

View File

@ -76,7 +76,9 @@ describe('Cloud Runner pre-built rclone steps', () => {
try { try {
const lines = await CloudRunnerSystem.RunAndReadLines(`rclone lsf ${remote}`); const lines = await CloudRunnerSystem.RunAndReadLines(`rclone lsf ${remote}`);
CloudRunnerLogger.log(lines.join(',')); CloudRunnerLogger.log(lines.join(','));
} catch {} } catch {
// Ignore errors when listing remote root (best-effort validation)
}
}, 1_000_000_000); }, 1_000_000_000);
} else { } else {
it.skip('Run build and prebuilt rclone steps - rclone not configured', () => { it.skip('Run build and prebuilt rclone steps - rclone not configured', () => {

View File

@ -1,5 +1,4 @@
import { GitHubUrlInfo } from '../../providers/provider-url-parser'; import { GitHubUrlInfo } from '../../providers/provider-url-parser';
import * as fs from 'fs';
// Import the mocked ProviderGitManager // Import the mocked ProviderGitManager
import { ProviderGitManager } from '../../providers/provider-git-manager'; import { ProviderGitManager } from '../../providers/provider-git-manager';
@ -15,7 +14,6 @@ jest.mock('@actions/core', () => ({
jest.mock('fs'); jest.mock('fs');
// Mock the entire provider-git-manager module // Mock the entire provider-git-manager module
const mockExecAsync = jest.fn();
jest.mock('../../providers/provider-git-manager', () => { jest.mock('../../providers/provider-git-manager', () => {
const originalModule = jest.requireActual('../../providers/provider-git-manager'); const originalModule = jest.requireActual('../../providers/provider-git-manager');
@ -29,8 +27,6 @@ jest.mock('../../providers/provider-git-manager', () => {
}, },
}; };
}); });
const mockFs = fs as jest.Mocked<typeof fs>;
const mockProviderGitManager = ProviderGitManager as jest.Mocked<typeof ProviderGitManager>; const mockProviderGitManager = ProviderGitManager as jest.Mocked<typeof ProviderGitManager>;
describe('ProviderGitManager', () => { describe('ProviderGitManager', () => {

View File

@ -29,7 +29,7 @@ git config --global filter.lfs.smudge "git-lfs smudge --skip -- %f"
git config --global filter.lfs.process "git-lfs filter-process --skip" git config --global filter.lfs.process "git-lfs filter-process --skip"
BRANCH="${CloudRunner.buildParameters.cloudRunnerBranch}" BRANCH="${CloudRunner.buildParameters.cloudRunnerBranch}"
REPO="${CloudRunnerFolders.unityBuilderRepoUrl}" REPO="${CloudRunnerFolders.unityBuilderRepoUrl}"
if [ -n "$(git ls-remote --heads \"$REPO\" \"$BRANCH\" 2>/dev/null)" ]; then if [ -n "$(git ls-remote --heads "$REPO" "$BRANCH" 2>/dev/null)" ]; then
git clone -q -b "$BRANCH" "$REPO" /builder git clone -q -b "$BRANCH" "$REPO" /builder
else else
echo "Remote branch $BRANCH not found in $REPO; falling back to a known branch" echo "Remote branch $BRANCH not found in $REPO; falling back to a known branch"