From 128400102c405f5e86448511d25059fde1d2f10b Mon Sep 17 00:00:00 2001 From: frostebite Date: Fri, 28 Aug 2026 17:36:22 +0100 Subject: [PATCH] Revert "fix(unity-builder): retry mac builds on Unity's transient licensing-client signature error (#226)" This reverts commit 65f50197edd8006b9564fefb97ed3b356fa977de. --- .../dist/unity-builder/model/mac-builder.d.ts | 3 - .../dist/unity-builder/model/mac-builder.js | 80 +------------------ .../unity-builder/model/mac-builder.test.ts | 67 ---------------- .../src/unity-builder/model/mac-builder.ts | 52 +----------- 4 files changed, 8 insertions(+), 194 deletions(-) delete mode 100644 plugins/unity/src/unity-builder/model/mac-builder.test.ts diff --git a/plugins/unity/dist/unity-builder/model/mac-builder.d.ts b/plugins/unity/dist/unity-builder/model/mac-builder.d.ts index 26f71360..5fd88d55 100644 --- a/plugins/unity/dist/unity-builder/model/mac-builder.d.ts +++ b/plugins/unity/dist/unity-builder/model/mac-builder.d.ts @@ -1,7 +1,4 @@ declare class MacBuilder { - private static readonly TRANSIENT_LICENSING_ERROR_PATTERN; - private static readonly MAX_ATTEMPTS; - private static readonly RETRY_DELAY_MS; static run(actionFolder: string, silent?: boolean): Promise; } export default MacBuilder; diff --git a/plugins/unity/dist/unity-builder/model/mac-builder.js b/plugins/unity/dist/unity-builder/model/mac-builder.js index 1b36e34d..1bf29ba4 100644 --- a/plugins/unity/dist/unity-builder/model/mac-builder.js +++ b/plugins/unity/dist/unity-builder/model/mac-builder.js @@ -1,84 +1,12 @@ "use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || (function () { - var ownKeys = function(o) { - ownKeys = Object.getOwnPropertyNames || function (o) { - var ar = []; - for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; - return ar; - }; - return ownKeys(o); - }; - return function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); - __setModuleDefault(result, mod); - return result; - }; -})(); Object.defineProperty(exports, "__esModule", { value: true }); const exec_1 = require("@actions/exec"); -const core = __importStar(require("@actions/core")); class MacBuilder { - // A known, transient macOS/Unity flake: the Licensing Client's own - // codesign verification occasionally fails right after a fresh Unity - // Hub install on a GitHub-hosted runner, before any real build work has - // started (confirmed against game-ci/unity-builder#844's CI - the exact - // same job config passed a few minutes later in a sibling run). It's not - // something this tool can fix in Unity itself, but failing the whole - // build - and the PR check along with it - on a licensing hiccup that - // has nothing to do with the actual build's correctness is exactly the - // kind of false negative that erodes trust in CI. Retry a few times - // before surfacing it as a real failure. - static TRANSIENT_LICENSING_ERROR_PATTERN = /Error: Code 10 while verifying Licensing Client signature/; - static MAX_ATTEMPTS = 3; - static RETRY_DELAY_MS = 10_000; static async run(actionFolder, silent = false) { - let exitCode = 1; - for (let attempt = 1; attempt <= MacBuilder.MAX_ATTEMPTS; attempt++) { - let output = ''; - // eslint-disable-next-line no-await-in-loop - exitCode = await (0, exec_1.exec)('bash', [`${actionFolder}/platforms/mac/entrypoint.sh`], { - silent, - ignoreReturnCode: true, - listeners: { - stdout: (data) => { - output += data.toString(); - }, - stderr: (data) => { - output += data.toString(); - }, - }, - }); - if (exitCode === 0) - return exitCode; - if (!MacBuilder.TRANSIENT_LICENSING_ERROR_PATTERN.test(output)) - return exitCode; - if (attempt === MacBuilder.MAX_ATTEMPTS) - break; - core.warning(`Unity's Licensing Client hit a transient signature-verification error (attempt ${attempt}/${MacBuilder.MAX_ATTEMPTS}). Retrying in ${MacBuilder.RETRY_DELAY_MS / 1000}s.`); - // eslint-disable-next-line no-await-in-loop - await new Promise((resolve) => { - setTimeout(resolve, MacBuilder.RETRY_DELAY_MS); - }); - } - return exitCode; + return await (0, exec_1.exec)('bash', [`${actionFolder}/platforms/mac/entrypoint.sh`], { + silent, + ignoreReturnCode: true, + }); } } exports.default = MacBuilder; diff --git a/plugins/unity/src/unity-builder/model/mac-builder.test.ts b/plugins/unity/src/unity-builder/model/mac-builder.test.ts deleted file mode 100644 index c2a62710..00000000 --- a/plugins/unity/src/unity-builder/model/mac-builder.test.ts +++ /dev/null @@ -1,67 +0,0 @@ -import { describe, it, expect, afterEach, vi } from 'vitest'; -import * as core from '@actions/core'; -import * as exec from '@actions/exec'; -import MacBuilder from './mac-builder'; - -vi.spyOn(core, 'warning').mockImplementation(() => {}); -const execSpy = vi.spyOn(exec, 'exec'); - -vi.useFakeTimers(); - -afterEach(() => { - vi.clearAllMocks(); - vi.clearAllTimers(); -}); - -function mockRun(exitCode: number, output: string) { - return async ( - _command: string, - _args: string[] | undefined, - options: exec.ExecOptions | undefined, - ) => { - options?.listeners?.stdout?.(Buffer.from(output)); - return exitCode; - }; -} - -describe('MacBuilder', () => { - it('returns 0 immediately on success without retrying', async () => { - execSpy.mockImplementationOnce(mockRun(0, 'Build succeeded')); - - await expect(MacBuilder.run('/action')).resolves.toBe(0); - expect(execSpy).toHaveBeenCalledTimes(1); - }); - - it('returns a real failure immediately, without retrying', async () => { - execSpy.mockImplementationOnce(mockRun(1, 'Some unrelated compile error')); - - await expect(MacBuilder.run('/action')).resolves.toBe(1); - expect(execSpy).toHaveBeenCalledTimes(1); - }); - - it('retries on the transient Licensing Client signature error, then succeeds', async () => { - execSpy - .mockImplementationOnce( - mockRun(1, 'Error: Code 10 while verifying Licensing Client signature (process Id: 1)'), - ) - .mockImplementationOnce(mockRun(0, 'Build succeeded')); - - const runPromise = MacBuilder.run('/action'); - await vi.runAllTimersAsync(); - - await expect(runPromise).resolves.toBe(0); - expect(execSpy).toHaveBeenCalledTimes(2); - }); - - it('gives up after the max attempts and returns the last failing exit code', async () => { - execSpy.mockImplementation( - mockRun(1, 'Error: Code 10 while verifying Licensing Client signature (process Id: 1)'), - ); - - const runPromise = MacBuilder.run('/action'); - await vi.runAllTimersAsync(); - - await expect(runPromise).resolves.toBe(1); - expect(execSpy).toHaveBeenCalledTimes(3); - }); -}); diff --git a/plugins/unity/src/unity-builder/model/mac-builder.ts b/plugins/unity/src/unity-builder/model/mac-builder.ts index da4f36a6..1d4ddecf 100644 --- a/plugins/unity/src/unity-builder/model/mac-builder.ts +++ b/plugins/unity/src/unity-builder/model/mac-builder.ts @@ -1,55 +1,11 @@ import { exec } from '@actions/exec'; -import * as core from '@actions/core'; class MacBuilder { - // A known, transient macOS/Unity flake: the Licensing Client's own - // codesign verification occasionally fails right after a fresh Unity - // Hub install on a GitHub-hosted runner, before any real build work has - // started (confirmed against game-ci/unity-builder#844's CI - the exact - // same job config passed a few minutes later in a sibling run). It's not - // something this tool can fix in Unity itself, but failing the whole - // build - and the PR check along with it - on a licensing hiccup that - // has nothing to do with the actual build's correctness is exactly the - // kind of false negative that erodes trust in CI. Retry a few times - // before surfacing it as a real failure. - private static readonly TRANSIENT_LICENSING_ERROR_PATTERN = - /Error: Code 10 while verifying Licensing Client signature/; - private static readonly MAX_ATTEMPTS = 3; - private static readonly RETRY_DELAY_MS = 10_000; - public static async run(actionFolder: string, silent: boolean = false): Promise { - let exitCode = 1; - - for (let attempt = 1; attempt <= MacBuilder.MAX_ATTEMPTS; attempt++) { - let output = ''; - // eslint-disable-next-line no-await-in-loop - exitCode = await exec('bash', [`${actionFolder}/platforms/mac/entrypoint.sh`], { - silent, - ignoreReturnCode: true, - listeners: { - stdout: (data: Buffer) => { - output += data.toString(); - }, - stderr: (data: Buffer) => { - output += data.toString(); - }, - }, - }); - - if (exitCode === 0) return exitCode; - if (!MacBuilder.TRANSIENT_LICENSING_ERROR_PATTERN.test(output)) return exitCode; - if (attempt === MacBuilder.MAX_ATTEMPTS) break; - - core.warning( - `Unity's Licensing Client hit a transient signature-verification error (attempt ${attempt}/${MacBuilder.MAX_ATTEMPTS}). Retrying in ${MacBuilder.RETRY_DELAY_MS / 1000}s.`, - ); - // eslint-disable-next-line no-await-in-loop - await new Promise((resolve) => { - setTimeout(resolve, MacBuilder.RETRY_DELAY_MS); - }); - } - - return exitCode; + return await exec('bash', [`${actionFolder}/platforms/mac/entrypoint.sh`], { + silent, + ignoreReturnCode: true, + }); } }