Change exit strategy for activation step

This commit is contained in:
Webber 2020-01-08 00:39:53 +01:00 committed by Webber Takken
parent a76c6a7321
commit 53bec7beb4
4 changed files with 36 additions and 25 deletions

File diff suppressed because one or more lines are too long

View File

@ -17,24 +17,30 @@ if [[ -n "$UNITY_LICENSE" ]]; then
# Copy license file from Github variables # Copy license file from Github variables
echo "$UNITY_LICENSE" | tr -d '\r' > $FILE_PATH echo "$UNITY_LICENSE" | tr -d '\r' > $FILE_PATH
## #
## Activate license # Activate license
## #
# This is expected to always exit with code 1 (both success and failure).
#
echo "Requesting activation" echo "Requesting activation"
xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' \ ACTIVATION_OUTPUT=$(xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' \
/opt/Unity/Editor/Unity \ /opt/Unity/Editor/Unity \
-batchmode \ -batchmode \
-nographics \ -nographics \
-logFile /dev/stdout \ -logFile /dev/stdout \
-quit \ -quit \
-manualLicenseFile $FILE_PATH -manualLicenseFile $FILE_PATH)
# This is expected to always exit with code 1 (both success and failure).
# Convert to exit code 0 by echoing the current exit code. # Convert to exit code 0 by echoing the current exit code.
echo $? echo $?
# Exit code is now 0 # Exit code is now 0
# TODO - remove debugging
echo $ACTIVATION_OUTPUT
echo $ACTIVATION_OUTPUT | grep 'config is NOT valid, switching to default'
echo $ACTIVATION_OUTPUT | grep 'config is NOT valid, switching to default' | wc -l
# TODO - Derive exit code by grepping success statement # TODO - Derive exit code by grepping success statement
UNITY_EXIT_CODE=0 UNITY_EXIT_CODE=$(echo $ACTIVATION_OUTPUT | grep 'config is NOT valid, switching to default' | wc -l)
# Display information about the result # Display information about the result
if [ $UNITY_EXIT_CODE -eq 0 ]; then if [ $UNITY_EXIT_CODE -eq 0 ]; then
@ -48,7 +54,9 @@ if [[ -n "$UNITY_LICENSE" ]]; then
rm -f $FILE_PATH rm -f $FILE_PATH
# Exit with the code from the license verification step # Exit with the code from the license verification step
if [ $UNITY_EXIT_CODE -ne 0 ]; then
exit $UNITY_EXIT_CODE exit $UNITY_EXIT_CODE
fi
else else
# #

View File

@ -38,32 +38,35 @@ export default class ImageTag {
windows: 'windows', windows: 'windows',
android: 'android', android: 'android',
ios: 'ios', ios: 'ios',
facebook: 'facebook',
}; };
} }
static get targetPlatformToBuilderPlatformMap() { static get targetPlatformToBuilderPlatformMap() {
const { generic, webgl, mac, windows, android, ios } = ImageTag.builderPlatforms; const { generic, webgl, mac, windows, android, ios, facebook } = ImageTag.builderPlatforms;
// @see: https://docs.unity3d.com/ScriptReference/BuildTarget.html // @see: https://docs.unity3d.com/ScriptReference/BuildTarget.html
return { return {
Test: generic,
WebGL: webgl,
StandaloneOSX: mac, StandaloneOSX: mac,
StandaloneWindows: windows, StandaloneWindows: windows,
StandaloneWindows64: windows, StandaloneWindows64: windows,
StandaloneLinux64: generic, StandaloneLinux64: windows,
PS4: generic,
XboxOne: generic,
Switch: generic,
Android: android,
iOS: ios, iOS: ios,
tvOS: generic, Android: android,
Lumin: generic, WebGL: webgl,
BJM: generic, WSAPlayer: windows,
Stadia: generic, PS4: windows,
WSAPlayer: generic, XboxOne: windows,
Facebook: generic, tvOS: windows,
Switch: windows,
// Unsupported
Lumin: windows,
BJM: windows,
Stadia: windows,
Facebook: facebook,
NoTarget: generic, NoTarget: generic,
// Test specific
Test: generic,
}; };
} }

View File

@ -5,7 +5,7 @@ describe('UnityImageVersion', () => {
repository: 'test1', repository: 'test1',
name: 'test2', name: 'test2',
version: '2099.9.f9f9', version: '2099.9.f9f9',
platform: 'Stadia', platform: 'Test',
builderPlatform: '', builderPlatform: '',
}; };
@ -59,7 +59,7 @@ describe('UnityImageVersion', () => {
}); });
it('returns no specific build platform for generic targetPlatforms', () => { it('returns no specific build platform for generic targetPlatforms', () => {
const image = new ImageTag({ platform: 'Stadia' }); const image = new ImageTag({ platform: 'NoTarget' });
expect(image.toString()).toStrictEqual(`${defaults.image}:2019.2.11f1`); expect(image.toString()).toStrictEqual(`${defaults.image}:2019.2.11f1`);
}); });