mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-11 22:46:27 +00:00
fix: fetch changelog from self-hosted gitlab independent from url (#8336)
This commit is contained in:
parent
52c70f0b2b
commit
91d30caed7
3 changed files with 65 additions and 1 deletions
|
@ -190,6 +190,49 @@ Object {
|
|||
}
|
||||
`;
|
||||
|
||||
exports[`workers/pr/changelog/gitlab getChangeLogJSON supports self-hosted gitlab changelog 1`] = `
|
||||
Object {
|
||||
"hasReleaseNotes": false,
|
||||
"project": Object {
|
||||
"apiBaseUrl": "https://git.test.com/api/v4/",
|
||||
"baseUrl": "https://git.test.com/",
|
||||
"depName": "renovate",
|
||||
"gitlab": "meno/dropzone",
|
||||
"repository": "https://git.test.com/meno/dropzone/",
|
||||
},
|
||||
"versions": Array [
|
||||
Object {
|
||||
"changes": Array [],
|
||||
"compare": Object {},
|
||||
"date": undefined,
|
||||
"releaseNotes": null,
|
||||
"version": "5.6.1",
|
||||
},
|
||||
Object {
|
||||
"changes": Array [],
|
||||
"compare": Object {},
|
||||
"date": "2020-02-13T15:37:00.000Z",
|
||||
"releaseNotes": null,
|
||||
"version": "5.6.0",
|
||||
},
|
||||
Object {
|
||||
"changes": Array [],
|
||||
"compare": Object {},
|
||||
"date": undefined,
|
||||
"releaseNotes": null,
|
||||
"version": "5.5.0",
|
||||
},
|
||||
Object {
|
||||
"changes": Array [],
|
||||
"compare": Object {},
|
||||
"date": "2018-08-24T14:23:00.000Z",
|
||||
"releaseNotes": null,
|
||||
"version": "5.4.0",
|
||||
},
|
||||
],
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`workers/pr/changelog/gitlab getChangeLogJSON uses GitLab tags 1`] = `
|
||||
Object {
|
||||
"hasReleaseNotes": true,
|
||||
|
|
|
@ -189,5 +189,22 @@ describe(getName(__filename), () => {
|
|||
})
|
||||
).toMatchSnapshot();
|
||||
});
|
||||
it('supports self-hosted gitlab changelog', async () => {
|
||||
httpMock.scope('https://git.test.com').persist().get(/.*/).reply(200, []);
|
||||
hostRules.add({
|
||||
hostType: PLATFORM_TYPE_GITLAB,
|
||||
baseUrl: 'https://git.test.com/',
|
||||
token: 'abc',
|
||||
});
|
||||
process.env.GITHUB_ENDPOINT = '';
|
||||
expect(
|
||||
await getChangeLogJSON({
|
||||
...upgrade,
|
||||
platform: PLATFORM_TYPE_GITLAB,
|
||||
sourceUrl: 'https://git.test.com/meno/dropzone/',
|
||||
endpoint: 'https://git.test.com/api/v4/',
|
||||
})
|
||||
).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -27,7 +27,11 @@ export async function getChangeLogJSON(
|
|||
|
||||
let res: ChangeLogResult | null = null;
|
||||
|
||||
if (args.sourceUrl?.includes('gitlab')) {
|
||||
if (
|
||||
args.sourceUrl?.includes('gitlab') ||
|
||||
(args.platform === 'gitlab' &&
|
||||
new URL(args.sourceUrl).hostname === new URL(args.endpoint).hostname)
|
||||
) {
|
||||
res = await sourceGitlab.getChangeLogJSON({ ...args, releases });
|
||||
} else {
|
||||
res = await sourceGithub.getChangeLogJSON({ ...args, releases });
|
||||
|
|
Loading…
Reference in a new issue