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.19k stars 2.25k forks source link

Nuget manager should not parse any .props file strictly as xml #19220

Open janhoy opened 1 year ago

janhoy commented 1 year ago

How are you running Renovate?

Self-hosted

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

self-built

If you're self-hosting Renovate, select which platform you are using.

None

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?

It used to work, and then stopped

Describe the bug

Nuget mgr could catch the parse exception, log a frienly info that this can't be a nuget file and silently move on...

In our case it conflicts with a new versions.props file that gradle understands, see #8017

Repro repo: https://github.com/janhoy/gradle-consistent

Relevant debug logs

Logs ``` DEBUG: Matched 2 file(s) for manager nuget: subproject/versions.props, versions.props (repository=janhoy/gradle-consistent) DEBUG: Failed to parse subproject/versions.props (repository=janhoy/gradle-consistent) "err": { "message": "Non-whitespace before first tag.\nLine: 0\nColumn: 1\nChar: #", "stack": "Error: Non-whitespace before first tag.\nLine: 0\nColumn: 1\nChar: #\n at error (/Users/janhoy/git/renovate/node_modules/sax/lib/sax.js:651:10)\n at strictFail (/Users/janhoy/git/renovate/node_modules/sax/lib/sax.js:677:7)\n at beginWhiteSpace (/Users/janhoy/git/renovate/node_modules/sax/lib/sax.js:951:7)\n at SAXParser.write (/Users/janhoy/git/renovate/node_modules/sax/lib/sax.js:1006:11)\n at new XmlDocument (/Users/janhoy/git/renovate/node_modules/xmldoc/lib/xmldoc.js:295:17)\n at Object.extractPackageFile (/Users/janhoy/git/renovate/lib/modules/manager/nuget/extract.ts:124:23)\n at async getManagerPackageFiles (/Users/janhoy/git/renovate/lib/workers/repository/extract/manager-files.ts:52:19)\n at async /Users/janhoy/git/renovate/lib/workers/repository/extract/index.ts:47:28\n at async Promise.all (index 2)\n at async extractAllDependencies (/Users/janhoy/git/renovate/lib/workers/repository/extract/index.ts:45:26)\n at async extract (/Users/janhoy/git/renovate/lib/workers/repository/process/extract-update.ts:100:20)\n at async extractDependencies (/Users/janhoy/git/renovate/lib/workers/repository/process/index.ts:120:26)\n at async Object.renovateRepository (/Users/janhoy/git/renovate/lib/workers/repository/index.ts:48:52)\n at async attributes.repository (/Users/janhoy/git/renovate/lib/workers/global/index.ts:173:11)\n at async Object.start (/Users/janhoy/git/renovate/lib/workers/global/index.ts:158:7)\n at async /Users/janhoy/git/renovate/lib/renovate.ts:17:22" } DEBUG: Failed to parse versions.props (repository=janhoy/gradle-consistent) "err": { "message": "Non-whitespace before first tag.\nLine: 0\nColumn: 1\nChar: o", "stack": "Error: Non-whitespace before first tag.\nLine: 0\nColumn: 1\nChar: o\n at error (/Users/janhoy/git/renovate/node_modules/sax/lib/sax.js:651:10)\n at strictFail (/Users/janhoy/git/renovate/node_modules/sax/lib/sax.js:677:7)\n at beginWhiteSpace (/Users/janhoy/git/renovate/node_modules/sax/lib/sax.js:951:7)\n at SAXParser.write (/Users/janhoy/git/renovate/node_modules/sax/lib/sax.js:1006:11)\n at new XmlDocument (/Users/janhoy/git/renovate/node_modules/xmldoc/lib/xmldoc.js:295:17)\n at Object.extractPackageFile (/Users/janhoy/git/renovate/lib/modules/manager/nuget/extract.ts:124:23)\n at async getManagerPackageFiles (/Users/janhoy/git/renovate/lib/workers/repository/extract/manager-files.ts:52:19)\n at async /Users/janhoy/git/renovate/lib/workers/repository/extract/index.ts:47:28\n at async Promise.all (index 2)\n at async extractAllDependencies (/Users/janhoy/git/renovate/lib/workers/repository/extract/index.ts:45:26)\n at async extract (/Users/janhoy/git/renovate/lib/workers/repository/process/extract-update.ts:100:20)\n at async extractDependencies (/Users/janhoy/git/renovate/lib/workers/repository/process/index.ts:120:26)\n at async Object.renovateRepository (/Users/janhoy/git/renovate/lib/workers/repository/index.ts:48:52)\n at async attributes.repository (/Users/janhoy/git/renovate/lib/workers/global/index.ts:173:11)\n at async Object.start (/Users/janhoy/git/renovate/lib/workers/global/index.ts:158:7)\n at async /Users/janhoy/git/renovate/lib/renovate.ts:17:22" } ```

Have you created a minimal reproduction repository?

I have linked to a minimal reproduction repository in the bug description

rarkins commented 1 year ago

Reproduction forked to https://github.com/renovate-reproductions/19220

viceice commented 1 year ago

that's a debug message, renovate will skip those files. so you can safely ignore that debug message.

viceice commented 1 year ago

@rarkins maybe we should only log the error message without the full error object. 🤔

rarkins commented 1 year ago

I think if the error is XML parsing then no need to log the full message and just debug log something like "Skipping version.props as it is not XML"

viceice commented 1 year ago

confimed. there is no bug: https://github.com/renovatebot/renovate/blob/06f23a47b8965d18c09c56b3e0edb56695318f5e/lib/modules/manager/nuget/extract.ts#L123-L132

it's only a debug message. so removing bug label