myoung34 / docker-github-actions-runner

This will run the new self-hosted github actions runners with docker-in-docker
GNU General Public License v3.0
1.63k stars 386 forks source link

Feature request: Ability to set final RUNNER_WORKDIR (without _RUNNER_NAME suffix) #382

Closed matejdro closed 3 weeks ago

matejdro commented 1 month ago

At the moment, this image will always add runner name to the workdir. This makes the workdir different between different runners.

Cache systems of some build tools (such as Gradle's configuration cache) depend on absolute path to the project being consistent. But with this forceful RUNNER_NAME suffix, we cannot restore cache between different runners, since path to the project will be different on different runners.

Any chance this behavior could be configured?

Thanks.

myoung34 commented 4 weeks ago

If you set RUNNER_WORKDIR this is not true

docker run ... -e RUNNER_WORKDIR=/tmp -e RUNNER_NAME=foo will result in /tmp https://github.com/myoung34/docker-github-actions-runner/blob/master/goss_full.yaml#L9

Are you seeing something I'm not?

matejdro commented 3 weeks ago

From what I can see, script will always create _RUNNER_WORKDIR from the RUNNER_WORKDIR variable, with extra name padded in: https://github.com/myoung34/docker-github-actions-runner/blob/eb29a1af8cef6e75e9ea673beb78b090c646e45c/entrypoint.sh#L51

matejdro commented 3 weeks ago

Ah nevermind, it appears that the : in bash is the fallback, I thought it was always appending it. Just learned about this operator today. Thanks!