game-ci / unity-orb

Build and test Unity projects for several platforms using CircleCI.
https://circleci.com/developer/orbs/orb/game-ci/unity
MIT License
7 stars 12 forks source link

Make return_license step in main job optional #26

Closed nanodeath closed 1 year ago

nanodeath commented 1 year ago

Orb version:

1.0.0

What happened:

When running with the unity-orb job, the build may succeed but then the "return license" step will run and fail:

LICENSE SYSTEM [2022831 1:41:30] Error fetching https://license.unity3d.com/update/poll?cmd=3&tx_id=41355cad154aaa5bf83f36699f935631
serial was activated manually for this computer and can't be returned

LICENSE SYSTEM [2022831 1:42:0] 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 is with a personal license. I followed the steps here.

Expected behavior:

Well, ideally the Unity service wouldn't return an error, it'd just say "okay thanks but I can't do anything with that."

Additional Information:

This forced me to decompose the job into its constituent commands, but...I'd have to do that anyway for my other "persist_to_workspace" issues mentioned in my other ticket (#25).

But if it wasn't for that, I'd be happy with any of the following options:

EricRibeiro commented 1 year ago

Hi @nanodeath 👋

Thank you for opening this issue! I couldn't reproduce the error. Does it consistently fail when you run the build job? Since it's a timeout error, I believe it could be due to overload or maintenance on Unity's license server.

nanodeath commented 1 year ago

Just tested again, and yeah, it fails consistently.

Some additional context: I have UNITY_ENCODED_LICENSE, UNITY_PASSWORD, and UNITY_USERNAME environment variables set via my context.

So, when the build initially runs I see this output:

[LicensingClient] Channel doesn't exist: "LicenseClient-root"
[Licensing::Module] Successfully launched the LicensingClient (PId: 216)
[SignatureVerifier] Application signature verification not supported on this platform.
[LicensingClient] Handshaking with LicensingClient (version: 1.9.0+249add7)
[Licensing::Module] Successfully connected to LicensingClient on channel: "LicenseClient-root" (connect: 0.48s, validation: 0.05s, handshake: 0.00s)
[Licensing::Module] Connected to LicensingClient (PId: 216, launch time: 0.00, total connection time: 0.53s)
Entitlement-based licensing initiated
[Licensing::Module] Error: Access token is unavailable
[LicensingClient] Licenses updated successfully

LICENSE SYSTEM [202291 1:8:7] Next license update check is after 2022-09-01T01:02:11

LICENSE SYSTEM [202291 1:8:7] Current license is already valid and activated. Skipping license activation process (Provided username/password will be ignored).

Which based on the last line makes it seem like only UNITY_ENCODED_LICENSE is being used. However, the return-license job doesn't even accept a parameter for that, only the username/password.

Basically it seems to me like if UNITY_ENCODED_LICENSE is set, there's nothing to return.

EricRibeiro commented 1 year ago

Is this what your current config looks like? Are you using the Ubuntu executor with 2021.3.8f1?

nanodeath commented 1 year ago

I've since updated to 1.1.0 (which works great 👍) but otherwise yes.

EricRibeiro commented 1 year ago

Hmm, I still can't make sense of this error.

I have tried to reproduce it using the build job and each command individually, but both are working for me. This is the config I am using (ref):

version: 2.1

orbs:
  unity: game-ci/unity@1.1.0

jobs:
  build-windows:
    executor:
      name: unity/ubuntu
      editor_version: 2021.3.8f1
      resource_class: large
      target_platform: windows-mono
    steps:
      - checkout
      - unity/prepare-env:
          project-path: "src"
          unity-license-var-name: "UNITY_ENCODED_LICENSE_2021"
      - unity/build:
          build-name: "MyBuild"
          build-target: StandaloneWindows64
          project-path: "src"
      - unity/return-license

workflows:
  build-unity-project:
    jobs:
      - build-windows:
          context: orb-testing-unity
      - unity/build:
          build-target: StandaloneWindows64
          context: orb-testing-unity
          project-path: "src"
          unity-license-var-name: "UNITY_ENCODED_LICENSE_2021"
          executor:
            name: unity/ubuntu
            editor_version: 2021.3.8f1
            resource_class: large
            target_platform: windows-mono
EricRibeiro commented 1 year ago

Since I could not reproduce it and it isn't a blocking problem, I'll close this issue. If it surfaces again, I'll re-open it.

nanodeath commented 1 year ago

Fair enough 🙂

YuriHeupa commented 1 year ago

I've also run into the same issue today using orb 1.1.0 and editor 2021.3.7f1. I followed the doc instructions to manually activate a personal license, but then the return license job fails since unity doesn't allow returning manually activated licenses. Had to recreate the flow in my stack to make the return job optional, would love to have some sort of config to whether run the job or not in the orb like #29 proposes.