From a69376ab465e87f6fde96a066d973da286c51c3f Mon Sep 17 00:00:00 2001 From: Rhys Arkins <rhys@arkins.net> Date: Mon, 10 Dec 2018 08:53:55 +0100 Subject: [PATCH] feat: printConfig MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds an option to print the full, resolved config for a repo at INFO level. e.g. renovate —print-config owner/repo Closes https://github.com/renovatebot/config-help/issues/128 --- lib/config/definitions.js | 8 ++++++++ lib/workers/repository/init/index.js | 4 ++++ .../repository/updates/__snapshots__/flatten.spec.js.snap | 8 ++++++++ website/docs/self-hosted-configuration.md | 4 ++++ 4 files changed, 24 insertions(+) diff --git a/lib/config/definitions.js b/lib/config/definitions.js index 13366aaa74..01cc5078c6 100644 --- a/lib/config/definitions.js +++ b/lib/config/definitions.js @@ -56,6 +56,14 @@ const options = [ admin: true, default: false, }, + { + name: 'printConfig', + description: + 'If enabled, Renovate will log the full config for each repo, including resolved presets', + type: 'boolean', + admin: true, + default: false, + }, { name: 'binarySource', description: 'Where to source binaries like `npm` and `yarn` from', diff --git a/lib/workers/repository/init/index.js b/lib/workers/repository/init/index.js index 35733eee74..b8b4f90f53 100644 --- a/lib/workers/repository/init/index.js +++ b/lib/workers/repository/init/index.js @@ -22,6 +22,10 @@ async function initRepo(input) { config = await checkBaseBranch(config); config.semanticCommits = await detectSemanticCommits(config); config = await detectVulnerabilityAlerts(config); + // istanbul ignore if + if (config.printConfig) { + logger.info({ config }, 'Full resolved config including presets'); + } return config; } diff --git a/test/workers/repository/updates/__snapshots__/flatten.spec.js.snap b/test/workers/repository/updates/__snapshots__/flatten.spec.js.snap index 807664ce67..61971df0b1 100644 --- a/test/workers/repository/updates/__snapshots__/flatten.spec.js.snap +++ b/test/workers/repository/updates/__snapshots__/flatten.spec.js.snap @@ -64,6 +64,7 @@ Array [ "prHourlyLimit": 0, "prNotPendingHours": 25, "prTitle": null, + "printConfig": false, "rangeStrategy": "replace", "rebaseLabel": "rebase", "rebaseStalePrs": null, @@ -157,6 +158,7 @@ Array [ "prHourlyLimit": 0, "prNotPendingHours": 25, "prTitle": null, + "printConfig": false, "rangeStrategy": "replace", "rebaseLabel": "rebase", "rebaseStalePrs": null, @@ -247,6 +249,7 @@ Array [ "prHourlyLimit": 0, "prNotPendingHours": 25, "prTitle": null, + "printConfig": false, "rangeStrategy": "replace", "rebaseLabel": "rebase", "rebaseStalePrs": true, @@ -343,6 +346,7 @@ Array [ "prHourlyLimit": 0, "prNotPendingHours": 25, "prTitle": null, + "printConfig": false, "rangeStrategy": "replace", "rebaseLabel": "rebase", "rebaseStalePrs": null, @@ -433,6 +437,7 @@ Array [ "prHourlyLimit": 0, "prNotPendingHours": 25, "prTitle": null, + "printConfig": false, "rangeStrategy": "replace", "rebaseLabel": "rebase", "rebaseStalePrs": true, @@ -529,6 +534,7 @@ Array [ "prHourlyLimit": 0, "prNotPendingHours": 25, "prTitle": null, + "printConfig": false, "rangeStrategy": "replace", "rebaseLabel": "rebase", "rebaseStalePrs": null, @@ -622,6 +628,7 @@ Array [ "prHourlyLimit": 0, "prNotPendingHours": 25, "prTitle": null, + "printConfig": false, "rangeStrategy": "replace", "rebaseLabel": "rebase", "rebaseStalePrs": null, @@ -715,6 +722,7 @@ Array [ "prHourlyLimit": 0, "prNotPendingHours": 25, "prTitle": null, + "printConfig": false, "rangeStrategy": "replace", "rebaseLabel": "rebase", "rebaseStalePrs": null, diff --git a/website/docs/self-hosted-configuration.md b/website/docs/self-hosted-configuration.md index 58103e3dd4..e537f9ee4b 100644 --- a/website/docs/self-hosted-configuration.md +++ b/website/docs/self-hosted-configuration.md @@ -66,6 +66,10 @@ Set this to `false` if (a) you configure Renovate entirely on the bot side (i.e. ## prFooter +## printConfig + +This option is useful for troubleshooting, particularly if using presets. e.g. run `renovate foo/bar --print-config > config.log` and the fully-resolved config will be included in the log file. + ## privateKey ## repositories -- GitLab