renovatebot / config-help

Please use the Discussions feature of https://github.com/renovatebot/renovate instead
https://github.com/renovatebot/renovate/discussions
MIT License
27 stars 16 forks source link

Run renovate in Kubernetes. #894

Closed darlenya closed 4 years ago

darlenya commented 4 years ago

Hi all,

What Renovate type, platform and version are you using? self hostet Kubernetes with the slim image and version 23.36.4. The repos are in self hosted GitLab

Describe the bug

We are running renovate in Kubernetes. For Go and JS it works fine. But for Java Projects we encounter problems.

The cmd

docker run --rm --name=renovate_gradle --label=renovate_child -v "/tmp/renovate/repos/gitlab/myProjectRepo":"/tmp/renovate/repos/gitlab/myProjectRepo" -v "/tmp/renovate/cache":"/tmp/renovate/cache" -e GRADLE_OPTS -w "/tmp/renovate/repos/gitlab/myProjectRepo" docker.io/renovate/gradle bash -l -c "./gradlew --init-script renovate-plugin.gradle renovate"

crashes because it could not find ./gradlew. This is caused by the given mounted directory in the gradle docker container is empty. The problem ist that there is no shared directory between two pods when running in Kuberenetes. A solution might be, a Kubernetes configuration, that launches multiple container in that one pod, with a shared directory.

Relevant debug logs

DEBUG: Extracting dependencies from all gradle files (repository=myProjectRepo)
DEBUG: Creating renovate-plugin.gradle file with renovate gradle plugin (repository=myProjectRepo)
DEBUG: docker-compose.extractPackageFile() (repository=myProjectRepo)
DEBUG: gradle-wrapper.extractPackageFile() (repository=myProjectRepo)
DEBUG: Gradle Wrapper (repository=myProjectRepo)
       "depName": "gradle",
       "currentValue": "6.6.1",
       "datasource": "gradle-version",
       "versioning": "gradle"
DEBUG: Start gradle command (repository=myProjectRepo)
       "cmd": "./gradlew --init-script renovate-plugin.gradle renovate"
DEBUG: Using docker to execute (repository=myProjectRepo)
DEBUG: No tag or tagConstraint specified (repository=myProjectRepo)
       "image": "docker.io/renovate/gradle"
DEBUG: Fetching Docker image: docker.io/renovate/gradle (repository=myProjectRepo)
DEBUG: docker-compose.extractPackageFile() (repository=myProjectRepo)
DEBUG: docker-compose.extractPackageFile() (repository=myProjectRepo)
DEBUG: Finished fetching Docker image (repository=myProjectRepo)
DEBUG: Executing command (repository=myProjectRepo)
       "command": "docker run --rm --name=renovate_gradle --label=renovate_child -v \"/tmp/renovate/repos/gitlab/myProjectRepo\":\"/tmp/renovate/repos/gitlab/myProjectRepo\" -v \"/tmp/renovate/cache\":\"/tmp/renovate/cache\" -e GRADLE_OPTS -w \"/tmp/renovate/repos/gitlab/myProjectRepo\" docker.io/renovate/gradle bash -l -c \"./gradlew --init-script renovate-plugin.gradle renovate\""
 WARN: Gradle extraction failed (repository=myProjectRepo)
       "errMessage": "Command failed: docker run --rm --name=renovate_gradle --label=renovate_child -v \"/tmp/renovate/repos/gitlab/myProjectRepo\":\"/tmp/renovate/repos/gitlab/myProjectRepo\" -v \"/tmp/renovate/cache\":\"/tmp/renovate/cache\" -e GRADLE_OPTS -w \"/tmp/renovate/repos/gitlab/myProjectRepo\" docker.io/renovate/gradle bash -l -c \"./gradlew --init-script renovate-plugin.gradle renovate\"\nbash: ./gradlew: No such file or directory\n"
DEBUG: Found docker-compose package files (repository=myProjectRepo)

To Reproduce

To reproduce it must run in a Kubernetes environment with any java project

viceice commented 4 years ago

is your docker deamon running on same host as your kubernetes? Then you need to mount the host /tmp to the renovate pod to get it working.

viceice commented 4 years ago

Currently we only official support running the full image in kubernetes, because it doesn't require docker.

Another solution is to extend the slim image and build your required tool to your image. see https://github.com/renovatebot/docker-renovate-full/blob/master/Dockerfile for samples

darlenya commented 4 years ago

Hi viceice, thanks for the fast answer, I give this back to our Ops Team.

darlenya commented 4 years ago

Hi, the full Image works. Thank you for the fast Help

viceice commented 4 years ago

ref: https://github.com/renovatebot/renovate/issues/6121

darlenya commented 4 years ago

As the full image works, I close this issue

viceice commented 4 years ago

Sure, just want to mention, that there is an open issue in our main repo for renovate native kubernetes support. (running renovate slim image with sidecar pods.)