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

Publish image with VisionPro module to Docker Hub #248

Open tmokmss opened 1 week ago

tmokmss commented 1 week ago

Context

Hi, is there any plan to publish images with VisionPro module to Docker Hub? Currently we have to build and manage the image by ourselves.

Suggested solution

We can build a docker image with VisionPro module support by the following command:

git clone https://github.com/game-ci/docker.git
cd docker/images/ubuntu/editor
docker build --platform linux/amd64 --build-arg="version=2022.3.31f1" --build-arg="module=visionos" .

Considered alternatives

If it is not published by gameci, we have to manage images by ourselves.

Additional details

GabLeRoux commented 1 week ago

It would be a nice addition to the Docker images indeed. 🙏

Here is how we can add VisionPro Module Support to Docker Images:

  1. Identifying Unity Versions with VisionPro Support

    Unity’s official support for VisionPro is available starting from Unity version 2022.3.18f1 according to the "Official Support for visionOS Now Available" Thread. This release is compatible with visionOS 1.0 and Xcode 15.2.

  2. Add VisionPro Module Support

    We can add VisionPro module support to the Dockerfile like this:

    diff --git a/images/ubuntu/editor/Dockerfile b/images/ubuntu/editor/Dockerfile
    index 63b6977..a68e29f 100644
    --- a/images/ubuntu/editor/Dockerfile
    +++ b/images/ubuntu/editor/Dockerfile
    @@ -32,6 +32,10 @@ RUN echo "$version-$module" | grep -q -vP '^(2021.2.(?![0-4](?![0-9]))|2021.[3-9
    && exit 0 \
    || unity-hub install-modules --version "$version" --module "windows-server" --childModules | tee /var/log/install-module-windows-server.log && grep 'Missing module' /var/log/install-module-windows-server.log | exit $(wc -l);
    
    +RUN echo "$version-$module" | grep -q -vP '^(2022\.3\.(1[8-9]|[2-9][0-9])|202[3-9]|[6-9][0-9]{0,2})f.*visionos' \
    +  && exit 0 \
    +  || unity-hub install-modules --version "$version" --module "visionos" --childModules | tee /var/log/install-module-visionos.log && grep 'Missing module' /var/log/install-module-visionos.log | exit $(wc -l);
    +
    ###########################
    #          Editor         #
    ###########################

    The above regex should correctly match these:

    • Unity 2022.3.18f1 and above
    • All versions from 2023 onward
    • Unity 6 and above

    Note: I am not sure if the regex part is necessary. It might be possible to just add the visionos module without checking the version.

  3. Manually Build the Image

    We can manually build the image like this (inspired by the OP's suggestion):

    docker build --platform linux/amd64 --build-arg="version=2022.3.18f1" --build-arg="module=visionos" .

    We should confirm that this works as expected, but I would assume it does, according to the issue description.

  4. Automatic publishing of the images

    This game-ci/docker project is linked to game-ci/versioning-backend hosted on Firebase which triggers jobs when new versions are detected on Unity's archive page. Here is a brief overview of how this works:

    • Unity Version Ingest: Detects new Unity versions and adds them to the database.
    • Docker Version Ingest: Similar process for Docker versions.
    • Scheduler: Triggers a CI job for each new version detected, which in turn creates multiple CI builds for each base OS-target platform combination.

    We can find details about the scheduler here

    Each CI build starts with the status started and is updated as the build progresses. The final status is published once the build is successfully completed. Completed CI jobs are reported to Discord.

    Now the part I'm not sure about is how to ensure that the module gets passed correctly by the backend. From what I understand, this is where the module is received from the backend:

    https://github.com/game-ci/docker/blob/6d227be686f06b15d73b3773a44e2926b96a3f7d/.github/workflows/retry-ubuntu-editor-image-requested.yml#L94-L94

    So we need to ensure that targetPlatform is correctly set to visionos in the backend.

  5. Trigger the CI job Once the module support is added in the game-ci/docker project and the versioning backend, we can trigger the jobs to build the images. I think there's a way to trigger the CI jobs manually. If I remember well, there is also a scheduled job.

  6. Test the new image It would be preferable to create a sample Unity project and test the new image (using the new targetPlatform) against it.

Contributions are welcomed 👍