Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat(maven): Use release post-fetch processing #31261

Merged
merged 43 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
5ce274d
feat(datasource): Post-fetch interceptors for candidate release items
zharinov Sep 5, 2024
c1ada9c
Fix lint
zharinov Sep 5, 2024
0b72ad6
Merge branch 'main' into feat/datasource-release-interception
zharinov Sep 6, 2024
8196c2c
feat(maven): Use release post-fetch processing
zharinov Sep 6, 2024
8e142a2
Move helper and types to datasource
zharinov Sep 6, 2024
770b4cb
Fix test
zharinov Sep 6, 2024
80350ce
Fix eslint
zharinov Sep 6, 2024
55100db
Merge branch 'main' into feat/datasource-release-interception
zharinov Sep 6, 2024
d406760
Move helper and types to datasource
zharinov Sep 6, 2024
a1705cd
Fix test
zharinov Sep 6, 2024
3b411ad
Fix eslint
zharinov Sep 6, 2024
7a26f7c
Fixes
zharinov Sep 6, 2024
718f187
Fix s3 tests
zharinov Sep 7, 2024
132987b
Fix renaming
zharinov Sep 7, 2024
a4686d8
Remove `currentValue` from config
zharinov Sep 7, 2024
daf40aa
Merge branch 'feat/datasource-release-interception' into feat/maven-r…
zharinov Sep 7, 2024
ed97ee5
Fix
zharinov Sep 7, 2024
e467afb
Fix sbt test
zharinov Sep 7, 2024
45925fb
Fixes
zharinov Sep 8, 2024
8384f67
fix
zharinov Sep 8, 2024
0492089
Fixes
zharinov Sep 8, 2024
07f04b5
fix
zharinov Sep 8, 2024
057932c
Fix prettier
zharinov Sep 8, 2024
4e6a03f
Fix test
zharinov Sep 8, 2024
9f728eb
Add tests for S3
zharinov Sep 8, 2024
0d2bbe0
fix
zharinov Sep 8, 2024
edf3ebb
Fix
zharinov Sep 8, 2024
1f504c6
Fix
zharinov Sep 8, 2024
60397dd
Merge branch 'main' into feat/maven-release-post-fetch-check
zharinov Sep 8, 2024
be39f3d
Remove empty snapshot parameters
zharinov Sep 8, 2024
437ba3b
Add test
zharinov Sep 8, 2024
47637ae
Fix coverage
zharinov Sep 8, 2024
0c6b111
Fix
zharinov Sep 8, 2024
ea941ea
Add debug log
zharinov Sep 9, 2024
d4d8d8c
Merge branch 'feat/datasource-release-interception' into feat/maven-r…
zharinov Sep 9, 2024
35a41ae
Merge branch 'main' into feat/datasource-release-interception
zharinov Sep 9, 2024
f0f9fd7
Add comment
zharinov Sep 9, 2024
919fc7c
Merge branch 'feat/datasource-release-interception' into feat/maven-r…
zharinov Sep 9, 2024
27d1629
Merge branch 'main' into feat/maven-release-post-fetch-check
zharinov Sep 19, 2024
805dce2
Merge branch 'main' into feat/maven-release-post-fetch-check
rarkins Sep 25, 2024
545f0e3
Merge branch 'main' into feat/maven-release-post-fetch-check
zharinov Sep 25, 2024
6903b19
Merge branch 'main' into feat/maven-release-post-fetch-check
zharinov Sep 26, 2024
20c1f2c
Fix types
zharinov Sep 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions docs/usage/self-hosted-experimental.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ We will try to keep breakage to a minimum, but make no guarantees that an experi
If set, Renovate will export OpenTelemetry data to the supplied endpoint.
For more information see [the OpenTelemetry docs](opentelemetry.md).

## `RENOVATE_EXPERIMENTAL_NO_MAVEN_POM_CHECK`

If set to any value, Renovate will skip its default artifacts filter check in the Maven datasource.
Skipping the check will speed things up, but may result in versions being returned which don't properly exist on the server.

## `RENOVATE_PAGINATE_ALL`

If set to any value, Renovate will always paginate requests to GitHub fully, instead of stopping after 10 pages.
Expand Down
75 changes: 60 additions & 15 deletions lib/modules/datasource/clojure/__snapshots__/index.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,24 @@ exports[`modules/datasource/clojure/index falls back to next registry url 1`] =
"version": "0.0.1",
},
{
"releaseTimestamp": "2020-01-01T01:00:00.000Z",
rarkins marked this conversation as resolved.
Show resolved Hide resolved
"version": "1.0.0",
},
{
"releaseTimestamp": "2020-01-01T01:00:03.000Z",
"version": "1.0.1",
},
{
"version": "1.0.2",
},
{
"version": "1.0.3-SNAPSHOT",
},
{
"releaseTimestamp": "2020-01-01T02:00:00.000Z",
"version": "1.0.4-SNAPSHOT",
},
{
"version": "1.0.5-SNAPSHOT",
},
{
"version": "2.0.0",
},
],
Expand All @@ -34,15 +43,24 @@ exports[`modules/datasource/clojure/index ignores unsupported protocols 1`] = `
"version": "0.0.1",
},
{
"releaseTimestamp": "2020-01-01T01:00:00.000Z",
"version": "1.0.0",
},
{
"releaseTimestamp": "2020-01-01T01:00:03.000Z",
"version": "1.0.1",
},
{
"version": "1.0.2",
},
{
"version": "1.0.3-SNAPSHOT",
},
{
"releaseTimestamp": "2020-01-01T02:00:00.000Z",
"version": "1.0.4-SNAPSHOT",
},
{
"version": "1.0.5-SNAPSHOT",
},
{
"version": "2.0.0",
},
]
Expand All @@ -62,15 +80,24 @@ exports[`modules/datasource/clojure/index returns releases from custom repositor
"version": "0.0.1",
},
{
"releaseTimestamp": "2020-01-01T01:00:00.000Z",
"version": "1.0.0",
},
{
"releaseTimestamp": "2020-01-01T01:00:03.000Z",
"version": "1.0.1",
},
{
"version": "1.0.2",
},
{
"version": "1.0.3-SNAPSHOT",
},
{
"releaseTimestamp": "2020-01-01T02:00:00.000Z",
"version": "1.0.4-SNAPSHOT",
},
{
"version": "1.0.5-SNAPSHOT",
},
{
"version": "2.0.0",
},
],
Expand All @@ -90,15 +117,24 @@ exports[`modules/datasource/clojure/index skips registry with invalid XML 1`] =
"version": "0.0.1",
},
{
"releaseTimestamp": "2020-01-01T01:00:00.000Z",
"version": "1.0.0",
},
{
"releaseTimestamp": "2020-01-01T01:00:03.000Z",
"version": "1.0.1",
},
{
"version": "1.0.2",
},
{
"version": "1.0.3-SNAPSHOT",
},
{
"releaseTimestamp": "2020-01-01T02:00:00.000Z",
"version": "1.0.4-SNAPSHOT",
},
{
"version": "1.0.5-SNAPSHOT",
},
{
"version": "2.0.0",
},
],
Expand All @@ -118,15 +154,24 @@ exports[`modules/datasource/clojure/index skips registry with invalid metadata s
"version": "0.0.1",
},
{
"releaseTimestamp": "2020-01-01T01:00:00.000Z",
"version": "1.0.0",
},
{
"releaseTimestamp": "2020-01-01T01:00:03.000Z",
"version": "1.0.1",
},
{
"version": "1.0.2",
},
{
"version": "1.0.3-SNAPSHOT",
},
{
"releaseTimestamp": "2020-01-01T02:00:00.000Z",
"version": "1.0.4-SNAPSHOT",
},
{
"version": "1.0.5-SNAPSHOT",
},
{
"version": "2.0.0",
},
],
Expand Down
83 changes: 5 additions & 78 deletions lib/modules/datasource/clojure/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ const baseUrlCustom = 'https://custom.registry.renovatebot.com';

interface SnapshotOpts {
version: string;
jarStatus?: number;
meta?: string;
}

Expand All @@ -22,7 +21,6 @@ interface MockOpts {
meta?: string | null;
pom?: string | null;
latest?: string;
jars?: Record<string, number> | null;
snapshots?: SnapshotOpts[] | null;
}

Expand All @@ -31,6 +29,7 @@ function mockGenericPackage(opts: MockOpts = {}) {
dep = 'org.example:package',
base = baseUrl,
latest = '2.0.0',
snapshots,
} = opts;
const meta =
opts.meta === undefined
Expand All @@ -40,39 +39,6 @@ function mockGenericPackage(opts: MockOpts = {}) {
opts.pom === undefined
? Fixtures.get('pom.xml', upath.join('..', 'maven'))
: opts.pom;
const jars =
opts.jars === undefined
? {
'0.0.1': 200,
'1.0.0': 200,
'1.0.1': 404,
'1.0.2': 500,
'2.0.0': 200,
}
: opts.jars;
const snapshots =
opts.snapshots === undefined
? [
{
version: '1.0.3-SNAPSHOT',
meta: Fixtures.get(
'metadata-snapshot-version.xml',
upath.join('..', 'maven'),
),
jarStatus: 200,
},
{
version: '1.0.4-SNAPSHOT',
meta: Fixtures.get(
'metadata-snapshot-version-invalid.xml',
upath.join('..', 'maven'),
),
},
{
version: '1.0.5-SNAPSHOT',
},
]
: opts.snapshots;

const scope = httpMock.scope(base);

Expand All @@ -89,22 +55,6 @@ function mockGenericPackage(opts: MockOpts = {}) {
.reply(200, pom);
}

if (jars) {
Object.entries(jars).forEach(([version, status]) => {
const [major, minor, patch] = version
.split('.')
.map((x) => parseInt(x, 10))
.map((x) => (x < 10 ? `0${x}` : `${x}`));
const timestamp = `2020-01-01T${major}:${minor}:${patch}.000Z`;
const headers: httpMock.ReplyHeaders = version.startsWith('0.')
? {}
: { 'Last-Modified': timestamp };
scope
.head(`/${packagePath}/${version}/${artifact}-${version}.pom`)
.reply(status, '', headers);
});
}

if (snapshots) {
snapshots.forEach((snapshot) => {
if (snapshot.meta) {
Expand All @@ -116,31 +66,6 @@ function mockGenericPackage(opts: MockOpts = {}) {
.get(`/${packagePath}/${snapshot.version}/maven-metadata.xml`)
.reply(404, '');
}

if (snapshot.jarStatus) {
const [major, minor, patch] = snapshot.version
.replace('-SNAPSHOT', '')
.split('.')
.map((x) => parseInt(x, 10))
.map((x) => (x < 10 ? `0${x}` : `${x}`));
const timestamp = `2020-01-01T${major}:${minor}:${patch}.000Z`;
scope
.head(
`/${packagePath}/${
snapshot.version
}/${artifact}-${snapshot.version.replace(
'-SNAPSHOT',
'',
)}-20200101.${major}${minor}${patch}-${parseInt(patch, 10)}.pom`,
)
.reply(snapshot.jarStatus, '', { 'Last-Modified': timestamp });
} else {
scope
.head(
`/${packagePath}/${snapshot.version}/${artifact}-${snapshot.version}.pom`,
)
.reply(404, '');
}
});
}
}
Expand All @@ -163,7 +88,6 @@ describe('modules/datasource/clojure/index', () => {

afterEach(() => {
hostRules.clear();
delete process.env.RENOVATE_EXPERIMENTAL_NO_MAVEN_POM_CHECK;
});

it('returns releases from custom repository', async () => {
Expand All @@ -180,7 +104,6 @@ describe('modules/datasource/clojure/index', () => {
base: baseUrlCustom,
meta: Fixtures.get('metadata-extra.xml', upath.join('..', 'maven')),
latest: '3.0.0',
jars: { '3.0.0': 200 },
snapshots: [],
});

Expand All @@ -193,7 +116,11 @@ describe('modules/datasource/clojure/index', () => {
expect(releases).toMatchObject([
{ version: '0.0.1' },
{ version: '1.0.0' },
{ version: '1.0.1' },
{ version: '1.0.2' },
{ version: '1.0.3-SNAPSHOT' },
{ version: '1.0.4-SNAPSHOT' },
{ version: '1.0.5-SNAPSHOT' },
{ version: '2.0.0' },
{ version: '3.0.0' },
]);
Expand Down
Loading