game-ci / unity-builder

Build Unity projects for different platforms
https://github.com/marketplace/actions/unity-builder
MIT License
852 stars 250 forks source link

Windows 11 Runner fails to Activate Unity License. #669

Closed Mannilie closed 2 months ago

Mannilie commented 2 months ago

Bug description

When attempting to run a session on a windows runner, the license server fails to connect for some reason. image

How to reproduce

  1. Setup a Windows machine as a Github Runner.
  2. Remove the 'c:' prefix from --workDir argument in the docker command for game-ci/builder (please see my PR here: https://github.com/game-ci/unity-builder/pull/668)
  3. Run a git action to build a simple game in Unity.
  4. Observe licensing errors.

Expected behavior

Unity should connect and authenticate to the licensing servers and continue with the build.

Additional details

There are some potentially related issues to this here:

Mannilie commented 2 months ago

Hey guys,

After doing some digging, I now understand the root cause of this issue - at least for me. I decided to do some tests on Docker to see if I can directly connect to the Unity licensing Servers and alas! It fails to connect when running a session on a Windows runner using Docker. The problem seems to be due to DNS resolution issues within Windows containers.

Solution:

You need to explicitly set the DNS servers in Docker Desktop's configuration to fix this:

  1. Open Docker Desktop Settings.
  2. Click on the Docker icon in your system tray and select "Settings".
  3. Navigate to the "Docker Engine" tab.
  4. Edit the Docker Engine Configuration:

Add the "dns" configuration to the JSON settings:

{
  "dns": ["8.8.8.8", "8.8.4.4"]
}

Note: If there are existing settings, ensure you maintain valid JSON syntax by adding commas where necessary.

  1. Click "Apply & Restart" to save the changes.

After restarting, the containers should correctly resolve DNS queries, allowing Unity to connect to the licensing servers and proceed with the build! 😄