tea icon indicating copy to clipboard operation
tea copied to clipboard

Generate Docs failed on MacBook Pro

Open linxpinx opened this issue 1 year ago • 7 comments

./Build/Scripts/runTests.sh -s docsGenerate failed on MacBook Pro.

Acceptance Criteria

  • [ ] ./Build/Scripts/runTests.sh -s docsGenerate is running
  • [ ] Docs are generated correctly

Additional Information

Errormessage:

adduser: unknown group typo3
su: unknown user typo3

linxpinx avatar Oct 14 '24 12:10 linxpinx

If I remember, I encountered a similar problem on my machine quite some time ago.

Are you using Docker or Podman?

oliverklee avatar Oct 14 '24 14:10 oliverklee

Hi Oli, I use https://github.com/abiosoft/colima. But I can try with docker.

linxpinx avatar Oct 14 '24 15:10 linxpinx

Ok i checked it with docker and it works with or without my changes. So I think we can take my changes into the code.

We also have the composer docs:generate command in the composer.json and in the Documentation.rst.

Maybe we can discuss this with the team.

linxpinx avatar Oct 14 '24 18:10 linxpinx

Is the group identifier really needed ?

Literally, instead of adding it dirctly to the command call following check should be investigated:

https://github.com/FriendsOfTYPO3/tea/blob/9a8834998f383cddae7fe58666e739ed8983cca1/Build/Scripts/runTests.sh#L437-L440

if [ "$(uname)" != "Darwin" ] && [ "${CONTAINER_BIN}" == "docker" ]; then
    # Run docker jobs as current user to prevent permission issues. Not needed with podman.
    USERSET="--user $HOST_UID"
fi

First, does the condition not work on your side and leaves USERSET empty ?

I would suggest to add a "DOCUMENTATION_USERSET" here in the condition setting the user along and replace ${USERSET} for the conrainer execution (run) call.

Not sure about the impact doing it in USERSET directly which are used for all container executions. At least should be checked for all if the group is added. In the end, should only target for macos and docker usage (docker command available).

sbuerk avatar Oct 14 '24 21:10 sbuerk

The group is needed otherwise the Rendering Process is not working.

First, does the condition not work on your side and leaves USERSET empty ? yes USERSET is empty cause I have a Mac, so Darwin is true.

I added this in runTests.sh:

if [ "$(uname)" != "Darwin" ] && [ "${CONTAINER_BIN}" == "docker" ]; then
    # Run docker jobs as current user to prevent permission issues. Not needed with podman.
    USERSET="--user $HOST_UID"
    elif [ "$(uname)" == "Darwin" ] && [ "${CONTAINER_BIN}" == "docker" ]; then
        USERSET="--user=$(id -u):$(id -g)"
fi

and extend the composer command: "docs:generate": "docker run --rm --user=$(id -u):$(id -g) -v $(pwd):/project ghcr.io/typo3-documentation/render-guides:latest --progress --config ./Documentation", and tested the other commands in runTests.sh where USERSET is used, works on Mac and Colima.

Maybe Windows/Linux can tested by someone else.

linxpinx avatar Oct 15 '24 12:10 linxpinx

Please note that for the render-guide repository the entrypoint of the Docker file:

https://github.com/TYPO3-Documentation/render-guides/blob/main/entrypoint.sh#L107

does some "magic" to try unifying the system to work on macos, windows and linux due the specialties of Docker in each of them.

We're open to optimizing this, if anyone has ideas on how it should be done so it works accross all systems without too much if-conditions ;)

garvinhicking avatar Oct 16 '24 17:10 garvinhicking

(Please note that in https://docs.typo3.org/other/t3docs/render-guides/main/en-us/Installation/Index.html#Setup_Docker we actually have a place that mentions this --user... command argument. Still, it would be great to somehow detect this properly within the container)

garvinhicking avatar Oct 23 '24 11:10 garvinhicking