Add licensingProductIds param & update services-config template

Add licensingProductIds param & update services-config template
pull/282/head
Ejnar Arechavala 2024-08-07 12:30:50 -07:00 committed by GitHub
commit 90d8a2d1c1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 25 additions and 3 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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