mend / renovate-ce-ee

Mend Renovate Documentation & Examples
https://www.mend.io/renovate/
Other
161 stars 56 forks source link

Mend Renovate CE 6.x overwrites some of the config.js attributes #371

Open GreyTeardrop opened 11 months ago

GreyTeardrop commented 11 months ago

Hi Renovate team!

Thank you for maintaining and enhancing self-hosted Renovate.

We use the Helm chart provided by you to deploy Renovate CE and GitHub application to integrate it with GitHub. We've recently upgraded to version 6.x and discovered some changes in its behavior. After some investigation, it looks like Renovate now unconditionally overwrites some of the config attributes set via the renovate.config Helm attribute and propagated through the config.js volume.

In particular, it seems to overwrite the gitAuthor and onboardingConfig attributes. It now unconditionally sets gitAuthor to the detected GitHub application used for integration

DEBUG: Detected config in env RENOVATE_CONFIG
       "config": {
         "dependencyDashboardFooter": "\n- [ ] <!-- manual job -->Check this box to trigger a request for Renovate to run again on this repository\n",
         "endpoint": "https://api.github.com/",
         "gitAuthor": "<our GitHub app name>[bot]@users.noreply.github.com",
         "platform": "github",
         "repositories": [...],
         "token": "***********",
         "username": "<our GitHub app name>[bot]"
       }

and then

DEBUG: Env config
       "config": {
         "dependencyDashboardFooter": "\n- [ ] <!-- manual job -->Check this box to trigger a request for Renovate to run again on this repository\n",
         "endpoint": "https://api.github.com/",
         "gitAuthor": "<our GitHub app name>@users.noreply.github.com",
         "platform": "github",
         "repositories": [...],
         "token": "***********",
         "username": "<our GitHub app name>",
         "hostRules": [],
         "binarySource": "install",
         "onboardingConfig": {
           "$schema": "https://docs.renovatebot.com/renovate-schema.json",
           "extends": ["config:recommended"]
         }
       }

It totally makes sense that gitAuthor is defaulted to the GitHub application name, but it was unexpected that the explicitly set value is now ignored. Should this be documented?

As for the onboarding config, it seems to come from the renovate-ce container image and, being an env, seems to take precedence over anything set in the config file

> docker image inspect ghcr.io/mend/renovate-ce:6.3.0-full | jq '.[].Config.Env'
[
  "PATH=/home/ubuntu/bin:/home/ubuntu/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
  "BASH_ENV=/usr/local/etc/env",
  "ENV=/usr/local/etc/env",
  "HOME=/home/ubuntu",
  "RENOVATE_BINARY_SOURCE=install",
  "RENOVATE_ONBOARDING_CONFIG={\"$schema\":\"https://docs.renovatebot.com/renovate-schema.json\",\"extends\":[\"config:recommended\"]}"
]
PhilipAbed commented 11 months ago

Thanks for reporting.

In order to change Git Author, you can be override it using the RENOVATE_GIT_AUTHOR env var, same goes for the RENOVATE_ONBOARDING_CONFIG.

we will document this.

GreyTeardrop commented 11 months ago

Thank you, @PhilipAbed!

I assume the same applies to other configuration options discovered in the env config like binarySource or dependencyDashboardFooter?

PhilipAbed commented 11 months ago

yes.

colinodell commented 10 months ago

As for the onboarding config, it seems to come from the renovate-ce container image and, being an env, seems to take precedence over anything set in the config file

I spent hours today trying to figure out why the extends part of my onboardingConfig was being ignored by Renovate. It turns out that RENOVATE_ONBOARDING_CONFIG is set as a default env var on the container, and thus its extends was taking precedence over mine. They only way to stop this is for me to move my configuration out of config.js and into my own RENOVATE_ONBOARDING_CONFIG env var for this one config field. This was very difficult to figure out, and the solution doesn't feel great.

Would you consider removing the RENOVATE_ONBOARDING_CONFIG env var from the container?

colinodell commented 10 months ago

(Alternatively, explicitly setting RENOVATE_ONBOARDING_CONFIG to an empty string seems to be a valid workaround to stop the default behavior)

rarkins commented 10 months ago

I can think of two possible solutions:

  1. Only set the env if it's undefined by the user, or
  2. Use RENOVATE_CONFIG for defaults so that they are overridable via individual env
mikaello commented 9 months ago

Shouldn't this be a part of the migration guide? I have also been struggling for a couple of hours now with the migration, and the root cause was this environment variable.

mhuijgen commented 7 months ago

(Alternatively, explicitly setting RENOVATE_ONBOARDING_CONFIG to an empty string seems to be a valid workaround to stop the default behavior)

It seems if I set this to an empty string in my docker-compose file used to start renovate-ce it will also result in the combined config having an empty onboardingConfig setting. So this does not seem to work for me. Quite annoying undocumented behavior this.

rarkins commented 7 months ago

In the next major release we'll stop populating RENOVATE_ONBOARDING_CONFIG by default