game-ci / unity-return-license

Github Action to return a Unity pro license.
https://github.com/marketplace/actions/unity-return-license
MIT License
18 stars 11 forks source link

return-license fails to return a license #20

Open oshaughnessy opened 2 years ago

oshaughnessy commented 2 years ago

Bug description

Running "return-license" does not return a license.

How to reproduce

Manually invoke this workflow definition:

jobs:
  return-license:
    runs-on: ${{ github.event.inputs.runs-on }}
    env:
      UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }}
    steps:
      - uses: game-ci/unity-return-license@main
        if: always()

Expected behavior

An allocation of the license associated with $UNITY_SERIAL is returned to the Unity ID service.

Additional details

Initiating legacy licensing module
DisplayProgressbar: Returning license
Cancelling DisplayDialog: Failed to return license Unity license return request has timed out. Please verify that you are connected to the Internet and/or try again later.
This should not be called in batch mode.

(Filename: ./Editor/Platform/Linux/EditorUtility.cpp Line: 274)

DisplayProgressbar: Unity license
[UnityConnectServicesConfig] config is NOT valid, switching to default
[0322/193048:ERROR:browser_main_loop.cc(161)] Running without the SUID sandbox! See https://code.google.com/p/chromium/wiki/LinuxSUIDSandboxDevelopment for more information on developing with the sandbox on.
[0322/193048:ERROR:sandbox_linux.cc(308)] InitializeSandbox() called with multiple threads in process gpu-process
Cancelling DisplayDialog: Failed to activate/update license. Missing or bad username and password. Please try again using valid credentials or contact support@unity3d.com
This should not be called in batch mode.

(Filename: ./Editor/Platform/Linux/EditorUtility.cpp Line: 274)
davidmfinol commented 2 years ago

For additional context, this is trying to use a linux runner to return a license that was activated on a mac runner.

I believe the fix for this may be to introduce UNITY_USERNAME and UNITY_PASSWORD as optional parameters to this action. Then, if all 3 of UNITY_USERNAME, UNITY_PASSWORD, and UNITY_SERIAL are provided, we would use those 3 to call the -returnlicense.

oshaughnessy commented 2 years ago

Heh. I did try that, too, but I left them out of the example above, thinking it would confuse things. I got the same error either way.

webbertakken commented 2 years ago

Did you fork the action and pass these vars into the actual command?

oshaughnessy commented 2 years ago

Oh, no, sorry for the confusion. I just tried passing them as env vars. But looking at the code now (for the first time), I see those aren't used at all. I can give that a shot, though.

oshaughnessy commented 2 years ago

Okay, learning stuff! I forked this repo and added code to utilize the username and password if given. I get a timeout error:

LICENSE SYSTEM [2022324 21:3:21] Received https://license.unity3d.com/update/poll?cmd=9&tx_id=...

LICENSE SYSTEM [2022324 21:3:21] Headers:
    HTTP/1.1 200 OK
    sc-request-id: ...
    sc-token-expires-in: 7223
    Cache-Control: no-cache, no-store, must-revalidate
    Pragma: no-cache
    Expires: 0
    Vary: Accept-Encoding
    Content-Encoding: deflate
    Content-Type: text/plain
    Content-Length: 116

Cancelling DisplayDialog: Failed to activate/update license. Timeout occured while trying to update license. Please try again later or contact support@unity3d.com
This should not be called in batch mode.
davidmfinol commented 2 years ago

Is there some networking issue that would cause the timeout, or is it simply that we are invoking the return license incorrectly? Does the return license section on this page help?: https://docs.unity3d.com/Manual/ManagingYourUnityLicense.html

oshaughnessy commented 2 years ago

I was just working through the options there. It looks to me like older versions of Unity suggested just passing -returnlicense and newer versions of the docs suggest including -username and -password. None of them, that I could find, mention wanting -serial, and when I tried passing both -serial and -username/-password, I got an error that -serial should only be passed when activating. So... I think the check for $UNITY_SERIAL is a bit of a misguidance.

Regardless, I don't know why the networking error comes up. When I try the same command-line args from my Mac, I don't get the same response. It makes me wonder if there's a connectivity issue between Azure and id.unity.com.