Code Monkey home page Code Monkey logo

Comments (8)

mob-sakai avatar mob-sakai commented on July 17, 2024 4

In some failing cases, the output will be different.

tl; dr

How to check activation result:

unity-editor -quit -logFile activation.log -manualLicenseFile <UNITY_LICENSE_FILE>
[ -z "`grep -e 'Next license update check is after' activation.log`" ]  && echo 'error: Failed to load license file'
[ -n "`grep -e 'Failed to load license file from' activation.log`" ]  && echo 'error: Failed to load license file'
[ -n "`grep -e 'LICENSE SYSTEM.* != ' activation.log`" ]  && echo 'error: Machine ID is different'



Success

$ unity-editor -quit -logFile /dev/stdout -manualLicenseFile success.ulf
...
 Load manual activation license file.
LICENSE SYSTEM [2021120 17:25:14] Load license file from: success.ulf
LICENSE SYSTEM [2021120 17:25:14] Next license update check is after 2021-01-21T17:04:09
 License file loaded.

Failed: Machine ID is different

$ unity-editor -quit -logFile /dev/stdout -manualLicenseFile unmatched_machine_id.ulf
...
 Load manual activation license file.
LICENSE SYSTEM [2021120 17:11:47] Load license file from: unmatched_machine_id.ulf
LICENSE SYSTEM [2021120 17:11:47] Next license update check is after 2021-01-21T17:10:34
LICENSE SYSTEM [2021120 17:11:47] 576562626572264761624c65526f7578 != B2DD8DE7-7E63-5962-95B4-3EEA5A1718C0
LICENSE SYSTEM [2021120 17:11:47] 576562626572264761624c65526f7578 != C02VQ158HTDG
 License file loaded.

Failed: The input file is not found

$ unity-editor -quit -logFile /dev/stdout -manualLicenseFile non_exist.ulf
...
 Load manual activation license file.
LICENSE SYSTEM [2021120 17:20:50] Load license file from: non_exist.ulf
LICENSE SYSTEM [2021120 17:20:50] Failed to load license file from: non_exist.ulf
 License file loaded.

Failed: The input file is empty

$ unity-editor -quit -logFile /dev/stdout -manualLicenseFile empty.ulf
...
 Load manual activation license file.
LICENSE SYSTEM [2021120 17:13:55] Load license file from: empty.ulf
LICENSE SYSTEM [2021120 17:13:55] Failed to load license file from: empty.ulf
 License file loaded.

Failed: The input file is alf

$ unity-editor -quit -logFile /dev/stdout -manualLicenseFile Unity.alf
...
 Load manual activation license file.
LICENSE SYSTEM [2021120 17:17:5] Load license file from: Unity.alf
LICENSE SYSTEM [2021120 17:17:5] Could not find digest XML element in license file. 
 License file loaded.

Failed: The structure of the input file is different

$ unity-editor -quit -logFile /dev/stdout -manualLicenseFile different_structure.ulf
...
 Load manual activation license file.
LICENSE SYSTEM [2021120 17:15:16] Load license file from: different_structure.ulf
 License file loaded.

from docker.

webbertakken avatar webbertakken commented on July 17, 2024 2

Thank you for reporting this issue.

This is a bug in Unity editor itself, which doesn't omit a non-zero exit code when hardware ids mismatch or in some cases where invalid licenses are given.

Workaround

Most people move past this by fixing their activation while setting up their project, since the actual build step uses proper exit codes (which you can extend yourself inside the build script).

Additional information

It's a bug that predates this very repository and has been reported in unity-actions, unity-builder and in repository of the preceeding images gableroux/unity3d and the gableroux/unity3d-gitlab-ci-example.

Since we can't rely on exit code (pre-build-time anyway) we would have to either inject something in the binary or somehow extract the right information out of the output. So far nobody has come up with a reliable way to do this.

To anyone reading this, feel free to reopen if you have suggestions on how to solve this in an elegant way.

from docker.

GabLeRoux avatar GabLeRoux commented on July 17, 2024 1

So if we want to support this, we should have some way to parse unity's output to provide more insights on the error. It is probably feasible, but the solution should be discussed as this is definitely something that can make things more complicated in the project (and we want to keep actions as simple as possible here).

Edit: I missed the How to check activation result: part above sorry for confusion.

Should we execute unity command with tee instead? example: | tee unity_stdout.log and after the step, cat unity_stdout.log | grep '<some possible errors>'?

-logFile /dev/stdout should be kept otherwise, output won't be streamed to job's stdout.

Or is it possible (and desired) to run suggested command above and then proceed with a build in the actions?

from docker.

webbertakken avatar webbertakken commented on July 17, 2024 1

If we pipe it into an application, it should be something that can also forward non-zero exit codes while still logging to console.

Or perhaps we can use PIPESTATUS[0] as explained in this answer on StackOverflow.

from docker.

webbertakken avatar webbertakken commented on July 17, 2024 1

Reopening as it seems we have some ways to move forward. I have attempted it before, back when starting builder action, but I didn't manage to get it to work back then.

PRs are most welcome on this one :)

from docker.

erlioniel avatar erlioniel commented on July 17, 2024

Closed. For details - @webbertakken

from docker.

mob-sakai avatar mob-sakai commented on July 17, 2024

When a license activation fails, additional context can be output using the solution described above.
For example:

  • Run Unity with -createManualActivationFile option to create and output a new alf file
    • Users can fix the license activation error without any new workflow (unity-request-activation-file action)
  • Output about "how to activate a license" (i.e. "what should you do next")

Do you have any suggestions?

from docker.

webbertakken avatar webbertakken commented on July 17, 2024

I really like that idea, however I would keep them separate for now. The idea is to fully automate activation.

There's an issue for it game-ci/unity-builder#193.

So I'd keep the scope to activation only for now (thus excluding requesting activation file).

from docker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.