renovatebot / github-action

Other
285 stars 80 forks source link

Config file cannot be mounted if runner is a container (docker in docker / dind) #870

Open 2franix opened 5 hours ago

2franix commented 5 hours ago

This may be somewhat related to #793, maybe not.

I run the action as part of a Gitea workflow which runs itself in a docker container. Thus, my setup involves docker in docker (dind) or something similar: the container running the workflow executes the renovate action which runs another container. It is of importance to understand the problem.

Here is an excerpt of the workflow run:

[command]/usr/bin/docker run --env LOG_LEVEL --env RENOVATE_TOKEN=*** --env RENOVATE_CONFIG_FILE=/github-action/config.js --volume /workspace/self-hosting/renovate-config/config.js:/github-action/config.js --volume /tmp:/tmp --rm ghcr.io/renovatebot/renovate:latest
DEBUG: Using RE2 regex engine
DEBUG: Parsing configs
DEBUG: Checking for config file in /github-action/config.js
FATAL: Error parsing config file

I checked a few things interactively in the runner and renovate containers while they were running. The config.js file DOES exist in the container running the workflow. But mounting it with --volume /workspace/self-hosting/renovate-config/config.js:/github-action/config.js leads to docker mounting the file to a directory inside the renovate container. Not a file.

This SO answer sheds some light as to why docker fails to see the source file.

The same problem affects the entrypoint script specified with docker-cmd-file, because the file is mounted the same way.

One way to fix it would be to mount a directory containing the config file and the cmd file instead of mounting the files directly.

rarkins commented 4 hours ago

Why are your raising an issue about it here? Isn't this a docker environment problem and not renovate's problem?

2franix commented 4 hours ago

Well, that's too bad that docker in a container does not support the use case but IMO the problem is to be fixed in this action. For example, as suggested in my previous message, this line could be changed to mount a folder containing the configuration file.