First take on adding support for sending in unity licensing server url on linux

pull/196/head
Simen Sandvaer 2022-10-20 15:21:11 +02:00
parent 5263cf0ab1
commit a7293ea76a
6 changed files with 42 additions and 2 deletions

View File

@ -0,0 +1,7 @@
{
"licensingServiceBaseUrl": "%URL%",
"enableEntitlementLicensing": true,
"enableFloatingApi": true,
"clientConnectTimeoutSec": 5,
"clientHandshakeTimeoutSec": 10
}

View File

@ -77,7 +77,26 @@ elif [[ -n "$UNITY_SERIAL" && -n "$UNITY_EMAIL" && -n "$UNITY_PASSWORD" ]]; then
# Store the exit code from the verify command
UNITY_EXIT_CODE=$?
elif [[ -n "$UNITY_LICENSING_SERVER" ]]; then
#
# Custom Unity License Server
#
echo "Adding licensing server config"
pushd /resources
cat services-config.json.template | tr -d '\r' | awk "{sub(/%URL%/,\"$UNITY_LICENSING_SERVER\")}1" > services-config.json
mkdir -p /usr/share/unity3d/config/
mv services-config.json /usr/share/unity3d/config/
/opt/unity/Editor/Data/Resources/Licensing/Client/Unity.Licensing.Client --acquire-floating > license.txt #is this accessible in a env variable?
UNITY_EXIT_CODE=$?
PARSEDFILE=$(grep -oP '\".*?\"' < license.txt | tr -d '"')
export FLOATING_LICENSE
FLOATING_LICENSE=$(sed -n 2p <<< "$PARSEDFILE")
FLOATING_LICENSE_TIMEOUT=$(sed -n 4p <<< "$PARSEDFILE")
echo "Acquired floating license: \"$FLOATING_LICENSE\" with timeout $FLOATING_LICENSE_TIMEOUT"
# Store the exit code from the verify command
popd
else
#
# NO LICENSE ACTIVATION STRATEGY MATCHED

View File

@ -4,7 +4,13 @@
echo "Changing to \"$ACTIVATE_LICENSE_PATH\" directory."
pushd "$ACTIVATE_LICENSE_PATH"
if [[ -n "$UNITY_SERIAL" ]]; then
if [[ -n "$UNITY_LICENSING_SERVER" ]]; then #
#
# Return any floating license used.
#
echo "Returning floating license: \"$FLOATING_LICENSE\""
/opt/unity/Editor/Data/Resources/Licensing/Client/Unity.Licensing.Client --return-floating "$FLOATING_LICENSE"
elif [[ -n "$UNITY_SERIAL" ]]; then
#
# PROFESSIONAL (SERIAL) LICENSE MODE
#
@ -17,6 +23,5 @@ if [[ -n "$UNITY_SERIAL" ]]; then
-quit \
-returnlicense
fi
# Return to previous working directory
popd

View File

@ -20,6 +20,7 @@ async function run() {
githubToken,
checkName,
chownFilesTo,
unityLicensingServer
} = Input.getFromUser();
const baseImage = new ImageTag({ editorVersion, customImage });
const runnerTemporaryPath = process.env.RUNNER_TEMP;
@ -40,6 +41,7 @@ async function run() {
githubToken,
runnerTemporaryPath,
chownFilesTo,
unityLicensingServer
});
} finally {
await Output.setArtifactsPath(artifactsPath);

View File

@ -34,6 +34,7 @@ const Docker = {
githubToken,
runnerTemporaryPath,
chownFilesTo,
unityLicensingServer
} = parameters;
const githubHome = path.join(runnerTemporaryPath, '_github_home');
@ -52,6 +53,7 @@ const Docker = {
--env UNITY_EMAIL \
--env UNITY_PASSWORD \
--env UNITY_SERIAL \
--env UNITY_LICENSING_SERVER="${unityLicensingServer}" \
--env UNITY_VERSION="${editorVersion}" \
--env PROJECT_PATH="${projectPath}" \
--env CUSTOM_PARAMETERS="${customParameters}" \
@ -82,6 +84,7 @@ const Docker = {
--volume "${workspace}:/github/workspace:z" \
--volume "${actionFolder}/steps:/steps:z" \
--volume "${actionFolder}/entrypoint.sh:/entrypoint.sh:z" \
--volume "${actionFolder}/resources:/resources:z" \
${sshAgent ? `--volume ${sshAgent}:/ssh-agent` : ''} \
${
sshAgent ? `--volume /home/runner/.ssh/known_hosts:/root/.ssh/known_hosts:ro` : ''
@ -108,6 +111,7 @@ const Docker = {
githubToken,
runnerTemporaryPath,
chownFilesTo,
unityLicensingServer
} = parameters;
const githubHome = path.join(runnerTemporaryPath, '_github_home');
@ -126,6 +130,7 @@ const Docker = {
--env UNITY_EMAIL \
--env UNITY_PASSWORD \
--env UNITY_SERIAL \
--env UNITY_LICENSING_SERVER="${unityLicensingServer}" \
--env UNITY_VERSION="${editorVersion}" \
--env PROJECT_PATH="${projectPath}" \
--env CUSTOM_PARAMETERS="${customParameters}" \

View File

@ -17,6 +17,7 @@ const Input = {
const unityVersion = getInput('unityVersion') || 'auto';
const customImage = getInput('customImage') || '';
const rawProjectPath = getInput('projectPath') || '.';
const unityLicensingServer = getInput('unityLicensingServer') || '';
const customParameters = getInput('customParameters') || '';
const testMode = (getInput('testMode') || 'all').toLowerCase();
const coverageOptions = getInput('coverageOptions') || '';
@ -67,6 +68,7 @@ const Input = {
githubToken,
checkName,
chownFilesTo,
unityLicensingServer
};
},
};