mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-13 15:36:25 +00:00
fix(datasource): rename adoptium-java
to java-version
(#20245)
This commit is contained in:
parent
e0a74ebd15
commit
09402a32e6
20 changed files with 55 additions and 32 deletions
|
@ -1,7 +1,18 @@
|
||||||
import { DatasourceMigration } from './datasource-migration';
|
import { DatasourceMigration } from './datasource-migration';
|
||||||
|
|
||||||
describe('config/migrations/custom/datasource-migration', () => {
|
describe('config/migrations/custom/datasource-migration', () => {
|
||||||
it('should migrate properly', () => {
|
it('should migrate adoptium-java', () => {
|
||||||
|
expect(DatasourceMigration).toMigrate(
|
||||||
|
{
|
||||||
|
datasource: 'adoptium-java',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
datasource: 'java-version',
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should migrate donet', () => {
|
||||||
expect(DatasourceMigration).toMigrate(
|
expect(DatasourceMigration).toMigrate(
|
||||||
{
|
{
|
||||||
datasource: 'dotnet',
|
datasource: 'dotnet',
|
||||||
|
|
|
@ -6,7 +6,15 @@ export class DatasourceMigration extends AbstractMigration {
|
||||||
|
|
||||||
override run(value: unknown): void {
|
override run(value: unknown): void {
|
||||||
if (is.string(value)) {
|
if (is.string(value)) {
|
||||||
const newValue = value === 'dotnet' ? 'dotnet-version' : value;
|
let newValue = value;
|
||||||
|
switch (newValue) {
|
||||||
|
case 'adoptium-java':
|
||||||
|
newValue = 'java-version';
|
||||||
|
break;
|
||||||
|
case 'dotnet':
|
||||||
|
newValue = 'dotnet-version';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
this.rewrite(newValue);
|
this.rewrite(newValue);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,10 +4,10 @@ describe('config/migrations/custom/match-datasources-migration', () => {
|
||||||
it('should migrate properly', () => {
|
it('should migrate properly', () => {
|
||||||
expect(MatchDatasourcesMigration).toMigrate(
|
expect(MatchDatasourcesMigration).toMigrate(
|
||||||
{
|
{
|
||||||
matchDatasources: ['dotnet'],
|
matchDatasources: ['adoptium-java', 'dotnet', 'npm'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
matchDatasources: ['dotnet-version'],
|
matchDatasources: ['java-version', 'dotnet-version', 'npm'],
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -6,11 +6,16 @@ export class MatchDatasourcesMigration extends AbstractMigration {
|
||||||
|
|
||||||
override run(value: unknown): void {
|
override run(value: unknown): void {
|
||||||
if (Array.isArray(value)) {
|
if (Array.isArray(value)) {
|
||||||
const newValue = value
|
const newValue = value.filter(is.nonEmptyString).map((datasource) => {
|
||||||
.filter(is.nonEmptyString)
|
switch (datasource) {
|
||||||
.map((datasource) =>
|
case 'adoptium-java':
|
||||||
datasource === 'dotnet' ? 'dotnet-version' : datasource
|
return 'java-version';
|
||||||
);
|
case 'dotnet':
|
||||||
|
return 'dotnet-version';
|
||||||
|
default:
|
||||||
|
return datasource;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
this.rewrite(newValue);
|
this.rewrite(newValue);
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,6 +73,7 @@ export class MigrationsService {
|
||||||
]);
|
]);
|
||||||
|
|
||||||
static readonly renamedProperties: ReadonlyMap<string, string> = new Map([
|
static readonly renamedProperties: ReadonlyMap<string, string> = new Map([
|
||||||
|
['adoptium-java', 'java-version'],
|
||||||
['endpoints', 'hostRules'],
|
['endpoints', 'hostRules'],
|
||||||
['excludedPackageNames', 'excludePackageNames'],
|
['excludedPackageNames', 'excludePackageNames'],
|
||||||
['exposeEnv', 'exposeAllEnv'],
|
['exposeEnv', 'exposeAllEnv'],
|
||||||
|
|
|
@ -82,7 +82,7 @@ export const presets: Record<string, Preset> = {
|
||||||
allowedVersions: '/^(?:8|11|17)(?:\\.|-|$)/',
|
allowedVersions: '/^(?:8|11|17)(?:\\.|-|$)/',
|
||||||
description:
|
description:
|
||||||
'Limit Java runtime versions to LTS releases. To receive all major releases add `workarounds:javaLTSVersions` to the `ignorePresets` array.',
|
'Limit Java runtime versions to LTS releases. To receive all major releases add `workarounds:javaLTSVersions` to the `ignorePresets` array.',
|
||||||
matchDatasources: ['docker', 'adoptium-java'],
|
matchDatasources: ['docker', 'java-version'],
|
||||||
matchPackageNames: [
|
matchPackageNames: [
|
||||||
'eclipse-temurin',
|
'eclipse-temurin',
|
||||||
'amazoncorretto',
|
'amazoncorretto',
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import { AdoptiumJavaDatasource } from './adoptium-java';
|
|
||||||
import { ArtifactoryDatasource } from './artifactory';
|
import { ArtifactoryDatasource } from './artifactory';
|
||||||
import { AwsMachineImageDataSource } from './aws-machine-image';
|
import { AwsMachineImageDataSource } from './aws-machine-image';
|
||||||
import { AwsRdsDataSource } from './aws-rds';
|
import { AwsRdsDataSource } from './aws-rds';
|
||||||
|
@ -32,6 +31,7 @@ import { HelmDatasource } from './helm';
|
||||||
import { HermitDatasource } from './hermit';
|
import { HermitDatasource } from './hermit';
|
||||||
import { HexDatasource } from './hex';
|
import { HexDatasource } from './hex';
|
||||||
import { HexpmBobDatasource } from './hexpm-bob';
|
import { HexpmBobDatasource } from './hexpm-bob';
|
||||||
|
import { JavaVersionDatasource } from './java-version';
|
||||||
import { JenkinsPluginsDatasource } from './jenkins-plugins';
|
import { JenkinsPluginsDatasource } from './jenkins-plugins';
|
||||||
import { KubernetesApiDatasource } from './kubernetes-api';
|
import { KubernetesApiDatasource } from './kubernetes-api';
|
||||||
import { MavenDatasource } from './maven';
|
import { MavenDatasource } from './maven';
|
||||||
|
@ -55,7 +55,6 @@ import type { DatasourceApi } from './types';
|
||||||
const api = new Map<string, DatasourceApi>();
|
const api = new Map<string, DatasourceApi>();
|
||||||
export default api;
|
export default api;
|
||||||
|
|
||||||
api.set(AdoptiumJavaDatasource.id, new AdoptiumJavaDatasource());
|
|
||||||
api.set(ArtifactoryDatasource.id, new ArtifactoryDatasource());
|
api.set(ArtifactoryDatasource.id, new ArtifactoryDatasource());
|
||||||
api.set(AwsMachineImageDataSource.id, new AwsMachineImageDataSource());
|
api.set(AwsMachineImageDataSource.id, new AwsMachineImageDataSource());
|
||||||
api.set(AwsRdsDataSource.id, new AwsRdsDataSource());
|
api.set(AwsRdsDataSource.id, new AwsRdsDataSource());
|
||||||
|
@ -89,6 +88,7 @@ api.set(HelmDatasource.id, new HelmDatasource());
|
||||||
api.set(HermitDatasource.id, new HermitDatasource());
|
api.set(HermitDatasource.id, new HermitDatasource());
|
||||||
api.set(HexDatasource.id, new HexDatasource());
|
api.set(HexDatasource.id, new HexDatasource());
|
||||||
api.set(HexpmBobDatasource.id, new HexpmBobDatasource());
|
api.set(HexpmBobDatasource.id, new HexpmBobDatasource());
|
||||||
|
api.set(JavaVersionDatasource.id, new JavaVersionDatasource());
|
||||||
api.set(JenkinsPluginsDatasource.id, new JenkinsPluginsDatasource());
|
api.set(JenkinsPluginsDatasource.id, new JenkinsPluginsDatasource());
|
||||||
api.set(KubernetesApiDatasource.id, new KubernetesApiDatasource());
|
api.set(KubernetesApiDatasource.id, new KubernetesApiDatasource());
|
||||||
api.set(MavenDatasource.id, new MavenDatasource());
|
api.set(MavenDatasource.id, new MavenDatasource());
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`modules/datasource/adoptium-java/index getReleases pages 1`] = `
|
exports[`modules/datasource/java-version/index getReleases pages 1`] = `
|
||||||
{
|
{
|
||||||
"homepage": "https://adoptium.net",
|
"homepage": "https://adoptium.net",
|
||||||
"registryUrl": "https://api.adoptium.net/",
|
"registryUrl": "https://api.adoptium.net/",
|
||||||
|
@ -159,7 +159,7 @@ exports[`modules/datasource/adoptium-java/index getReleases pages 1`] = `
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`modules/datasource/adoptium-java/index getReleases processes real data (jre) 1`] = `
|
exports[`modules/datasource/java-version/index getReleases processes real data (jre) 1`] = `
|
||||||
{
|
{
|
||||||
"homepage": "https://adoptium.net",
|
"homepage": "https://adoptium.net",
|
||||||
"registryUrl": "https://api.adoptium.net/",
|
"registryUrl": "https://api.adoptium.net/",
|
||||||
|
@ -174,7 +174,7 @@ exports[`modules/datasource/adoptium-java/index getReleases processes real data
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`modules/datasource/adoptium-java/index getReleases processes real data 1`] = `
|
exports[`modules/datasource/java-version/index getReleases processes real data 1`] = `
|
||||||
{
|
{
|
||||||
"homepage": "https://adoptium.net",
|
"homepage": "https://adoptium.net",
|
||||||
"registryUrl": "https://api.adoptium.net/",
|
"registryUrl": "https://api.adoptium.net/",
|
|
@ -3,7 +3,7 @@ export const pageSize = 50;
|
||||||
|
|
||||||
export const defaultRegistryUrl = 'https://api.adoptium.net/';
|
export const defaultRegistryUrl = 'https://api.adoptium.net/';
|
||||||
|
|
||||||
export const datasource = 'adoptium-java';
|
export const datasource = 'java-version';
|
||||||
|
|
||||||
export function getImageType(packageName: string): string {
|
export function getImageType(packageName: string): string {
|
||||||
switch (packageName) {
|
switch (packageName) {
|
|
@ -11,7 +11,7 @@ function getPath(page: number, imageType = 'jdk'): string {
|
||||||
|
|
||||||
const depName = 'java';
|
const depName = 'java';
|
||||||
|
|
||||||
describe('modules/datasource/adoptium-java/index', () => {
|
describe('modules/datasource/java-version/index', () => {
|
||||||
describe('getReleases', () => {
|
describe('getReleases', () => {
|
||||||
it('throws for error', async () => {
|
it('throws for error', async () => {
|
||||||
httpMock
|
httpMock
|
|
@ -12,7 +12,7 @@ import {
|
||||||
} from './common';
|
} from './common';
|
||||||
import type { AdoptiumJavaResponse } from './types';
|
import type { AdoptiumJavaResponse } from './types';
|
||||||
|
|
||||||
export class AdoptiumJavaDatasource extends Datasource {
|
export class JavaVersionDatasource extends Datasource {
|
||||||
static readonly id = datasource;
|
static readonly id = datasource;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@ -55,8 +55,7 @@ export class AdoptiumJavaDatasource extends Datasource {
|
||||||
namespace: `datasource-${datasource}`,
|
namespace: `datasource-${datasource}`,
|
||||||
key: ({ registryUrl, packageName }: GetReleasesConfig) =>
|
key: ({ registryUrl, packageName }: GetReleasesConfig) =>
|
||||||
// TODO: types (#7154)
|
// TODO: types (#7154)
|
||||||
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
`${registryUrl!}:${getImageType(packageName)}`,
|
||||||
`${registryUrl}:${getImageType(packageName)}`,
|
|
||||||
})
|
})
|
||||||
async getReleases({
|
async getReleases({
|
||||||
registryUrl,
|
registryUrl,
|
||||||
|
@ -68,8 +67,7 @@ export class AdoptiumJavaDatasource extends Datasource {
|
||||||
'fetching java release'
|
'fetching java release'
|
||||||
);
|
);
|
||||||
// TODO: types (#7154)
|
// TODO: types (#7154)
|
||||||
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
const url = `${registryUrl!}v3/info/release_versions?page_size=${pageSize}&image_type=${imageType}&project=jdk&release_type=ga&sort_method=DATE&sort_order=DESC`;
|
||||||
const url = `${registryUrl}v3/info/release_versions?page_size=${pageSize}&image_type=${imageType}&project=jdk&release_type=ga&sort_method=DATE&sort_order=DESC`;
|
|
||||||
|
|
||||||
const result: ReleaseResult = {
|
const result: ReleaseResult = {
|
||||||
homepage: 'https://adoptium.net',
|
homepage: 'https://adoptium.net',
|
|
@ -5,7 +5,7 @@ Datasources are used in Renovate primarily to fetch released versions of package
|
||||||
## Follow the class-based programming style
|
## Follow the class-based programming style
|
||||||
|
|
||||||
New datasources _must_ follow the class-based programming style.
|
New datasources _must_ follow the class-based programming style.
|
||||||
Use the `adoptium-java` datasource as a reference.
|
Use the `java-version` datasource as a reference.
|
||||||
|
|
||||||
Add the datasource to the API in [`api.ts`](api.ts) so that the new datasource is usable. If you find `Pending mocks!` errors in the Jest tests and your mocked URLs are correct, ensure the datasource is correctly registered.
|
Add the datasource to the API in [`api.ts`](api.ts) so that the new datasource is usable. If you find `Pending mocks!` errors in the Jest tests and your mocked URLs are correct, ensure the datasource is correctly registered.
|
||||||
|
|
||||||
|
|
|
@ -225,7 +225,7 @@ dummy 1.2.3
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
currentValue: '16.0.0+36',
|
currentValue: '16.0.0+36',
|
||||||
datasource: 'adoptium-java',
|
datasource: 'java-version',
|
||||||
packageName: 'java-jdk',
|
packageName: 'java-jdk',
|
||||||
depName: 'java',
|
depName: 'java',
|
||||||
},
|
},
|
||||||
|
@ -369,7 +369,7 @@ dummy 1.2.3
|
||||||
deps: [
|
deps: [
|
||||||
{
|
{
|
||||||
currentValue: '16.0.0+36',
|
currentValue: '16.0.0+36',
|
||||||
datasource: 'adoptium-java',
|
datasource: 'java-version',
|
||||||
depName: 'java',
|
depName: 'java',
|
||||||
packageName: 'java-jdk',
|
packageName: 'java-jdk',
|
||||||
},
|
},
|
||||||
|
@ -380,7 +380,7 @@ dummy 1.2.3
|
||||||
deps: [
|
deps: [
|
||||||
{
|
{
|
||||||
currentValue: '16.0.0+36',
|
currentValue: '16.0.0+36',
|
||||||
datasource: 'adoptium-java',
|
datasource: 'java-version',
|
||||||
depName: 'java',
|
depName: 'java',
|
||||||
packageName: 'java-jre',
|
packageName: 'java-jre',
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { AdoptiumJavaDatasource } from '../../datasource/adoptium-java';
|
|
||||||
import { DockerDatasource } from '../../datasource/docker';
|
import { DockerDatasource } from '../../datasource/docker';
|
||||||
import { GithubReleasesDatasource } from '../../datasource/github-releases';
|
import { GithubReleasesDatasource } from '../../datasource/github-releases';
|
||||||
import { GithubTagsDatasource } from '../../datasource/github-tags';
|
import { GithubTagsDatasource } from '../../datasource/github-tags';
|
||||||
import { HexpmBobDatasource } from '../../datasource/hexpm-bob';
|
import { HexpmBobDatasource } from '../../datasource/hexpm-bob';
|
||||||
|
import { JavaVersionDatasource } from '../../datasource/java-version';
|
||||||
import { NodeDatasource } from '../../datasource/node';
|
import { NodeDatasource } from '../../datasource/node';
|
||||||
import { RubyVersionDatasource } from '../../datasource/ruby-version';
|
import { RubyVersionDatasource } from '../../datasource/ruby-version';
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ export const defaultConfig = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const supportedDatasources = [
|
export const supportedDatasources = [
|
||||||
AdoptiumJavaDatasource.id,
|
JavaVersionDatasource.id,
|
||||||
DockerDatasource.id,
|
DockerDatasource.id,
|
||||||
GithubReleasesDatasource.id,
|
GithubReleasesDatasource.id,
|
||||||
GithubTagsDatasource.id,
|
GithubTagsDatasource.id,
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { AdoptiumJavaDatasource } from '../../datasource/adoptium-java';
|
|
||||||
import { DockerDatasource } from '../../datasource/docker';
|
import { DockerDatasource } from '../../datasource/docker';
|
||||||
import { GithubReleasesDatasource } from '../../datasource/github-releases';
|
import { GithubReleasesDatasource } from '../../datasource/github-releases';
|
||||||
import { GithubTagsDatasource } from '../../datasource/github-tags';
|
import { GithubTagsDatasource } from '../../datasource/github-tags';
|
||||||
import { HexpmBobDatasource } from '../../datasource/hexpm-bob';
|
import { HexpmBobDatasource } from '../../datasource/hexpm-bob';
|
||||||
|
import { JavaVersionDatasource } from '../../datasource/java-version';
|
||||||
import { NodeDatasource } from '../../datasource/node';
|
import { NodeDatasource } from '../../datasource/node';
|
||||||
import { RubyVersionDatasource } from '../../datasource/ruby-version';
|
import { RubyVersionDatasource } from '../../datasource/ruby-version';
|
||||||
import * as regexVersioning from '../../versioning/regex';
|
import * as regexVersioning from '../../versioning/regex';
|
||||||
|
@ -181,7 +181,7 @@ export const upgradeableTooling: Record<string, ToolingDefinition> = {
|
||||||
);
|
);
|
||||||
if (adoptOpenJdkMatches) {
|
if (adoptOpenJdkMatches) {
|
||||||
return {
|
return {
|
||||||
datasource: AdoptiumJavaDatasource.id,
|
datasource: JavaVersionDatasource.id,
|
||||||
packageName: 'java-jdk',
|
packageName: 'java-jdk',
|
||||||
currentValue: adoptOpenJdkMatches.groups!.version,
|
currentValue: adoptOpenJdkMatches.groups!.version,
|
||||||
};
|
};
|
||||||
|
@ -191,7 +191,7 @@ export const upgradeableTooling: Record<string, ToolingDefinition> = {
|
||||||
);
|
);
|
||||||
if (adoptOpenJreMatches) {
|
if (adoptOpenJreMatches) {
|
||||||
return {
|
return {
|
||||||
datasource: AdoptiumJavaDatasource.id,
|
datasource: JavaVersionDatasource.id,
|
||||||
packageName: 'java-jre',
|
packageName: 'java-jre',
|
||||||
currentValue: adoptOpenJreMatches.groups!.version,
|
currentValue: adoptOpenJreMatches.groups!.version,
|
||||||
};
|
};
|
||||||
|
|
|
@ -71,7 +71,7 @@ const allToolConfig: Record<string, ToolConfig> = {
|
||||||
versioning: semverVersioningId,
|
versioning: semverVersioningId,
|
||||||
},
|
},
|
||||||
java: {
|
java: {
|
||||||
datasource: 'adoptium-java',
|
datasource: 'java-version',
|
||||||
depName: 'java',
|
depName: 'java',
|
||||||
versioning: npmVersioningId,
|
versioning: npmVersioningId,
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue