fix(nuget): fall back to nupkg metadata on nuspec 404#44388
fix(nuget): fall back to nupkg metadata on nuspec 404#44388eugene-harold-krabs wants to merge 3 commits into
Conversation
|
@viceice Sorry the pull came in so quick without validation from my end.... It auto assinged it to you. @eugene-harold-krabs is my codex. I havn`t validated it yet. From my review though it looks it will solve my problem I have with gitlab. https://gitlab.com/xrow-public/ci-tools/-/work_items/105 What do you think? |
6a438cb to
80d07fb
Compare
|
@viceice Do you need to approve to run the other pending checks? I am not that familiar with github. Please let me know what to do next. |
| dep.sourceUrl = massageUrl(sourceUrl); | ||
| } | ||
| } catch (err) { | ||
| // istanbul ignore if: not easy testable with nock |
| if (err instanceof ExternalHostError) { | ||
| throw err; | ||
| } | ||
| if (err instanceof HttpError && err.response?.statusCode === 404) { | ||
| shouldTryNupkg = true; | ||
| logger.debug( | ||
| { registryUrl, pkgName, pkgVersion: latestStable }, | ||
| `package manifest (.nuspec) not found`, | ||
| ); | ||
| } else { | ||
| throw err; | ||
| } |
There was a problem hiding this comment.
this can be one if on err instanceof HttpError && err.response?.statusCode === 404 and else.
instea dof two if's and else
80d07fb to
a57b87c
Compare
|
Addressed the review feedback in a57b87c: replaced the added Istanbul ignore marker with a V8 ignore marker and collapsed the nested error checks into a single |
| }); | ||
|
|
||
| it('can determine source URL from nupkg when nuspec endpoint returns 404', async () => { | ||
| const nugetIndex = ` |
There was a problem hiding this comment.
wrap in codeBlock
| ] | ||
| } | ||
| `; | ||
| const nlogRegistration = ` |
| expect(logger.logger.debug).toHaveBeenCalledWith( | ||
| { | ||
| registryUrl: 'https://some-registry/v3/index.json', | ||
| pkgName: 'NLog', | ||
| pkgVersion: '4.7.3', | ||
| }, | ||
| 'package manifest (.nuspec) not found', | ||
| ); | ||
| expect(logger.logger.debug).toHaveBeenCalledWith( |
There was a problem hiding this comment.
merge into one, i think it's possible using array
a57b87c to
f0565dd
Compare
|
Addressed the latest review feedback in f0565dd: wrapped the new JSON fixture strings with Local checks run:
|
|
@RahulGautamSingh Did a review. I think your requests are fullfilled. |
Changes
.nupkgwhen a v3 feed advertisesPackageBaseAddressbut the direct.nuspecendpoint returns 404..nuspecpath for feeds such as nuget.org, including release notes extraction.packageContent, the flat-container.nuspecURL is missing, and the.nupkgcontains repository metadata.Context
Please select one of the following:
AI assistance disclosure
Did you use AI tools to create any part of this pull request?
Please select one option and, if yes, briefly describe how AI was used (e.g., code, tests, docs) and which tool(s) you used.
Documentation (please check one with an [x])
How I've tested my work (please select one)
I have verified these changes via:
Additional local checks:
pnpm exec vitest run --coverage=false lib/modules/datasource/nuget/index.spec.ts -t "can determine source URL from nupkg when nuspec endpoint returns 404"pnpm exec vitest run --coverage=false lib/modules/datasource/nuget/index.spec.ts -t "feed is a nuget.org"pnpm exec prettier --check lib/modules/datasource/nuget/v3.ts lib/modules/datasource/nuget/index.spec.tsgit diff --checkThe public repository: https://github.com/eugene-harold-krabs/renovate/tree/fix/105-nuget-nupkg-fallback