Skip to content

Commit 90d8a2d

Browse files
authored
Add licensingProductIds param & update services-config template
Add licensingProductIds param & update services-config template
2 parents 05a00ef + 119946d commit 90d8a2d

File tree

7 files changed

+25
-3
lines changed

7 files changed

+25
-3
lines changed

action.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,13 @@ inputs:
9090
required: false
9191
default: ''
9292
description: 'Url to a unity license server for acquiring floating licenses.'
93+
unityLicensingProductIds:
94+
required: false
95+
default: ''
96+
description:
97+
'Comma separated list of license product identifiers to request licenses for from the license server. Not setting
98+
this will request the default license product configured on the licensing server. Only applicable if
99+
unityLicensingServer is set.'
93100
containerRegistryRepository:
94101
required: false
95102
default: 'unityci/editor'

dist/unity-config/services-config.json.template

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
"enableEntitlementLicensing": true,
44
"enableFloatingApi": true,
55
"clientConnectTimeoutSec": 5,
6-
"clientHandshakeTimeoutSec": 10
6+
"clientHandshakeTimeoutSec": 10,
7+
"toolset": "%LICENSE_PRODUCT_IDS%"
78
}

src/main.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export async function run() {
2929
dockerMemoryLimit,
3030
dockerIsolationMode,
3131
unityLicensingServer,
32+
unityLicensingProductIds,
3233
runAsHostUser,
3334
containerRegistryRepository,
3435
containerRegistryImageVersion,
@@ -66,6 +67,7 @@ export async function run() {
6667
dockerMemoryLimit,
6768
dockerIsolationMode,
6869
unityLicensingServer,
70+
unityLicensingProductIds,
6971
runAsHostUser,
7072
unitySerial,
7173
...runnerContext,

src/model/docker.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@ const Docker = {
3434
let runCommand = '';
3535

3636
if (parameters.unityLicensingServer !== '') {
37-
LicensingServerSetup.Setup(parameters.unityLicensingServer, parameters.actionFolder);
37+
LicensingServerSetup.Setup(
38+
parameters.unityLicensingServer,
39+
parameters.actionFolder,
40+
parameters.unityLicensingProductIds,
41+
);
3842
}
3943

4044
switch (process.platform) {

src/model/image-environment-factory.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class ImageEnvironmentFactory {
2727
name: 'UNITY_LICENSING_SERVER',
2828
value: parameters.unityLicensingServer,
2929
},
30+
{ name: 'UNITY_LICENSING_PRODUCT_IDS', value: parameters.unityLicensingProductIds },
3031
{ name: 'UNITY_VERSION', value: parameters.editorVersion },
3132
{
3233
name: 'USYM_UPLOAD_AUTH_TOKEN',

src/model/input.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ class Input {
8787
const customImage = getInput('customImage') || '';
8888
const rawProjectPath = getInput('projectPath') || '.';
8989
const unityLicensingServer = getInput('unityLicensingServer') || '';
90+
const unityLicensingProductIds = getInput('unityLicensingProductIds') || '';
9091
const unityLicense = getInput('unityLicense') || (process.env['UNITY_LICENSE'] ?? '');
9192
let unitySerial = process.env['UNITY_SERIAL'] ?? '';
9293
const customParameters = getInput('customParameters') || '';
@@ -239,6 +240,7 @@ class Input {
239240
dockerMemoryLimit,
240241
dockerIsolationMode,
241242
unityLicensingServer,
243+
unityLicensingProductIds,
242244
runAsHostUser,
243245
containerRegistryRepository,
244246
containerRegistryImageVersion,

src/model/licensing-server-setup.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22
import fs from 'fs';
33

44
class LicensingServerSetup {
5-
public static Setup(unityLicensingServer, actionFolder: string) {
5+
public static Setup(
6+
unityLicensingServer,
7+
actionFolder: string,
8+
unityLicensingProductIds: string,
9+
) {
610
const servicesConfigPath = `${actionFolder}/unity-config/services-config.json`;
711
const servicesConfigPathTemplate = `${servicesConfigPath}.template`;
812
if (!fs.existsSync(servicesConfigPathTemplate)) {
@@ -13,6 +17,7 @@ class LicensingServerSetup {
1317

1418
let servicesConfig = fs.readFileSync(servicesConfigPathTemplate).toString();
1519
servicesConfig = servicesConfig.replace('%URL%', unityLicensingServer);
20+
servicesConfig = servicesConfig.replace('%LICENSE_PRODUCT_IDS%', unityLicensingProductIds);
1621
fs.writeFileSync(servicesConfigPath, servicesConfig);
1722
}
1823
}

0 commit comments

Comments
 (0)