mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-12 06:56:24 +00:00
fix(datasource/docker): fix getDigest when lookupName different from packageName (#27665)
This commit is contained in:
parent
3bd92fa00c
commit
42081a3440
5 changed files with 28 additions and 1 deletions
|
@ -1457,6 +1457,7 @@ describe('modules/datasource/docker/index', () => {
|
||||||
packageName: '123456789.dkr.ecr.us-east-1.amazonaws.com/node',
|
packageName: '123456789.dkr.ecr.us-east-1.amazonaws.com/node',
|
||||||
}),
|
}),
|
||||||
).toEqual({
|
).toEqual({
|
||||||
|
lookupName: 'node',
|
||||||
registryUrl: 'https://123456789.dkr.ecr.us-east-1.amazonaws.com',
|
registryUrl: 'https://123456789.dkr.ecr.us-east-1.amazonaws.com',
|
||||||
releases: [],
|
releases: [],
|
||||||
});
|
});
|
||||||
|
@ -1509,6 +1510,7 @@ describe('modules/datasource/docker/index', () => {
|
||||||
packageName: 'public.ecr.aws/amazonlinux/amazonlinux',
|
packageName: 'public.ecr.aws/amazonlinux/amazonlinux',
|
||||||
}),
|
}),
|
||||||
).toEqual({
|
).toEqual({
|
||||||
|
lookupName: 'amazonlinux/amazonlinux',
|
||||||
registryUrl: 'https://public.ecr.aws',
|
registryUrl: 'https://public.ecr.aws',
|
||||||
releases: [],
|
releases: [],
|
||||||
});
|
});
|
||||||
|
@ -1567,6 +1569,7 @@ describe('modules/datasource/docker/index', () => {
|
||||||
packageName: 'ecr-proxy.company.com/node',
|
packageName: 'ecr-proxy.company.com/node',
|
||||||
}),
|
}),
|
||||||
).toEqual({
|
).toEqual({
|
||||||
|
lookupName: 'node',
|
||||||
registryUrl: 'https://ecr-proxy.company.com',
|
registryUrl: 'https://ecr-proxy.company.com',
|
||||||
releases: [],
|
releases: [],
|
||||||
sourceUrl: 'https://github.com/renovatebot/renovate',
|
sourceUrl: 'https://github.com/renovatebot/renovate',
|
||||||
|
@ -2026,6 +2029,7 @@ describe('modules/datasource/docker/index', () => {
|
||||||
packageName: 'registry.company.com/node',
|
packageName: 'registry.company.com/node',
|
||||||
});
|
});
|
||||||
expect(res).toEqual({
|
expect(res).toEqual({
|
||||||
|
lookupName: 'node',
|
||||||
registryUrl: 'https://registry.company.com',
|
registryUrl: 'https://registry.company.com',
|
||||||
releases: [
|
releases: [
|
||||||
{
|
{
|
||||||
|
@ -2081,6 +2085,7 @@ describe('modules/datasource/docker/index', () => {
|
||||||
packageName: 'registry.company.com/node',
|
packageName: 'registry.company.com/node',
|
||||||
});
|
});
|
||||||
expect(res).toEqual({
|
expect(res).toEqual({
|
||||||
|
lookupName: 'node',
|
||||||
registryUrl: 'https://registry.company.com',
|
registryUrl: 'https://registry.company.com',
|
||||||
releases: [
|
releases: [
|
||||||
{
|
{
|
||||||
|
@ -2144,6 +2149,7 @@ describe('modules/datasource/docker/index', () => {
|
||||||
packageName: 'registry.company.com/node',
|
packageName: 'registry.company.com/node',
|
||||||
});
|
});
|
||||||
expect(res).toEqual({
|
expect(res).toEqual({
|
||||||
|
lookupName: 'node',
|
||||||
registryUrl: 'https://registry.company.com',
|
registryUrl: 'https://registry.company.com',
|
||||||
releases: [],
|
releases: [],
|
||||||
sourceUrl: 'https://github.com/renovatebot/renovate',
|
sourceUrl: 'https://github.com/renovatebot/renovate',
|
||||||
|
@ -2171,6 +2177,7 @@ describe('modules/datasource/docker/index', () => {
|
||||||
packageName: 'registry.company.com/node',
|
packageName: 'registry.company.com/node',
|
||||||
});
|
});
|
||||||
expect(res).toEqual({
|
expect(res).toEqual({
|
||||||
|
lookupName: 'node',
|
||||||
registryUrl: 'https://registry.company.com',
|
registryUrl: 'https://registry.company.com',
|
||||||
releases: [],
|
releases: [],
|
||||||
});
|
});
|
||||||
|
@ -2195,6 +2202,7 @@ describe('modules/datasource/docker/index', () => {
|
||||||
packageName: 'registry.company.com/node',
|
packageName: 'registry.company.com/node',
|
||||||
});
|
});
|
||||||
expect(res).toEqual({
|
expect(res).toEqual({
|
||||||
|
lookupName: 'node',
|
||||||
registryUrl: 'https://registry.company.com',
|
registryUrl: 'https://registry.company.com',
|
||||||
releases: [],
|
releases: [],
|
||||||
});
|
});
|
||||||
|
@ -2216,6 +2224,7 @@ describe('modules/datasource/docker/index', () => {
|
||||||
packageName: 'registry.company.com/node',
|
packageName: 'registry.company.com/node',
|
||||||
});
|
});
|
||||||
expect(res).toEqual({
|
expect(res).toEqual({
|
||||||
|
lookupName: 'node',
|
||||||
registryUrl: 'https://registry.company.com',
|
registryUrl: 'https://registry.company.com',
|
||||||
releases: [],
|
releases: [],
|
||||||
});
|
});
|
||||||
|
@ -2266,6 +2275,7 @@ describe('modules/datasource/docker/index', () => {
|
||||||
packageName: 'registry.company.com/node',
|
packageName: 'registry.company.com/node',
|
||||||
});
|
});
|
||||||
expect(res).toEqual({
|
expect(res).toEqual({
|
||||||
|
lookupName: 'node',
|
||||||
registryUrl: 'https://registry.company.com',
|
registryUrl: 'https://registry.company.com',
|
||||||
releases: [
|
releases: [
|
||||||
{
|
{
|
||||||
|
@ -2320,6 +2330,7 @@ describe('modules/datasource/docker/index', () => {
|
||||||
packageName: 'registry.company.com/node',
|
packageName: 'registry.company.com/node',
|
||||||
});
|
});
|
||||||
expect(res).toEqual({
|
expect(res).toEqual({
|
||||||
|
lookupName: 'node',
|
||||||
registryUrl: 'https://registry.company.com',
|
registryUrl: 'https://registry.company.com',
|
||||||
releases: [
|
releases: [
|
||||||
{
|
{
|
||||||
|
@ -2350,6 +2361,7 @@ describe('modules/datasource/docker/index', () => {
|
||||||
packageName: 'registry.company.com/node',
|
packageName: 'registry.company.com/node',
|
||||||
});
|
});
|
||||||
expect(res).toEqual({
|
expect(res).toEqual({
|
||||||
|
lookupName: 'node',
|
||||||
registryUrl: 'https://registry.company.com',
|
registryUrl: 'https://registry.company.com',
|
||||||
releases: [],
|
releases: [],
|
||||||
});
|
});
|
||||||
|
@ -2404,6 +2416,7 @@ describe('modules/datasource/docker/index', () => {
|
||||||
packageName: 'registry.company.com/node',
|
packageName: 'registry.company.com/node',
|
||||||
});
|
});
|
||||||
expect(res).toEqual({
|
expect(res).toEqual({
|
||||||
|
lookupName: 'node',
|
||||||
registryUrl: 'https://registry.company.com',
|
registryUrl: 'https://registry.company.com',
|
||||||
releases: [],
|
releases: [],
|
||||||
});
|
});
|
||||||
|
@ -2463,6 +2476,7 @@ describe('modules/datasource/docker/index', () => {
|
||||||
packageName: 'ghcr.io/visualon/drone-git',
|
packageName: 'ghcr.io/visualon/drone-git',
|
||||||
});
|
});
|
||||||
expect(res).toEqual({
|
expect(res).toEqual({
|
||||||
|
lookupName: 'visualon/drone-git',
|
||||||
registryUrl: 'https://ghcr.io',
|
registryUrl: 'https://ghcr.io',
|
||||||
sourceUrl: 'https://github.com/visualon/drone-git',
|
sourceUrl: 'https://github.com/visualon/drone-git',
|
||||||
releases: [{ version: '1.0.0' }],
|
releases: [{ version: '1.0.0' }],
|
||||||
|
|
|
@ -1006,6 +1006,10 @@ export class DockerDatasource extends Datasource {
|
||||||
registryUrl: registryHost,
|
registryUrl: registryHost,
|
||||||
releases,
|
releases,
|
||||||
};
|
};
|
||||||
|
if (dockerRepository !== packageName) {
|
||||||
|
// This will be reused later if a getDigest() call is made
|
||||||
|
ret.lookupName = dockerRepository;
|
||||||
|
}
|
||||||
|
|
||||||
const tags = releases.map((release) => release.version);
|
const tags = releases.map((release) => release.version);
|
||||||
const latestTag = tags.includes('latest')
|
const latestTag = tags.includes('latest')
|
||||||
|
|
|
@ -83,6 +83,7 @@ export interface ReleaseResult {
|
||||||
registryUrl?: string;
|
registryUrl?: string;
|
||||||
replacementName?: string;
|
replacementName?: string;
|
||||||
replacementVersion?: string;
|
replacementVersion?: string;
|
||||||
|
lookupName?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type RegistryStrategy = 'first' | 'hunt' | 'merge';
|
export type RegistryStrategy = 'first' | 'hunt' | 'merge';
|
||||||
|
|
|
@ -4,6 +4,7 @@ import type { ValidationMessage } from '../../../../config/types';
|
||||||
import { CONFIG_VALIDATION } from '../../../../constants/error-messages';
|
import { CONFIG_VALIDATION } from '../../../../constants/error-messages';
|
||||||
import { logger } from '../../../../logger';
|
import { logger } from '../../../../logger';
|
||||||
import {
|
import {
|
||||||
|
GetDigestInputConfig,
|
||||||
Release,
|
Release,
|
||||||
ReleaseResult,
|
ReleaseResult,
|
||||||
applyDatasourceFilters,
|
applyDatasourceFilters,
|
||||||
|
@ -157,6 +158,7 @@ export async function lookupUpdates(
|
||||||
'homepage',
|
'homepage',
|
||||||
'changelogUrl',
|
'changelogUrl',
|
||||||
'dependencyUrl',
|
'dependencyUrl',
|
||||||
|
'lookupName',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const latestVersion = dependency.tags?.latest;
|
const latestVersion = dependency.tags?.latest;
|
||||||
|
@ -496,10 +498,15 @@ export async function lookupUpdates(
|
||||||
// update digest for all
|
// update digest for all
|
||||||
for (const update of res.updates) {
|
for (const update of res.updates) {
|
||||||
if (config.pinDigests === true || config.currentDigest) {
|
if (config.pinDigests === true || config.currentDigest) {
|
||||||
|
const getDigestConfig: GetDigestInputConfig = {
|
||||||
|
...config,
|
||||||
|
packageName: res.lookupName ?? config.packageName,
|
||||||
|
};
|
||||||
// TODO #22198
|
// TODO #22198
|
||||||
update.newDigest ??=
|
update.newDigest ??=
|
||||||
dependency?.releases.find((r) => r.version === update.newValue)
|
dependency?.releases.find((r) => r.version === update.newValue)
|
||||||
?.newDigest ?? (await getDigest(config, update.newValue))!;
|
?.newDigest ??
|
||||||
|
(await getDigest(getDigestConfig, update.newValue))!;
|
||||||
|
|
||||||
// If the digest could not be determined, report this as otherwise the
|
// If the digest could not be determined, report this as otherwise the
|
||||||
// update will be omitted later on without notice.
|
// update will be omitted later on without notice.
|
||||||
|
|
|
@ -59,6 +59,7 @@ export interface UpdateResult {
|
||||||
sourceUrl?: string | null;
|
sourceUrl?: string | null;
|
||||||
currentVersion?: string;
|
currentVersion?: string;
|
||||||
isSingleVersion?: boolean;
|
isSingleVersion?: boolean;
|
||||||
|
lookupName?: string;
|
||||||
skipReason?: SkipReason;
|
skipReason?: SkipReason;
|
||||||
registryUrl?: string;
|
registryUrl?: string;
|
||||||
fixedVersion?: string;
|
fixedVersion?: string;
|
||||||
|
|
Loading…
Reference in a new issue