From 6ca32fc51b9fa32b8cbd407f1d0b73a7800f419a Mon Sep 17 00:00:00 2001 From: Ejnar Arechavala Date: Wed, 7 Aug 2024 13:51:17 -0700 Subject: [PATCH] support multiple licensing products --- action.yml | 7 +++++++ dist/index.js | Bin 22303572 -> 22304117 bytes dist/index.js.map | Bin 14784413 -> 14785018 bytes .../services-config.json.template | 3 ++- src/model/build-parameters.test.ts | 8 ++++++++ src/model/build-parameters.ts | 2 ++ src/model/image-environment-factory.ts | 4 ++++ src/model/input.ts | 4 ++++ src/model/platform-setup.ts | 1 + src/model/platform-setup/setup-mac.ts | 1 + 10 files changed, 29 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 7f58660e..27154ce1 100644 --- a/action.yml +++ b/action.yml @@ -251,6 +251,13 @@ inputs: default: '' required: false description: 'The Unity licensing server address to use for activating Unity.' + unityLicensingProductIds: + default: '' + required: false + description: + 'Comma separated list of license product identifiers to request licenses for from the license server. Not setting + this will request the default license product configured on the licensing server. Only applicable if + unityLicensingServer is set.' dockerWorkspacePath: default: '/github/workspace' required: false diff --git a/dist/index.js b/dist/index.js index ea151c67a187477aceda8e5c55cc091164df72c1..d5c94f1cd7b4bb7233628e98becfd1a1d8aacd7a 100644 GIT binary patch delta 1737 zcmZwHc~F#f9LMolcot<51Xd6M1qDP96;}}fQ4v;H#RWMkv%+GHD1#D6jSdTy%u0*& z(afvE+q84L70v9jqU=tSE;_9=BRhS6Y{qD&KVI*7<~Q^EeZPM_hc>p^PHt_p?ON<; zsdZYz3acw;*3?zkR29#z^)yu0yF7K7u`RW!QGx$CYie{fH##ivfv>mGVJt{9*C$y* zR;>2*i%u+eyUM0j6uNSq?oyXKzoNLLD6c%XtiqL7YPP0Z?B<%M2{GXA|t^*SiQ_KyW zM!0#*X7vv|`*2-Smd#vt!Y9(Zv%~PjnR{&3;DD}suIn@+&fMv;;_`N%@Me2}6@KW3 z?(l~V0qB811feH_5rR^$n1w4*gIZjLt1%mO zs7C{?!5qxRJY0)LT!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-KPsTXn@wqdX+r zQ;2D`;W0i|U74WI^H(^F3<+{?60B7rvED_wHniH=XwpgqN0Xnz7M=CK&h*@!-wTqZ zf=(5r5QLbp67SE(I6tYxJ5H<*{NeeRW71p9dW!@;kfIryqXlG;qa}QyfFJx303`wu zgkXfA6+#h)aI{7nv=#Lh)!!(y+oeJ~v_}Wg?NX=23xU7Yaa14NTS)6~gaXV;)3Jh?L>&;^m`iYRnLcl1CsdZHI%&>MZw7yZy5S`5HI48mZ< zVhDy}7~(J-BQO%95RcIqg9MDlIE=>xOvEHi#uOw%hpCu`>6n2eBqIf>n2A|P!)(k! zI_6>?=3@aCVi6W21DRNYrC5gL$ifP&L^kwTh1FPtwOEJs$U!bPz<`a&!zOIT78sF_ ztuSF53Q!0$wqpl&VizpfjXl_lB3Q8xHtfd%9E5;FIE*7G#!=W&f@3(2Qk=j^oI)8+ z;|$K?9M0ncE}|TlPyq)jaT!irfeTk5;u@~w2C7hvo4AGBaN`c{;vVkf0UqKJYVa6O q@D$JR953(^uTYCRyhc6V;4R+aJwD(g8t@69@daPSI{UY%KmP#nNLAzj diff --git a/dist/unity-config/services-config.json.template b/dist/unity-config/services-config.json.template index 5a868f1b..9e685bf6 100644 --- a/dist/unity-config/services-config.json.template +++ b/dist/unity-config/services-config.json.template @@ -3,5 +3,6 @@ "enableEntitlementLicensing": true, "enableFloatingApi": true, "clientConnectTimeoutSec": 5, - "clientHandshakeTimeoutSec": 10 + "clientHandshakeTimeoutSec": 10, + "toolset": "%LICENSE_PRODUCT_IDS%" } diff --git a/src/model/build-parameters.test.ts b/src/model/build-parameters.test.ts index 595379d7..f689705e 100644 --- a/src/model/build-parameters.test.ts +++ b/src/model/build-parameters.test.ts @@ -200,6 +200,14 @@ describe('BuildParameters', () => { await expect(BuildParameters.create()).rejects.toThrowError(); }); + it('returns the unity licensing product ids', async () => { + const mockValue = 'license_id_1'; + jest.spyOn(Input, 'unityLicensingProductIds', 'get').mockReturnValue(mockValue); + await expect(BuildParameters.create()).resolves.toEqual( + expect.objectContaining({ unityLicensingProductIds: mockValue }), + ); + }); + it('return serial when no license server is provided', async () => { const mockValue = '123'; delete process.env.UNITY_LICENSE; // Need to delete this as it is set for every test currently diff --git a/src/model/build-parameters.ts b/src/model/build-parameters.ts index 8cf60d59..a1d69cfa 100644 --- a/src/model/build-parameters.ts +++ b/src/model/build-parameters.ts @@ -22,6 +22,7 @@ class BuildParameters { public customImage!: string; public unitySerial!: string; public unityLicensingServer!: string; + public unityLicensingProductIds!: string; public skipActivation!: string; public runnerTempPath!: string; public targetPlatform!: string; @@ -148,6 +149,7 @@ class BuildParameters { customImage: Input.customImage, unitySerial, unityLicensingServer: Input.unityLicensingServer, + unityLicensingProductIds: Input.unityLicensingProductIds, skipActivation: Input.skipActivation, runnerTempPath: Input.runnerTempPath, targetPlatform: Input.targetPlatform, diff --git a/src/model/image-environment-factory.ts b/src/model/image-environment-factory.ts index 347d6944..5b913f04 100644 --- a/src/model/image-environment-factory.ts +++ b/src/model/image-environment-factory.ts @@ -29,6 +29,10 @@ class ImageEnvironmentFactory { name: 'UNITY_LICENSING_SERVER', value: parameters.unityLicensingServer, }, + { + name: 'UNITY_LICENSING_PRODUCT_IDS', + value: parameters.unityLicensingProductIds, + }, { name: 'SKIP_ACTIVATION', value: parameters.skipActivation }, { name: 'UNITY_VERSION', value: parameters.editorVersion }, { diff --git a/src/model/input.ts b/src/model/input.ts index 0e988884..7f8691fe 100644 --- a/src/model/input.ts +++ b/src/model/input.ts @@ -123,6 +123,10 @@ class Input { return Input.getInput('unityLicensingServer') ?? ''; } + static get unityLicensingProductIds(): string { + return Input.getInput('unityLicensingProductIds') ?? ''; + } + static get buildMethod(): string { return Input.getInput('buildMethod') ?? ''; // Processed in docker file } diff --git a/src/model/platform-setup.ts b/src/model/platform-setup.ts index ad4065c8..a389a024 100644 --- a/src/model/platform-setup.ts +++ b/src/model/platform-setup.ts @@ -32,6 +32,7 @@ class PlatformSetup { let servicesConfig = fs.readFileSync(servicesConfigPathTemplate).toString(); servicesConfig = servicesConfig.replace('%URL%', buildParameters.unityLicensingServer); + servicesConfig = servicesConfig.replace('%LICENSE_PRODUCT_IDS%', buildParameters.unityLicensingProductIds); fs.writeFileSync(servicesConfigPath, servicesConfig); SetupAndroid.setup(buildParameters); diff --git a/src/model/platform-setup/setup-mac.ts b/src/model/platform-setup/setup-mac.ts index 4566e163..42770bac 100644 --- a/src/model/platform-setup/setup-mac.ts +++ b/src/model/platform-setup/setup-mac.ts @@ -168,6 +168,7 @@ class SetupMac { process.env.UNITY_VERSION = buildParameters.editorVersion; process.env.UNITY_SERIAL = buildParameters.unitySerial; process.env.UNITY_LICENSING_SERVER = buildParameters.unityLicensingServer; + process.env.UNITY_LICENSING_PRODUCT_IDS = buildParameters.unityLicensingProductIds; process.env.SKIP_ACTIVATION = buildParameters.skipActivation; process.env.PROJECT_PATH = buildParameters.projectPath; process.env.BUILD_TARGET = buildParameters.targetPlatform;