renovatebot / renovate

Home of the Renovate CLI: Cross-platform Dependency Automation by Mend.io
https://mend.io/renovate
GNU Affero General Public License v3.0
17.24k stars 2.25k forks source link

renovate-config-validator reports "INFO: Config validated successfully" when no config exists #16025

Open Konafets opened 2 years ago

Konafets commented 2 years ago

How are you running Renovate?

Mend Renovate hosted app on github.com

If you're self-hosting Renovate, tell us what version of Renovate you run.

32.83.2

Please select which platform you are using if self-hosting.

No response

If you're self-hosting Renovate, tell us what version of the platform you run.

No response

Was this something which used to work for you, and then stopped?

I never saw this working

Describe the bug

I wanted to recreate the on-boarding PR on Gitlab via PR. I did not merge the first onboarding PR, so I do not have any renovate related config file and since its a JAVA project, no package.json. But when I run renovate-config-validator it reports:

INFO: Config validated successfully

I expected either it tells me that there is no config file and/or offers to create one with basic settings.

Relevant debug logs

No response

Have you created a minimal reproduction repository?

No reproduction repository

PhilipAbed commented 2 years ago

i believe re-creating the on-boarding PR could be problematic on the app side with the same repository name cause of cache , maybe just add the renovate.json manually, or try changing the repository name it could be cached on the app side too. I'm not sure how to clean app cache, or how long does it take to refresh

Konafets commented 2 years ago

Hi,

I installed Renovate Bot app in Github.com and gave permissions to one repo. RB created the on-boarding PR. Beside that I had another PR, which already updated some of the dependencies, RB would like to update as well.

Here I read that I should rename the onboarding PR from "Configure Renovate" to "Configure Renovate - old" and wait that RB creates a new one. I did, but RB did not created a new one, so I keep searching and found these instructions https://docs.renovatebot.com/getting-started/installing-onboarding/#reconfigure-via-pr. I installed RB globally via NPM and executed renovate-config-validator with the hope that might help in terms to create an onboarding commit locally. To my surprise it told my that my configuration was validated successfully which is weird since I do not have a RB configuration file.

TLDR: The CLI app renovate-config-validator seems not to check if a configuration file exist in the current directory.

github-actions[bot] commented 2 years ago

Hi there,

Get your issue fixed faster by creating a minimal reproduction. This means a repository dedicated to reproducing this issue with the minimal dependencies and config possible.

Before we start working on your issue we need to know exactly what's causing the current behavior. A minimal reproduction helps us with this.

To get started, please read our guide on creating a minimal reproduction.

We may close the issue if you, or someone else, haven't created a minimal reproduction within two weeks. If you need more time, or are stuck, please ask for help or more time in a comment.

Good luck,

The Renovate team

PhilipAbed commented 2 years ago

i believe you should have this parameter, and thats where the config is found, RENOVATE_CONFIG_FILE

PhilipAbed commented 2 years ago

C:\tests\renovateTutorial>renovate-config-validator DEBUG: Using RE2 as regex engine DEBUG: Checking for config file in C:\tests\renovateTutorial/config.js DEBUG: No config file found on disk - skipping INFO: Config validated successfully

rarkins commented 2 years ago

So the question is: if no config file is found, then should we exit successfully or unsuccessfully?

PhilipAbed commented 2 years ago

@rarkins if the config file is not found we are just Merging the other default configs in, and the validation is successful anyway, But because we are running from the script it doesn't pass through the requireConfig check, we do that when Onboarding pr.. so its just OK to keep going in a real repo run, it's a script issue only

Konafets commented 2 years ago

Maybe you could add an additional info, that the current path does not contain a configuration file.

PhilipAbed commented 2 years ago

we might just need to add config.requireConfig=required and file not found => exit code "-1" with error message maybe

file.ts -> line 70

    } else {
      // istanbul ignore next: we can ignore this
      logger.debug('No config file found on disk - skipping');
      //---------------------------- we can add this, but i'm not sure it won't hurt any other flow :D
      if(config.requireConfig === "required"){
        logger.fatal('No Config File Found ');
        process.exit(1);
      }
    }
rarkins commented 2 years ago

I think it will always be true if there's no config

rarkins commented 1 year ago

Resolution: fail if no config file found at all

HonkingGoose commented 10 months ago

I'm re-opening this issue because we reverted the PR that closed this issue:

viceice commented 10 months ago

I think it should only fail if the strict flag is used