diff --git a/dist/platforms/ubuntu/steps/return_license.sh b/dist/platforms/ubuntu/steps/return_license.sh index 70006dd..45782aa 100644 --- a/dist/platforms/ubuntu/steps/return_license.sh +++ b/dist/platforms/ubuntu/steps/return_license.sh @@ -106,12 +106,20 @@ elif [[ "$RETURN_STRATEGY" == "serial" ]]; then # project, so Unity doesn't reopen the real project (and reimport its # library against whatever the editor's default target is) just to # return the license (game-ci/cli#33). + # + # -username/-password mirror the serial branch of activate.sh, and Unity + # documents them on -returnlicense exactly as on activation: + # https://docs.unity3d.com/Manual/ManagingYourUnityLicense.html (documented identically + # for every Unity line game-ci tests: 2018.4, 2019.4, 2020.3, 2022.3, 6000.x) + # Without them the returning editor starts a fresh licensing client that then fails to return the license. RETURN_LOG="$(mktemp)" for ATTEMPT in $(seq 1 "$UNITY_LICENSE_RETURN_MAX_ATTEMPTS"); do unity-editor \ -logFile /dev/stdout \ -quit \ -returnlicense \ + -username "$UNITY_EMAIL" \ + -password "$UNITY_PASSWORD" \ -projectPath "$ACTIVATE_LICENSE_PATH" 2>&1 | tee "$RETURN_LOG" RETURN_EXIT_CODE=${PIPESTATUS[0]} diff --git a/scripts/test-licensing-steps.sh b/scripts/test-licensing-steps.sh index 3a09442..48d4e67 100644 --- a/scripts/test-licensing-steps.sh +++ b/scripts/test-licensing-steps.sh @@ -288,6 +288,21 @@ run_step UNITY_LICENSING_METHOD="serial" UNITY_SERIAL="F4-XXXX" UNITY_LICENSING_ check "an explicit strategy governs the return" "$(cat "$ARGV_LOG")" "-returnlicense" refute "and does not fall back to floating" "$(cat "$ARGV_LOG")" "--return-floating" +# A serial-mode return has to authenticate, exactly like the activation it +# undoes. Without credentials the returning editor starts a fresh licensing +# client with no session and reports "Access token is unavailable; failed to +# update", then "Failed to return entitlement license" - and because that +# string is in the transient pattern above, it is retried through the full +# backoff before the seat is leaked anyway. mac/steps/return_license.sh and +# both windows return scripts have always passed these; the ubuntu steps +# script lost them, which is what this asserts can not happen again. +: > "$ARGV_LOG" +run_step UNITY_LICENSING_METHOD="serial" UNITY_SERIAL="F4-XXXX" \ + UNITY_EMAIL="ci@example.com" UNITY_PASSWORD="pw123456" \ + bash -c 'source "$STEPS_DIR/return_license.sh"' > /dev/null 2>&1 +check "a serial return authenticates with the account username" "$(cat "$ARGV_LOG")" "-username ci@example.com" +check "a serial return authenticates with the account password" "$(cat "$ARGV_LOG")" "-password pw123456" + echo "Ambiguous licensing method warning" # A credential that names a specific strategy (a .ulf, a real serial, a # licensing server) but gets silently overridden by a different strategy is