mirror of
https://github.com/game-ci/unity-builder.git
synced 2025-07-07 20:35:33 -04:00
Remove XRSettings. Remove license file check and rely on error codes instead. Exponential backoff Unity license activation retry strategy
This commit is contained in:
parent
28890ad72d
commit
88edf4e8f5
@ -1,10 +0,0 @@
|
|||||||
{
|
|
||||||
"m_SettingKeys": [
|
|
||||||
"VR Device Disabled",
|
|
||||||
"VR Device User Alert"
|
|
||||||
],
|
|
||||||
"m_SettingValues": [
|
|
||||||
"False",
|
|
||||||
"False"
|
|
||||||
]
|
|
||||||
}
|
|
2
dist/platforms/mac/entrypoint.sh
vendored
2
dist/platforms/mac/entrypoint.sh
vendored
@ -41,7 +41,7 @@ echo ""
|
|||||||
echo "Please note that the exit code is not very descriptive."
|
echo "Please note that the exit code is not very descriptive."
|
||||||
echo "Most likely it will not help you solve the issue."
|
echo "Most likely it will not help you solve the issue."
|
||||||
echo ""
|
echo ""
|
||||||
echo "To find the reason for failure: please search for errors in the log above."
|
echo "To find the reason for failure: please search for errors in the log above and check for annotations in the summary view."
|
||||||
echo ""
|
echo ""
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
|
4
dist/platforms/mac/steps/activate.sh
vendored
4
dist/platforms/mac/steps/activate.sh
vendored
@ -20,10 +20,6 @@ echo "Requesting activation"
|
|||||||
# Store the exit code from the verify command
|
# Store the exit code from the verify command
|
||||||
UNITY_EXIT_CODE=$?
|
UNITY_EXIT_CODE=$?
|
||||||
|
|
||||||
if [ ! -f "/Library/Application Support/Unity/Unity_lic.ulf" ]; then
|
|
||||||
echo "::error ::There was an error while trying to activate the Unity license."
|
|
||||||
fi
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Display information about the result
|
# Display information about the result
|
||||||
#
|
#
|
||||||
|
59
dist/platforms/ubuntu/steps/activate.sh
vendored
59
dist/platforms/ubuntu/steps/activate.sh
vendored
@ -4,24 +4,51 @@ if [[ -n "$UNITY_SERIAL" && -n "$UNITY_EMAIL" && -n "$UNITY_PASSWORD" ]]; then
|
|||||||
#
|
#
|
||||||
# SERIAL LICENSE MODE
|
# SERIAL LICENSE MODE
|
||||||
#
|
#
|
||||||
# This will activate unity, using the activating process.
|
# This will activate unity, using the serial activation process.
|
||||||
#
|
#
|
||||||
echo "Requesting activation"
|
echo "Requesting activation"
|
||||||
|
|
||||||
# Activate license
|
# Loop the unity-editor call until the license is activated with exponential backoff and a maximum of 5 retries
|
||||||
unity-editor \
|
retry_count=0
|
||||||
-logFile /dev/stdout \
|
|
||||||
-quit \
|
|
||||||
-serial "$UNITY_SERIAL" \
|
|
||||||
-username "$UNITY_EMAIL" \
|
|
||||||
-password "$UNITY_PASSWORD" \
|
|
||||||
-projectPath "/BlankProject"
|
|
||||||
|
|
||||||
# Store the exit code from the verify command
|
# Initialize delay to 15 seconds
|
||||||
UNITY_EXIT_CODE=$?
|
delay=15
|
||||||
|
|
||||||
if [ ! -f "~/.local/share/unity3d/Unity/Unity_lic.ulf" ]; then
|
# Loop until UNITY_EXIT_CODE is 0 or retry count reaches 5
|
||||||
echo "::error ::There was an error while trying to activate the Unity license."
|
while [[ $retry_count -lt 5 ]]
|
||||||
|
do
|
||||||
|
# Activate license
|
||||||
|
unity-editor \
|
||||||
|
-logFile /dev/stdout \
|
||||||
|
-quit \
|
||||||
|
-serial "$UNITY_SERIAL" \
|
||||||
|
-username "$UNITY_EMAIL" \
|
||||||
|
-password "$UNITY_PASSWORD" \
|
||||||
|
-projectPath "/BlankProject"
|
||||||
|
|
||||||
|
# Store the exit code from the verify command
|
||||||
|
UNITY_EXIT_CODE=$?
|
||||||
|
|
||||||
|
# Check if UNITY_EXIT_CODE is 0
|
||||||
|
if [[ $UNITY_EXIT_CODE -eq 0 ]]
|
||||||
|
then
|
||||||
|
echo "Activation successful"
|
||||||
|
break
|
||||||
|
else
|
||||||
|
echo "Activation failed, retrying in $delay seconds..."
|
||||||
|
sleep $delay
|
||||||
|
|
||||||
|
# Increment retry count
|
||||||
|
((retry_count++))
|
||||||
|
|
||||||
|
# Double the delay for the next iteration
|
||||||
|
delay=$((delay * 2))
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ $retry_count -eq 5 ]]
|
||||||
|
then
|
||||||
|
echo "Activation failed after 5 retries"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
elif [[ -n "$UNITY_LICENSING_SERVER" ]]; then
|
elif [[ -n "$UNITY_LICENSING_SERVER" ]]; then
|
||||||
@ -50,8 +77,9 @@ else
|
|||||||
echo "Visit https://game.ci/docs/github/getting-started for more"
|
echo "Visit https://game.ci/docs/github/getting-started for more"
|
||||||
echo "details on how to set up one of the possible activation strategies."
|
echo "details on how to set up one of the possible activation strategies."
|
||||||
|
|
||||||
echo "::error ::No valid license activation strategy could be determined."
|
echo "::error ::No valid license activation strategy could be determined. Make sure to provide UNITY_EMAIL, UNITY_PASSWORD, and either a UNITY_SERIAL \
|
||||||
# Immediately exit as no UNITY_EXIT_CODE can be derrived.
|
or UNITY_LICENSE. Otherwise please use UNITY_LICENSING_SERVER."
|
||||||
|
# Immediately exit as no UNITY_EXIT_CODE can be derived.
|
||||||
exit 1;
|
exit 1;
|
||||||
|
|
||||||
fi
|
fi
|
||||||
@ -66,6 +94,7 @@ else
|
|||||||
# Activation failed so exit with the code from the license verification step
|
# Activation failed so exit with the code from the license verification step
|
||||||
echo "Unclassified error occured while trying to activate license."
|
echo "Unclassified error occured while trying to activate license."
|
||||||
echo "Exit code was: $UNITY_EXIT_CODE"
|
echo "Exit code was: $UNITY_EXIT_CODE"
|
||||||
|
echo "::error ::There was an error while trying to activate the Unity license."
|
||||||
exit $UNITY_EXIT_CODE
|
exit $UNITY_EXIT_CODE
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
8
dist/platforms/ubuntu/steps/runsteps.sh
vendored
8
dist/platforms/ubuntu/steps/runsteps.sh
vendored
@ -6,6 +6,12 @@
|
|||||||
source /steps/set_extra_git_configs.sh
|
source /steps/set_extra_git_configs.sh
|
||||||
source /steps/set_gitcredential.sh
|
source /steps/set_gitcredential.sh
|
||||||
source /steps/activate.sh
|
source /steps/activate.sh
|
||||||
|
|
||||||
|
# If we didn't activate successfully, exit with the exit code from the activation step.
|
||||||
|
if [[ $UNITY_EXIT_CODE -ne 0 ]]; then
|
||||||
|
exit $UNITY_EXIT_CODE
|
||||||
|
fi
|
||||||
|
|
||||||
source /steps/build.sh
|
source /steps/build.sh
|
||||||
source /steps/return_license.sh
|
source /steps/return_license.sh
|
||||||
|
|
||||||
@ -22,7 +28,7 @@ echo ""
|
|||||||
echo "Please note that the exit code is not very descriptive."
|
echo "Please note that the exit code is not very descriptive."
|
||||||
echo "Most likely it will not help you solve the issue."
|
echo "Most likely it will not help you solve the issue."
|
||||||
echo ""
|
echo ""
|
||||||
echo "To find the reason for failure: please search for errors in the log above."
|
echo "To find the reason for failure: please search for errors in the log above and check for annotations in the summary view."
|
||||||
echo ""
|
echo ""
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
|
5
dist/platforms/windows/activate.ps1
vendored
5
dist/platforms/windows/activate.ps1
vendored
@ -13,7 +13,4 @@ Write-Output ""
|
|||||||
-projectPath "c:/BlankProject" `
|
-projectPath "c:/BlankProject" `
|
||||||
-logfile - | Out-Host
|
-logfile - | Out-Host
|
||||||
|
|
||||||
if(-not(Test-path "C:/ProgramData/Unity/Unity_lic.ulf" -PathType leaf))
|
$ACTIVATION_EXIT_CODE = $LASTEXITCODE
|
||||||
{
|
|
||||||
Write-Output "::error ::There was an error while trying to activate the Unity license."
|
|
||||||
}
|
|
||||||
|
7
dist/platforms/windows/entrypoint.ps1
vendored
7
dist/platforms/windows/entrypoint.ps1
vendored
@ -1,5 +1,4 @@
|
|||||||
Get-Process
|
Get-Process
|
||||||
Start-Sleep -Seconds 3
|
|
||||||
|
|
||||||
# Import any necessary registry keys, ie: location of windows 10 sdk
|
# Import any necessary registry keys, ie: location of windows 10 sdk
|
||||||
# No guarantee that there will be any necessary registry keys, ie: tvOS
|
# No guarantee that there will be any necessary registry keys, ie: tvOS
|
||||||
@ -17,13 +16,17 @@ Get-Process -Name regsvr32 | ForEach-Object { Stop-Process -Id $_.Id -Force }
|
|||||||
# Activate Unity
|
# Activate Unity
|
||||||
. "c:\steps\activate.ps1"
|
. "c:\steps\activate.ps1"
|
||||||
|
|
||||||
|
# If we didn't activate successfully, exit with the exit code from the activation step.
|
||||||
|
if ($ACTIVATION_EXIT_CODE -ne 0) {
|
||||||
|
exit $ACTIVATION_EXIT_CODE
|
||||||
|
}
|
||||||
|
|
||||||
# Build the project
|
# Build the project
|
||||||
. "c:\steps\build.ps1"
|
. "c:\steps\build.ps1"
|
||||||
|
|
||||||
# Free the seat for the activated license
|
# Free the seat for the activated license
|
||||||
. "c:\steps\return_license.ps1"
|
. "c:\steps\return_license.ps1"
|
||||||
|
|
||||||
Start-Sleep -Seconds 3
|
|
||||||
Get-Process
|
Get-Process
|
||||||
|
|
||||||
exit $BUILD_EXIT_CODE
|
exit $BUILD_EXIT_CODE
|
||||||
|
Loading…
Reference in New Issue
Block a user