game-ci / docker

Series of CI-specialised docker images for Unity.
https://hub.docker.com/u/unityci
MIT License
392 stars 121 forks source link

unity-hub headless option does not seem to work properly #204

Closed ggaudeau closed 1 year ago

ggaudeau commented 1 year ago

Bug description

When I am using a too recent version of Unity Hub (>= 3.3.0) then the script unity-hub generates a lot non-fatal errors. That occurs only if it is launched from a container.

At the end we get the docker image unity-hub but it makes the Gitlab job fails.

How to reproduce

Expected behavior

A way to avoid having these error logs in the terminal output.

Additional details

#7 [builder 2/5] RUN unity-hub install --version "2022.2.11f1" --changeset ...
#7 2.656 [22:0403/115000.551237:ERROR:bus.cc(398)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
#7 2.656 [22:0403/115000.551816:ERROR:bus.cc(398)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
#7 2.658 [22:0403/115000.554119:ERROR:bus.cc(398)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
#7 2.658 [22:0403/115000.554205:ERROR:bus.cc(398)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
#7 2.783 [53:0403/115000.679104:ERROR:viz_main_impl.cc(186)] Exiting GPU process due to errors during initialization
#7 2.919 [96:0403/115000.814817:ERROR:viz_main_impl.cc(186)] Exiting GPU process due to errors during initialization
#7 2.973 [143:0403/115000.869070:ERROR:gpu_memory_buffer_support_x11.cc(44)] dri3 extension not supported.
#7 3.754 [22:0403/115001.649813:ERROR:bus.cc(398)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
#7 3.754 [22:0403/115001.649896:ERROR:bus.cc(398)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
#7 3.754 [22:0403/115001.649956:ERROR:bus.cc(398)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
#7 3.771 This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
#7 3.771 Error: Unknown or unsupported transport “disabled” for address “disabled:”
#7 3.774 (node:22) UnhandledPromiseRejectionWarning: Error: Unknown or unsupported transport “disabled” for address “disabled:”
#7 3.774 (Use `unityhub-bin --trace-warnings ...` to show where the warning was created)
#7 3.775 (node:22) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 7)
#7 3.775 This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
#7 3.775 Error: Unknown or unsupported transport “disabled” for address “disabled:”
#7 3.776 (node:22) UnhandledPromiseRejectionWarning: Error: Unknown or unsupported transport “disabled” for address “disabled:”
#7 3.777 (node:22) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 8)
#7 3.777 This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
#7 3.778 Error: Unknown or unsupported transport “disabled” for address “disabled:”
#7 3.778 (node:22) UnhandledPromiseRejectionWarning: Error: Unknown or unsupported transport “disabled” for address “disabled:”
#7 3.779 (node:22) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 9)
#7 3.779 This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
#7 3.780 Error: Unknown or unsupported transport “disabled” for address “disabled:”
#7 3.780 (node:22) UnhandledPromiseRejectionWarning: Error: Unknown or unsupported transport “disabled” for address “disabled:”
#7 3.781 (node:22) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 10)
#7 3.781 This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
#7 3.782 Error: Unknown or unsupported transport “disabled” for address “disabled:”
#7 3.782 (node:22) UnhandledPromiseRejectionWarning: Error: Unknown or unsupported transport “disabled” for address “disabled:”
#7 3.783 (node:22) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 11)

The error seems to be triggered by the presence of the keyword Error

ggaudeau commented 1 year ago

After updating repository to the new revision (thanks to @AndrewKahr for his work on android 2022 integration), I fall into an other problem because the module android-sdk-command-line-tools is not found in /opt/unity/modules.json file

AndrewKahr commented 1 year ago

Can I get more detail into when you run into this? Namely Unity version, the exact error message, what you're running when you hit that error, etc.

ggaudeau commented 1 year ago

Yes, of course. Sorry.

I am running this command using unity-hub 3.4.1:

docker build game-ci/docker/images/ubuntu/editor -t unity-editor --build-arg baseImage=unity-base --build-arg hubImage=unity-hub --build-arg version="2022.2.11f1" --build-arg changeSet="621cd60d08fd" --build-arg module="android"

And there is the output:

#1 [internal] load .dockerignore
#1 transferring context: 2B done
#1 DONE 0.0s
#2 [internal] load build definition from Dockerfile
#2 transferring dockerfile: 14.64kB done
#2 DONE 0.0s
#3 [internal] load metadata for docker.io/library/unity-base:latest
#3 DONE 0.0s
#4 [internal] load metadata for docker.io/library/unity-hub:latest
#4 DONE 0.0s
#5 [stage-1  1/19] FROM docker.io/library/unity-base
#5 CACHED
#6 [builder 1/5] FROM docker.io/library/unity-hub
#6 DONE 0.0s
#7 [builder 2/5] RUN unity-hub install --version "2022.2.11f1" --changeset ...

=> unity-hub warnings related to the fact that we try to launch it from a docker container (despite the headless option)

#7 7.316 Progress:
#7 7.316 [Unity 2022.2.11f1] queued for download.
#7 7.316 Progress:
#7 7.317 [Unity 2022.2.11f1] queued for download.
#7 7.322 Progress:
#7 7.322 [Unity 2022.2.11f1] validating download...
#7 7.323 Progress:
#7 7.323 [Unity 2022.2.11f1] validating download...
#7 7.323 Progress:
#7 7.323 [Unity 2022.2.11f1] validating download...
#7 8.173 Progress:
#7 8.173 [Unity 2022.2.11f1] in progress...
#7 9.379 Progress:
#7 9.380 [Unity 2022.2.11f1] downloading 0.55%
...
#7 183.3 Progress:
#7 183.3 [Unity 2022.2.11f1] downloading 99.61%
#7 183.8 Progress:
#7 183.8 [Unity 2022.2.11f1] downloading 100.00%
#7 183.8 Progress:
#7 183.8 [Unity 2022.2.11f1] finished downloading.
#7 183.8 Progress:
#7 183.8 [Unity 2022.2.11f1] finished downloading.
#7 183.8 Progress:
#7 183.8 [Unity 2022.2.11f1] queued for install.
#7 183.8 Progress:
#7 183.8 [Unity 2022.2.11f1] queued for install.
#7 189.1 Progress:
#7 189.1 [Unity 2022.2.11f1] validating installation...
#7 189.1 Progress:
#7 189.1 [Unity 2022.2.11f1] validating installation...
#7 189.1 Progress:
#7 189.1 [Unity 2022.2.11f1] installing...
#7 354.0 Progress:
#7 354.0 [Unity 2022.2.11f1] installed successfully.
#7 354.0 All Tasks Completed Successfully.
#7 354.0 Progress:
#7 354.0 [Unity 2022.2.11f1] installed successfully.
#7 354.0 All Tasks Completed Successfully.
#7 DONE 358.8s
#8 [builder 3/5] RUN for mod in android; do       if [ "$mod" = "base" ] ; ...

=> unity-hub warnings related to the fact that we try to launch it from a docker container (despite the headless option)

#8 3.666 Adding module android-sdk-platform-tools as dependency of android-sdk-ndk-tools.
Adding module android-sdk-build-tools as dependency of android-sdk-ndk-tools.
Adding module android-sdk-platforms-29 as dependency of android-sdk-ndk-tools.
Adding module android-sdk-platforms-30 as dependency of android-sdk-ndk-tools.
Adding module android-ndk as dependency of android-sdk-ndk-tools.
Progress:
#8 3.677 [Android Build Support] queued for download.
#8 3.678 Progress:
#8 3.678 [Android Build Support] queued for download.
#8 3.683 Progress:
#8 3.683 [Android Build Support] validating download...
#8 3.684 Progress:
#8 3.684 [Android Build Support] validating download...
#8 3.684 Progress:
#8 3.684 [Android Build Support] validating download...
#8 3.693 Progress:
#8 3.693 [Android Build Support] validating download...
#8 3.693 [Android SDK Platform Tools] queued for download.
#8 3.693 Progress:
#8 3.693 [Android Build Support] validating download...
#8 3.693 [Android SDK Platform Tools] queued for download.
#8 3.695 Progress:
#8 3.695 [Android Build Support] validating download...
#8 3.695 [Android SDK Platform Tools] validating download...
#8 3.695 Progress:
#8 3.695 [Android Build Support] validating download...
#8 3.695 [Android SDK Platform Tools] validating download...
#8 3.695 Progress:
#8 3.695 [Android Build Support] validating download...
#8 3.696 [Android SDK Platform Tools] validating download...
#8 3.705 Progress:
#8 3.705 [Android Build Support] validating download...
#8 3.705 [Android SDK Platform Tools] validating download...
#8 3.705 [Android SDK Build Tools] queued for download.
...
#8 230.2 [Android SDK Platforms 29] installed successfully.
#8 230.2 [Android SDK Platforms 30] installed successfully.
#8 230.2 [OpenJDK] installed successfully.
#8 230.2 [Android SDK & NDK Tools] installed successfully.
#8 230.2 [Android NDK] installed successfully.
#8 230.2 All Tasks Completed Successfully.
#8 DONE 238.7s
#9 [builder 4/5] RUN echo "2022.2.11f1-android" | grep -q -vP '^(2021.2.(?!...
#9 DONE 0.6s
#10 [builder 5/5] RUN echo "2022.2.11f1-android" | grep -q -vP '^(2021.2.(?!...
#10 DONE 0.6s
#11 [stage-1  2/19] COPY --from=builder /opt/unity/editors/2022.2.11f1/ /opt...
#11 DONE 59.5s
#12 [stage-1  3/19] RUN echo 2022.2.11f1 > "/opt/unity/version"
#12 DONE 0.4s
#13 [stage-1  4/19] RUN /bin/echo -e '#!/bin/bash\n\nif [ -d /usr/bin/unity-...
#13 DONE 0.6s
#14 [stage-1  5/19] RUN echo "2022.2.11f1-android" | grep -q -v '^2019.3.[0-...
#14 DONE 0.6s
#15 [stage-1  6/19] RUN echo "2022.2.11f1-android" | grep -q -v '^\(2019.3.[...
#15 DONE 0.6s
#16 [stage-1  7/19] RUN echo "2022.2.11f1-android" | grep -q -v '^\(2020.1\|...
#16 DONE 0.6s
#17 [stage-1  8/19] RUN echo "2022.2.11f1-android" | grep -q -v '^2018\.[34]...
#17 DONE 0.5s
#18 [stage-1  9/19] RUN echo "2022.2.11f1-android" | grep -q -vP '^20(?!18)....
#18 DONE 0.7s
#19 [stage-1 10/19] RUN echo "2022.2.11f1-android" | grep -q -vP '^(202[1-9]...
#19 DONE 0.6s
#20 [stage-1 11/19] RUN echo "2022.2.11f1-android" | grep -q -vP '^(20(19|20...
#20 DONE 0.5s
#21 [stage-1 12/19] RUN echo "2022.2.11f1-android" | grep -q -vP '^(202[1-9]...
#21 0.463 /bin/sh: 1: /bin/sdkmanager: not found
#21 ERROR: process "/bin/sh -c echo \"$version-$module\" | grep -q -vP '^(202[1-9]|20[3-9]).*android'   && exit 0   || :   && . ~/.bashrc   && yes | \"${ANDROID_CMDLINE_TOOLS_PATH}/bin/sdkmanager\" --licenses" did not complete successfully: exit code: 127
------
 > [stage-1 12/19] RUN echo "2022.2.11f1-android" | grep -q -vP '^(202[1-9]|20[3-9]).*android'   && exit 0   || :   && . ~/.bashrc   && yes | "${ANDROID_CMDLINE_TOOLS_PATH}/bin/sdkmanager" --licenses:
------
process "/bin/sh -c echo \"$version-$module\" | grep -q -vP '^(202[1-9]|20[3-9]).*android'   && exit 0   || :   && . ~/.bashrc   && yes | \"${ANDROID_CMDLINE_TOOLS_PATH}/bin/sdkmanager\" --licenses" did not complete successfully: exit code: 127
AndrewKahr commented 1 year ago

Ah the changes that made it to main are for Unity Hub 3.4.2-beta.1 as that version is the first to fix the incorrect android package installation when in headless mode. This will not work with 3.4.1 or earlier.

ggaudeau commented 1 year ago

It works perfectly with Unity Hub 3.4.2-beta.1. Thank you.