Add licensingProductIds param & update services-config template

pull/281/head
Ejnar Arechavala 2024-08-07 12:01:49 -07:00
parent 05a00ef5ac
commit 119946da75
7 changed files with 25 additions and 3 deletions

View File

@ -90,6 +90,13 @@ inputs:
required: false
default: ''
description: 'Url to a unity license server for acquiring floating licenses.'
unityLicensingProductIds:
required: false
default: ''
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.'
containerRegistryRepository:
required: false
default: 'unityci/editor'

View File

@ -3,5 +3,6 @@
"enableEntitlementLicensing": true,
"enableFloatingApi": true,
"clientConnectTimeoutSec": 5,
"clientHandshakeTimeoutSec": 10
"clientHandshakeTimeoutSec": 10,
"toolset": "%LICENSE_PRODUCT_IDS%"
}

View File

@ -29,6 +29,7 @@ export async function run() {
dockerMemoryLimit,
dockerIsolationMode,
unityLicensingServer,
unityLicensingProductIds,
runAsHostUser,
containerRegistryRepository,
containerRegistryImageVersion,
@ -66,6 +67,7 @@ export async function run() {
dockerMemoryLimit,
dockerIsolationMode,
unityLicensingServer,
unityLicensingProductIds,
runAsHostUser,
unitySerial,
...runnerContext,

View File

@ -34,7 +34,11 @@ const Docker = {
let runCommand = '';
if (parameters.unityLicensingServer !== '') {
LicensingServerSetup.Setup(parameters.unityLicensingServer, parameters.actionFolder);
LicensingServerSetup.Setup(
parameters.unityLicensingServer,
parameters.actionFolder,
parameters.unityLicensingProductIds,
);
}
switch (process.platform) {

View File

@ -27,6 +27,7 @@ class ImageEnvironmentFactory {
name: 'UNITY_LICENSING_SERVER',
value: parameters.unityLicensingServer,
},
{ name: 'UNITY_LICENSING_PRODUCT_IDS', value: parameters.unityLicensingProductIds },
{ name: 'UNITY_VERSION', value: parameters.editorVersion },
{
name: 'USYM_UPLOAD_AUTH_TOKEN',

View File

@ -87,6 +87,7 @@ class Input {
const customImage = getInput('customImage') || '';
const rawProjectPath = getInput('projectPath') || '.';
const unityLicensingServer = getInput('unityLicensingServer') || '';
const unityLicensingProductIds = getInput('unityLicensingProductIds') || '';
const unityLicense = getInput('unityLicense') || (process.env['UNITY_LICENSE'] ?? '');
let unitySerial = process.env['UNITY_SERIAL'] ?? '';
const customParameters = getInput('customParameters') || '';
@ -239,6 +240,7 @@ class Input {
dockerMemoryLimit,
dockerIsolationMode,
unityLicensingServer,
unityLicensingProductIds,
runAsHostUser,
containerRegistryRepository,
containerRegistryImageVersion,

View File

@ -2,7 +2,11 @@
import fs from 'fs';
class LicensingServerSetup {
public static Setup(unityLicensingServer, actionFolder: string) {
public static Setup(
unityLicensingServer,
actionFolder: string,
unityLicensingProductIds: string,
) {
const servicesConfigPath = `${actionFolder}/unity-config/services-config.json`;
const servicesConfigPathTemplate = `${servicesConfigPath}.template`;
if (!fs.existsSync(servicesConfigPathTemplate)) {
@ -13,6 +17,7 @@ class LicensingServerSetup {
let servicesConfig = fs.readFileSync(servicesConfigPathTemplate).toString();
servicesConfig = servicesConfig.replace('%URL%', unityLicensingServer);
servicesConfig = servicesConfig.replace('%LICENSE_PRODUCT_IDS%', unityLicensingProductIds);
fs.writeFileSync(servicesConfigPath, servicesConfig);
}
}