From a42fe41197a5eec89e7e55ad56bd7e8db2123fcc Mon Sep 17 00:00:00 2001 From: RahulGautamSingh Date: Sat, 28 Jan 2023 11:49:08 +0530 Subject: [PATCH 01/16] feat(config)!: add new option `constraintsFiltering` (#19992) --- docs/usage/configuration-options.md | 13 ++++ lib/config/options/index.ts | 8 ++ lib/config/types.ts | 3 + lib/modules/datasource/index.spec.ts | 91 +++++++++++++++++++++++ lib/modules/datasource/index.ts | 42 ++++++----- lib/modules/datasource/pypi/index.spec.ts | 2 + lib/modules/datasource/types.ts | 2 + 7 files changed, 141 insertions(+), 20 deletions(-) diff --git a/docs/usage/configuration-options.md b/docs/usage/configuration-options.md index ba378faa185545..1e86f6a1062a08 100644 --- a/docs/usage/configuration-options.md +++ b/docs/usage/configuration-options.md @@ -544,6 +544,19 @@ If you need to _override_ constraints that Renovate detects from the repository, !!! note Make sure not to mix this up with the term `compatibility`, which Renovate uses in the context of version releases, e.g. if a Docker image is `node:12.16.0-alpine` then the `-alpine` suffix represents `compatibility`. +## constraintsFiltering + +This option controls whether Renovate filters new releases based on configured or detected `constraints`. +Renovate supports two options: + +- `none`: No release filtering (all releases allowed) +- `strict`: If the release's constraints match the package file constraints, then it's included + +We are working on adding more advanced filtering options. + +Note: There must be a `constraints` object in your Renovate config for this to work. +This feature is limited to `pypi` datasource only. + ## defaultRegistryUrls Override a datasource's default registries with this config option. diff --git a/lib/config/options/index.ts b/lib/config/options/index.ts index a401297e2dafee..740f117a0bc154 100644 --- a/lib/config/options/index.ts +++ b/lib/config/options/index.ts @@ -217,6 +217,14 @@ const options: RenovateOptions[] = [ cli: false, env: false, }, + { + name: 'constraintsFiltering', + description: 'Perform release filtering based on language constraints.', + type: 'string', + allowedValues: ['none', 'strict'], + cli: false, + default: 'none', + }, { name: 'repositoryCache', description: diff --git a/lib/config/types.ts b/lib/config/types.ts index d4572fafb49e74..465797f6cee3fb 100644 --- a/lib/config/types.ts +++ b/lib/config/types.ts @@ -188,6 +188,7 @@ export interface RegExManager extends RegexManagerTemplates { } export type UseBaseBranchConfigType = 'merge' | 'none'; +export type ConstraintsFilter = 'strict' | 'none'; // TODO: Proper typings export interface RenovateConfig @@ -252,6 +253,8 @@ export interface RenovateConfig constraints?: Record; skipInstalls?: boolean; + + constraintsFiltering?: ConstraintsFilter; } export interface AllConfig diff --git a/lib/modules/datasource/index.spec.ts b/lib/modules/datasource/index.spec.ts index 3202864da0a583..06fb982bada3ad 100644 --- a/lib/modules/datasource/index.spec.ts +++ b/lib/modules/datasource/index.spec.ts @@ -628,6 +628,97 @@ describe('modules/datasource/index', () => { expect(res).toBeNull(); }); }); + + describe('relaseConstraintFiltering', () => { + it('keeps all releases by default', async () => { + const registries = { + 'https://foo.bar': { + releases: [ + { + version: '0.0.1', + constraints: { + python: ['2.7'], + }, + }, + { + version: '0.0.2', + }, + ], + }, + } satisfies RegistriesMock; + datasources.set(datasource, new DummyDatasource(registries)); + const res = await getPkgReleases({ + datasource, + depName, + defaultRegistryUrls: ['https://foo.bar'], + }); + expect(res).toMatchObject({ + releases: [{ version: '0.0.1' }, { version: '0.0.2' }], + }); + }); + + it('keeps all releases if constraints is set but no value defined for constraintsFiltering', async () => { + const registries = { + 'https://foo.bar': { + releases: [ + { + version: '0.0.1', + constraints: { + python: ['2.7'], + }, + }, + { + version: '0.0.2', + }, + ], + }, + } satisfies RegistriesMock; + datasources.set(datasource, new DummyDatasource(registries)); + const res = await getPkgReleases({ + datasource, + depName, + defaultRegistryUrls: ['https://foo.bar'], + constraints: { + python: '2.7.0', + }, + }); + expect(res).toMatchObject({ + releases: [{ version: '0.0.1' }, { version: '0.0.2' }], + }); + }); + + it('filters releases if value is strict', async () => { + const registries = { + 'https://foo.bar': { + releases: [ + { + version: '0.0.1', + constraints: { + python: ['2.7'], + }, + }, + { + version: '0.0.2', + constraints: { + python: ['1.0'], + }, + }, + ], + }, + } satisfies RegistriesMock; + datasources.set(datasource, new DummyDatasource(registries)); + const res = await getPkgReleases({ + datasource, + depName, + defaultRegistryUrls: ['https://foo.bar'], + constraints: { python: '2.7.0' }, + constraintsFiltering: 'strict', + }); + expect(res).toMatchObject({ + releases: [{ version: '0.0.1' }], + }); + }); + }); }); }); }); diff --git a/lib/modules/datasource/index.ts b/lib/modules/datasource/index.ts index dd0d5f198228cc..21caf1a79444c6 100644 --- a/lib/modules/datasource/index.ts +++ b/lib/modules/datasource/index.ts @@ -395,26 +395,28 @@ export async function getPkgReleases( (findRelease) => findRelease.version === filterRelease.version ) === filterIndex ); - // Filter releases for compatibility - for (const [constraintName, constraintValue] of Object.entries( - config.constraints ?? {} - )) { - // Currently we only support if the constraint is a plain version - // TODO: Support range/range compatibility filtering #8476 - if (version.isVersion(constraintValue)) { - res.releases = res.releases.filter((release) => { - const constraint = release.constraints?.[constraintName]; - if (!is.nonEmptyArray(constraint)) { - // A release with no constraints is OK - return true; - } - return constraint.some( - // If any of the release's constraints match, then it's OK - (releaseConstraint) => - !releaseConstraint || - version.matches(constraintValue, releaseConstraint) - ); - }); + if (config?.constraintsFiltering === 'strict') { + // Filter releases for compatibility + for (const [constraintName, constraintValue] of Object.entries( + config.constraints ?? {} + )) { + // Currently we only support if the constraint is a plain version + // TODO: Support range/range compatibility filtering #8476 + if (version.isVersion(constraintValue)) { + res.releases = res.releases.filter((release) => { + const constraint = release.constraints?.[constraintName]; + if (!is.nonEmptyArray(constraint)) { + // A release with no constraints is OK + return true; + } + return constraint.some( + // If any of the release's constraints match, then it's OK + (releaseConstraint) => + !releaseConstraint || + version.matches(constraintValue, releaseConstraint) + ); + }); + } } } // Strip constraints from releases result diff --git a/lib/modules/datasource/pypi/index.spec.ts b/lib/modules/datasource/pypi/index.spec.ts index 90a1a252ef7358..6f7123a3d53d74 100644 --- a/lib/modules/datasource/pypi/index.spec.ts +++ b/lib/modules/datasource/pypi/index.spec.ts @@ -271,6 +271,7 @@ describe('modules/datasource/pypi/index', () => { datasource, constraints: { python: '2.7' }, depName: 'doit', + constraintsFiltering: 'strict', }) ).toMatchSnapshot(); }); @@ -518,6 +519,7 @@ describe('modules/datasource/pypi/index', () => { constraints: { python: '2.7' }, ...config, depName: 'dj-database-url', + constraintsFiltering: 'strict', }) ).toMatchSnapshot(); }); diff --git a/lib/modules/datasource/types.ts b/lib/modules/datasource/types.ts index c9a9677b064bf0..b95f1395529026 100644 --- a/lib/modules/datasource/types.ts +++ b/lib/modules/datasource/types.ts @@ -1,3 +1,4 @@ +import type { ConstraintsFilter } from '../../config/types'; import type { ModuleApi } from '../../types'; export interface GetDigestInputConfig { @@ -37,6 +38,7 @@ export interface GetPkgReleasesConfig { constraints?: Record; replacementName?: string; replacementVersion?: string; + constraintsFiltering?: ConstraintsFilter; } export interface Release { From ffbf27904eeef562ecbf41bfd0be49f1e2c3d3a7 Mon Sep 17 00:00:00 2001 From: Rhys Arkins Date: Sat, 28 Jan 2023 08:11:10 +0100 Subject: [PATCH 02/16] feat!: default to rangeStrategy=auto, prefer update-lockfile (#19942) Changes `rangeStrategy` default value from `'replace'` to `'auto'`. Changes `auto` behavior so that `update-lockfile` is preferred if the manager supports the `updateLockedDependency()` function. Closes #19800 BREAKING CHANGE: Renovate will now default to updating locked dependency versions. To revert to previous behavior, configure rangeStrategy=replace. --- lib/config/options/index.ts | 2 +- lib/config/presets/common.ts | 3 ++- lib/config/presets/index.spec.ts | 1 - lib/config/presets/internal/config.ts | 1 - lib/config/presets/internal/default.ts | 4 ---- lib/modules/manager/cargo/index.ts | 2 +- lib/modules/manager/cargo/range.spec.ts | 14 +++++++++++++ lib/modules/manager/cargo/range.ts | 8 ++++++++ lib/modules/manager/circleci/extract.ts | 1 - lib/modules/manager/circleci/index.ts | 1 + lib/modules/manager/circleci/range.spec.ts | 14 +++++++++++++ lib/modules/manager/circleci/range.ts | 8 ++++++++ lib/modules/manager/composer/range.spec.ts | 8 ++++---- lib/modules/manager/composer/range.ts | 2 +- lib/modules/manager/conan/index.ts | 2 +- lib/modules/manager/conan/range.spec.ts | 14 +++++++++++++ lib/modules/manager/conan/range.ts | 8 ++++++++ lib/modules/manager/gomod/extract.spec.ts | 1 - lib/modules/manager/gomod/extract.ts | 1 - lib/modules/manager/index.ts | 3 +++ lib/modules/manager/npm/range.spec.ts | 20 ++----------------- lib/modules/manager/npm/range.ts | 2 +- lib/modules/manager/range.spec.ts | 12 +++++++++-- lib/modules/manager/swift/index.ts | 2 +- lib/modules/manager/swift/range.spec.ts | 16 +++++++++++++++ lib/modules/manager/swift/range.ts | 8 ++++++++ .../__fixtures__/migrated-data-formatted.json | 2 +- .../branch/__fixtures__/migrated-data.json | 2 +- .../branch/__fixtures__/migrated-data.json5 | 2 +- .../branch/__fixtures__/migrated.json | 1 - .../branch/__fixtures__/renovate.json | 1 - .../branch/__fixtures__/renovate.json5 | 1 - .../pr/__fixtures__/migrated-data.json | 2 +- 33 files changed, 122 insertions(+), 47 deletions(-) create mode 100644 lib/modules/manager/cargo/range.spec.ts create mode 100644 lib/modules/manager/cargo/range.ts create mode 100644 lib/modules/manager/circleci/range.spec.ts create mode 100644 lib/modules/manager/circleci/range.ts create mode 100644 lib/modules/manager/conan/range.spec.ts create mode 100644 lib/modules/manager/conan/range.ts create mode 100644 lib/modules/manager/swift/range.spec.ts create mode 100644 lib/modules/manager/swift/range.ts diff --git a/lib/config/options/index.ts b/lib/config/options/index.ts index 740f117a0bc154..77ed4a80add333 100644 --- a/lib/config/options/index.ts +++ b/lib/config/options/index.ts @@ -1343,7 +1343,7 @@ const options: RenovateOptions[] = [ name: 'rangeStrategy', description: 'Determines how to modify or update existing ranges.', type: 'string', - default: 'replace', + default: 'auto', allowedValues: [ 'auto', 'pin', diff --git a/lib/config/presets/common.ts b/lib/config/presets/common.ts index 2f72e59cbc2726..b2ff01c1a9dc82 100644 --- a/lib/config/presets/common.ts +++ b/lib/config/presets/common.ts @@ -1,5 +1,6 @@ export const removedPresets: Record = { - ':autodetectPinVersions': ':autodetectRangeStrategy', + ':autodetectPinVersions': null, + ':autodetectRangeStrategy': null, ':automergeBranchMergeCommit': ':automergeBranch', ':automergeBranchPush': ':automergeBranch', ':base': 'config:base', diff --git a/lib/config/presets/index.spec.ts b/lib/config/presets/index.spec.ts index c7b432a0e52211..3bf5d5fffb5c49 100644 --- a/lib/config/presets/index.spec.ts +++ b/lib/config/presets/index.spec.ts @@ -839,7 +839,6 @@ describe('config/presets/index', () => { ':dependencyDashboard', ':semanticPrefixFixDepsChoreOthers', ':ignoreModulesAndTests', - ':autodetectRangeStrategy', ':prHourlyLimit2', ':prConcurrentLimit10', 'group:monorepos', diff --git a/lib/config/presets/internal/config.ts b/lib/config/presets/internal/config.ts index 044b55753753a4..355135deaa0727 100644 --- a/lib/config/presets/internal/config.ts +++ b/lib/config/presets/internal/config.ts @@ -9,7 +9,6 @@ export const presets: Record = { ':dependencyDashboard', ':semanticPrefixFixDepsChoreOthers', ':ignoreModulesAndTests', - ':autodetectRangeStrategy', ':prHourlyLimit2', ':prConcurrentLimit10', 'group:monorepos', diff --git a/lib/config/presets/internal/default.ts b/lib/config/presets/internal/default.ts index 0d1daebcef4033..8cef075470f4a3 100644 --- a/lib/config/presets/internal/default.ts +++ b/lib/config/presets/internal/default.ts @@ -10,10 +10,6 @@ export const presets: Record = { assignees: ['{{arg0}}'], description: 'Assign PRs to `{{arg0}}`.', }, - autodetectRangeStrategy: { - description: 'Automatically detect the best rangeStrategy to use.', - rangeStrategy: 'auto', - }, automergeAll: { automerge: true, description: diff --git a/lib/modules/manager/cargo/index.ts b/lib/modules/manager/cargo/index.ts index c7768858e33808..45ee9c4fada786 100644 --- a/lib/modules/manager/cargo/index.ts +++ b/lib/modules/manager/cargo/index.ts @@ -3,6 +3,7 @@ import { CrateDatasource } from '../../datasource/crate'; import * as cargoVersioning from '../../versioning/cargo'; import { updateArtifacts } from './artifacts'; import { extractPackageFile } from './extract'; +export { getRangeStrategy } from './range'; export const language: ProgrammingLanguage = 'rust'; export const supportsLockFileMaintenance = true; @@ -13,7 +14,6 @@ export const defaultConfig = { commitMessageTopic: 'Rust crate {{depName}}', fileMatch: ['(^|/)Cargo\\.toml$'], versioning: cargoVersioning.id, - rangeStrategy: 'bump', }; export const supportedDatasources = [CrateDatasource.id]; diff --git a/lib/modules/manager/cargo/range.spec.ts b/lib/modules/manager/cargo/range.spec.ts new file mode 100644 index 00000000000000..0356aac6a8cd22 --- /dev/null +++ b/lib/modules/manager/cargo/range.spec.ts @@ -0,0 +1,14 @@ +import type { RangeConfig } from '../types'; +import { getRangeStrategy } from '.'; + +describe('modules/manager/cargo/range', () => { + it('returns same if not auto', () => { + const config: RangeConfig = { rangeStrategy: 'widen' }; + expect(getRangeStrategy(config)).toBe('widen'); + }); + + it('defaults to bump', () => { + const config: RangeConfig = { rangeStrategy: 'auto' }; + expect(getRangeStrategy(config)).toBe('bump'); + }); +}); diff --git a/lib/modules/manager/cargo/range.ts b/lib/modules/manager/cargo/range.ts new file mode 100644 index 00000000000000..8f3d6e7eb54595 --- /dev/null +++ b/lib/modules/manager/cargo/range.ts @@ -0,0 +1,8 @@ +import type { RangeStrategy } from '../../../types'; +import type { RangeConfig } from '../types'; + +export function getRangeStrategy({ + rangeStrategy, +}: RangeConfig): RangeStrategy { + return rangeStrategy === 'auto' ? 'bump' : rangeStrategy; +} diff --git a/lib/modules/manager/circleci/extract.ts b/lib/modules/manager/circleci/extract.ts index 4f3bc24ab9c4ae..3557cb7a2f6a2b 100644 --- a/lib/modules/manager/circleci/extract.ts +++ b/lib/modules/manager/circleci/extract.ts @@ -41,7 +41,6 @@ export function extractPackageFile(content: string): PackageFileContent | null { packageName: orbName, commitMessageTopic: '{{{depName}}} orb', versioning: npmVersioning.id, - rangeStrategy: 'pin', }; deps.push(dep); } diff --git a/lib/modules/manager/circleci/index.ts b/lib/modules/manager/circleci/index.ts index 8505e9d39ce635..183098e281c8b8 100644 --- a/lib/modules/manager/circleci/index.ts +++ b/lib/modules/manager/circleci/index.ts @@ -1,6 +1,7 @@ import { DockerDatasource } from '../../datasource/docker'; import { OrbDatasource } from '../../datasource/orb'; import { extractPackageFile } from './extract'; +export { getRangeStrategy } from './range'; export { extractPackageFile }; diff --git a/lib/modules/manager/circleci/range.spec.ts b/lib/modules/manager/circleci/range.spec.ts new file mode 100644 index 00000000000000..40fb6c583d8d5e --- /dev/null +++ b/lib/modules/manager/circleci/range.spec.ts @@ -0,0 +1,14 @@ +import type { RangeConfig } from '../types'; +import { getRangeStrategy } from '.'; + +describe('modules/manager/circleci/range', () => { + it('returns same if not auto', () => { + const config: RangeConfig = { rangeStrategy: 'widen' }; + expect(getRangeStrategy(config)).toBe('widen'); + }); + + it('defaults to bump', () => { + const config: RangeConfig = { rangeStrategy: 'auto', depType: 'require' }; + expect(getRangeStrategy(config)).toBe('pin'); + }); +}); diff --git a/lib/modules/manager/circleci/range.ts b/lib/modules/manager/circleci/range.ts new file mode 100644 index 00000000000000..2c3311a8ca0c2a --- /dev/null +++ b/lib/modules/manager/circleci/range.ts @@ -0,0 +1,8 @@ +import type { RangeStrategy } from '../../../types'; +import type { RangeConfig } from '../types'; + +export function getRangeStrategy({ + rangeStrategy, +}: RangeConfig): RangeStrategy { + return rangeStrategy === 'auto' ? 'pin' : rangeStrategy; +} diff --git a/lib/modules/manager/composer/range.spec.ts b/lib/modules/manager/composer/range.spec.ts index 87f65b9c67c98a..944797d5c8b556 100644 --- a/lib/modules/manager/composer/range.spec.ts +++ b/lib/modules/manager/composer/range.spec.ts @@ -12,7 +12,7 @@ describe('modules/manager/composer/range', () => { rangeStrategy: 'auto', depType: 'require-dev', }; - expect(getRangeStrategy(config)).toBe('replace'); + expect(getRangeStrategy(config)).toBe('update-lockfile'); }); it('replaces project require', () => { @@ -21,7 +21,7 @@ describe('modules/manager/composer/range', () => { managerData: { composerJsonType: 'project' }, depType: 'require', }; - expect(getRangeStrategy(config)).toBe('replace'); + expect(getRangeStrategy(config)).toBe('update-lockfile'); }); it('widens complex ranges', () => { @@ -42,9 +42,9 @@ describe('modules/manager/composer/range', () => { expect(getRangeStrategy(config)).toBe('widen'); }); - it('defaults to replace', () => { + it('defaults to update-lockfile', () => { const config: RangeConfig = { rangeStrategy: 'auto', depType: 'require' }; - expect(getRangeStrategy(config)).toBe('replace'); + expect(getRangeStrategy(config)).toBe('update-lockfile'); }); it('defaults to widen for TYPO3 extensions', () => { diff --git a/lib/modules/manager/composer/range.ts b/lib/modules/manager/composer/range.ts index dd70eb54f92c38..a1faa3f6f1b8d4 100644 --- a/lib/modules/manager/composer/range.ts +++ b/lib/modules/manager/composer/range.ts @@ -23,5 +23,5 @@ export function getRangeStrategy(config: RangeConfig): RangeStrategy { ) { return 'widen'; } - return 'replace'; + return 'update-lockfile'; } diff --git a/lib/modules/manager/conan/index.ts b/lib/modules/manager/conan/index.ts index 2ac518f4609b76..3dc5571dedc4c7 100644 --- a/lib/modules/manager/conan/index.ts +++ b/lib/modules/manager/conan/index.ts @@ -1,4 +1,5 @@ export { extractPackageFile } from './extract'; +export { getRangeStrategy } from './range'; import { ConanDatasource } from '../../datasource/conan'; import * as conan from '../../versioning/conan'; @@ -6,7 +7,6 @@ export const defaultConfig = { fileMatch: ['(^|/)conanfile\\.(txt|py)$'], datasource: ConanDatasource.id, versioning: conan.id, - rangeStrategy: 'bump', enabled: false, // See https://github.com/renovatebot/renovate/issues/14170 }; diff --git a/lib/modules/manager/conan/range.spec.ts b/lib/modules/manager/conan/range.spec.ts new file mode 100644 index 00000000000000..7dcee82fb9712b --- /dev/null +++ b/lib/modules/manager/conan/range.spec.ts @@ -0,0 +1,14 @@ +import type { RangeConfig } from '../types'; +import { getRangeStrategy } from '.'; + +describe('modules/manager/conan/range', () => { + it('returns same if not auto', () => { + const config: RangeConfig = { rangeStrategy: 'widen' }; + expect(getRangeStrategy(config)).toBe('widen'); + }); + + it('defaults to bump', () => { + const config: RangeConfig = { rangeStrategy: 'auto', depType: 'require' }; + expect(getRangeStrategy(config)).toBe('bump'); + }); +}); diff --git a/lib/modules/manager/conan/range.ts b/lib/modules/manager/conan/range.ts new file mode 100644 index 00000000000000..8f3d6e7eb54595 --- /dev/null +++ b/lib/modules/manager/conan/range.ts @@ -0,0 +1,8 @@ +import type { RangeStrategy } from '../../../types'; +import type { RangeConfig } from '../types'; + +export function getRangeStrategy({ + rangeStrategy, +}: RangeConfig): RangeStrategy { + return rangeStrategy === 'auto' ? 'bump' : rangeStrategy; +} diff --git a/lib/modules/manager/gomod/extract.spec.ts b/lib/modules/manager/gomod/extract.spec.ts index 4d9b35b36ff95f..c1503da32c2656 100644 --- a/lib/modules/manager/gomod/extract.spec.ts +++ b/lib/modules/manager/gomod/extract.spec.ts @@ -67,7 +67,6 @@ replace ( currentValue: '1.18', datasource: 'golang-version', versioning: 'go-mod-directive', - rangeStrategy: 'replace', }, { managerData: { diff --git a/lib/modules/manager/gomod/extract.ts b/lib/modules/manager/gomod/extract.ts index 2d99d83f48ab5a..5f6352d2a35197 100644 --- a/lib/modules/manager/gomod/extract.ts +++ b/lib/modules/manager/gomod/extract.ts @@ -46,7 +46,6 @@ function getGoDep(lineNumber: number, goVer: string): PackageDependency { currentValue: goVer, datasource: GolangVersionDatasource.id, versioning: 'go-mod-directive', - rangeStrategy: 'replace', }; } diff --git a/lib/modules/manager/index.ts b/lib/modules/manager/index.ts index 4d7500b8836129..26befb170ef57b 100644 --- a/lib/modules/manager/index.ts +++ b/lib/modules/manager/index.ts @@ -87,6 +87,9 @@ export function getRangeStrategy(config: RangeConfig): RangeStrategy | null { return managerRangeStrategy; } if (rangeStrategy === 'auto') { + if (m.updateLockedDependency) { + return 'update-lockfile'; + } // default to 'replace' for auto return 'replace'; } diff --git a/lib/modules/manager/npm/range.spec.ts b/lib/modules/manager/npm/range.spec.ts index 997567a68da128..4898d3f18c5197 100644 --- a/lib/modules/manager/npm/range.spec.ts +++ b/lib/modules/manager/npm/range.spec.ts @@ -7,22 +7,6 @@ describe('modules/manager/npm/range', () => { expect(getRangeStrategy(config)).toBe('widen'); }); - it('replaces devDependencies', () => { - const config: RangeConfig = { - rangeStrategy: 'auto', - depType: 'devDependencies', - }; - expect(getRangeStrategy(config)).toBe('replace'); - }); - - it('replaces app dependencies', () => { - const config: RangeConfig = { - rangeStrategy: 'auto', - depType: 'dependencies', - }; - expect(getRangeStrategy(config)).toBe('replace'); - }); - it('widens peerDependencies', () => { const config: RangeConfig = { rangeStrategy: 'auto', @@ -49,11 +33,11 @@ describe('modules/manager/npm/range', () => { expect(getRangeStrategy(config)).toBe('widen'); }); - it('defaults to replace', () => { + it('defaults to update-lockfile', () => { const config: RangeConfig = { rangeStrategy: 'auto', depType: 'dependencies', }; - expect(getRangeStrategy(config)).toBe('replace'); + expect(getRangeStrategy(config)).toBe('update-lockfile'); }); }); diff --git a/lib/modules/manager/npm/range.ts b/lib/modules/manager/npm/range.ts index ed56cb10705d7a..91d8ceca3be5ac 100644 --- a/lib/modules/manager/npm/range.ts +++ b/lib/modules/manager/npm/range.ts @@ -25,5 +25,5 @@ export function getRangeStrategy(config: RangeConfig): RangeStrategy { if (isComplexRange) { return 'widen'; } - return 'replace'; + return 'update-lockfile'; } diff --git a/lib/modules/manager/range.spec.ts b/lib/modules/manager/range.spec.ts index 0cfbbe5a5176c7..7f1c3b2b58079e 100644 --- a/lib/modules/manager/range.spec.ts +++ b/lib/modules/manager/range.spec.ts @@ -16,12 +16,20 @@ describe('modules/manager/range', () => { rangeStrategy: 'auto', depType: 'dependencies', }; - expect(getRangeStrategy(config)).toBe('replace'); + expect(getRangeStrategy(config)).toBe('update-lockfile'); + }); + + it('defaults to update-lockfile if updateLockedDependency() is supported', () => { + const config: RangeConfig = { + manager: 'bundler', + rangeStrategy: 'auto', + }; + expect(getRangeStrategy(config)).toBe('update-lockfile'); }); it('defaults to replace', () => { const config: RangeConfig = { - manager: 'circleci', + manager: 'sbt', rangeStrategy: 'auto', }; expect(getRangeStrategy(config)).toBe('replace'); diff --git a/lib/modules/manager/swift/index.ts b/lib/modules/manager/swift/index.ts index c41cdba0bf620a..bbb83400ecc243 100644 --- a/lib/modules/manager/swift/index.ts +++ b/lib/modules/manager/swift/index.ts @@ -2,6 +2,7 @@ import { GitTagsDatasource } from '../../datasource/git-tags'; import * as swiftVersioning from '../../versioning/swift'; export { extractPackageFile } from './extract'; +export { getRangeStrategy } from './range'; export const displayName = 'Swift Package Manager'; export const url = 'https://www.swift.org/package-manager/'; @@ -11,6 +12,5 @@ export const supportedDatasources = [GitTagsDatasource.id]; export const defaultConfig = { fileMatch: ['(^|/)Package\\.swift'], versioning: swiftVersioning.id, - rangeStrategy: 'bump', pinDigests: false, }; diff --git a/lib/modules/manager/swift/range.spec.ts b/lib/modules/manager/swift/range.spec.ts new file mode 100644 index 00000000000000..4f20913fca3bc5 --- /dev/null +++ b/lib/modules/manager/swift/range.spec.ts @@ -0,0 +1,16 @@ +import type { RangeConfig } from '../types'; +import { getRangeStrategy } from '.'; + +describe('modules/manager/swift/range', () => { + describe('getRangeStrategy()', () => { + it('returns same if not auto', () => { + const config: RangeConfig = { rangeStrategy: 'widen' }; + expect(getRangeStrategy(config)).toBe('widen'); + }); + + it('defaults to update-lockfile', () => { + const config: RangeConfig = { rangeStrategy: 'auto' }; + expect(getRangeStrategy(config)).toBe('bump'); + }); + }); +}); diff --git a/lib/modules/manager/swift/range.ts b/lib/modules/manager/swift/range.ts new file mode 100644 index 00000000000000..8f3d6e7eb54595 --- /dev/null +++ b/lib/modules/manager/swift/range.ts @@ -0,0 +1,8 @@ +import type { RangeStrategy } from '../../../types'; +import type { RangeConfig } from '../types'; + +export function getRangeStrategy({ + rangeStrategy, +}: RangeConfig): RangeStrategy { + return rangeStrategy === 'auto' ? 'bump' : rangeStrategy; +} diff --git a/lib/workers/repository/config-migration/branch/__fixtures__/migrated-data-formatted.json b/lib/workers/repository/config-migration/branch/__fixtures__/migrated-data-formatted.json index 1891c1584d8928..4b038d5bb25af1 100644 --- a/lib/workers/repository/config-migration/branch/__fixtures__/migrated-data-formatted.json +++ b/lib/workers/repository/config-migration/branch/__fixtures__/migrated-data-formatted.json @@ -1,4 +1,4 @@ { "filename": "renovate.json", - "content": "{\n \"extends\": [\n \":separateMajorReleases\",\n \":prImmediately\",\n \":renovatePrefix\",\n \":semanticPrefixFixDepsChoreOthers\",\n \":updateNotScheduled\",\n \":automergeDisabled\",\n \":maintainLockFilesDisabled\",\n \":autodetectRangeStrategy\",\n \"group:monorepos\"\n ],\n \"onboarding\": false,\n \"rangeStrategy\": \"replace\",\n \"semanticCommits\": \"enabled\",\n \"timezone\": \"US/Central\",\n \"baseBranches\": [\"main\"]\n}\n" + "content": "{\n \"extends\": [\n \":separateMajorReleases\",\n \":prImmediately\",\n \":renovatePrefix\",\n \":semanticPrefixFixDepsChoreOthers\",\n \":updateNotScheduled\",\n \":automergeDisabled\",\n \":maintainLockFilesDisabled\",\n \"group:monorepos\"\n ],\n \"onboarding\": false,\n \"rangeStrategy\": \"replace\",\n \"semanticCommits\": \"enabled\",\n \"timezone\": \"US/Central\",\n \"baseBranches\": [\"main\"]\n}\n" } diff --git a/lib/workers/repository/config-migration/branch/__fixtures__/migrated-data.json b/lib/workers/repository/config-migration/branch/__fixtures__/migrated-data.json index 1266070dddb070..1e9f8833a3cd35 100644 --- a/lib/workers/repository/config-migration/branch/__fixtures__/migrated-data.json +++ b/lib/workers/repository/config-migration/branch/__fixtures__/migrated-data.json @@ -1,5 +1,5 @@ { - "content": "{\n \"extends\": [\n \":separateMajorReleases\",\n \":prImmediately\",\n \":renovatePrefix\",\n \":semanticPrefixFixDepsChoreOthers\",\n \":updateNotScheduled\",\n \":automergeDisabled\",\n \":maintainLockFilesDisabled\",\n \":autodetectRangeStrategy\",\n \"group:monorepos\"\n ],\n \"onboarding\": false,\n \"rangeStrategy\": \"replace\",\n \"semanticCommits\": \"enabled\",\n \"timezone\": \"US/Central\",\n \"baseBranches\": [\n \"main\"\n ]\n}\n", + "content": "{\n \"extends\": [\n \":separateMajorReleases\",\n \":prImmediately\",\n \":renovatePrefix\",\n \":semanticPrefixFixDepsChoreOthers\",\n \":updateNotScheduled\",\n \":automergeDisabled\",\n \":maintainLockFilesDisabled\",\n \"group:monorepos\"\n ],\n \"onboarding\": false,\n \"rangeStrategy\": \"replace\",\n \"semanticCommits\": \"enabled\",\n \"timezone\": \"US/Central\",\n \"baseBranches\": [\n \"main\"\n ]\n}\n", "filename": "renovate.json", "indent": { "amount": 2, diff --git a/lib/workers/repository/config-migration/branch/__fixtures__/migrated-data.json5 b/lib/workers/repository/config-migration/branch/__fixtures__/migrated-data.json5 index c80dcb42b6fc18..22888d346d99ef 100644 --- a/lib/workers/repository/config-migration/branch/__fixtures__/migrated-data.json5 +++ b/lib/workers/repository/config-migration/branch/__fixtures__/migrated-data.json5 @@ -1,5 +1,5 @@ { - "content": "{\n extends: [\n ':separateMajorReleases',\n ':prImmediately',\n ':renovatePrefix',\n ':semanticPrefixFixDepsChoreOthers',\n ':updateNotScheduled',\n ':automergeDisabled',\n ':maintainLockFilesDisabled',\n ':autodetectRangeStrategy',\n 'group:monorepos',\n ],\n onboarding: false,\n rangeStrategy: 'replace',\n semanticCommits: 'enabled',\n timezone: 'US/Central',\n baseBranches: [\n 'main',\n ],\n}\n", + "content": "{\n extends: [\n ':separateMajorReleases',\n ':prImmediately',\n ':renovatePrefix',\n ':semanticPrefixFixDepsChoreOthers',\n ':updateNotScheduled',\n ':automergeDisabled',\n ':maintainLockFilesDisabled',\n 'group:monorepos',\n ],\n onboarding: false,\n rangeStrategy: 'replace',\n semanticCommits: 'enabled',\n timezone: 'US/Central',\n baseBranches: [\n 'main',\n ],\n}\n", "filename": "renovate.json5", "indent": { "amount": 2, diff --git a/lib/workers/repository/config-migration/branch/__fixtures__/migrated.json b/lib/workers/repository/config-migration/branch/__fixtures__/migrated.json index 549d809c236d17..66b64ae3c892ba 100644 --- a/lib/workers/repository/config-migration/branch/__fixtures__/migrated.json +++ b/lib/workers/repository/config-migration/branch/__fixtures__/migrated.json @@ -7,7 +7,6 @@ ":updateNotScheduled", ":automergeDisabled", ":maintainLockFilesDisabled", - ":autodetectRangeStrategy", "group:monorepos" ], "onboarding": false, diff --git a/lib/workers/repository/config-migration/branch/__fixtures__/renovate.json b/lib/workers/repository/config-migration/branch/__fixtures__/renovate.json index 6ea0880bb10555..1a0a9efc29e9bc 100644 --- a/lib/workers/repository/config-migration/branch/__fixtures__/renovate.json +++ b/lib/workers/repository/config-migration/branch/__fixtures__/renovate.json @@ -8,7 +8,6 @@ ":updateNotScheduled", ":automergeDisabled", ":maintainLockFilesDisabled", - ":autodetectRangeStrategy", "group:monorepos", "helpers:oddIsUnstablePackages" ], diff --git a/lib/workers/repository/config-migration/branch/__fixtures__/renovate.json5 b/lib/workers/repository/config-migration/branch/__fixtures__/renovate.json5 index 2d13ebc63f59bc..559b6b98790621 100644 --- a/lib/workers/repository/config-migration/branch/__fixtures__/renovate.json5 +++ b/lib/workers/repository/config-migration/branch/__fixtures__/renovate.json5 @@ -7,7 +7,6 @@ ':updateNotScheduled', ':automergeDisabled', ':maintainLockFilesDisabled', - ':autodetectRangeStrategy', 'group:monorepos', 'helpers:oddIsUnstablePackages' ], diff --git a/lib/workers/repository/config-migration/pr/__fixtures__/migrated-data.json b/lib/workers/repository/config-migration/pr/__fixtures__/migrated-data.json index 0dce506326bb55..3375b555e6f10c 100644 --- a/lib/workers/repository/config-migration/pr/__fixtures__/migrated-data.json +++ b/lib/workers/repository/config-migration/pr/__fixtures__/migrated-data.json @@ -1,4 +1,4 @@ { "configFileName": "renovate.json", - "migratedContent": "{\n \"extends\": [\n \":separateMajorReleases\",\n \":prImmediately\",\n \":renovatePrefix\",\n \":semanticPrefixFixDepsChoreOthers\",\n \":updateNotScheduled\",\n \":automergeDisabled\",\n \":maintainLockFilesDisabled\",\n \":autodetectRangeStrategy\",\n \"group:monorepos\"\n ],\n \"onboarding\": false,\n \"rangeStrategy\": \"replace\",\n \"semanticCommits\": \"enabled\",\n \"timezone\": \"US/Central\",\n \"baseBranches\": [\n \"main\"\n ]\n}\n" + "migratedContent": "{\n \"extends\": [\n \":separateMajorReleases\",\n \":prImmediately\",\n \":renovatePrefix\",\n \":semanticPrefixFixDepsChoreOthers\",\n \":updateNotScheduled\",\n \":automergeDisabled\",\n \":maintainLockFilesDisabled\",\n \"group:monorepos\"\n ],\n \"onboarding\": false,\n \"rangeStrategy\": \"replace\",\n \"semanticCommits\": \"enabled\",\n \"timezone\": \"US/Central\",\n \"baseBranches\": [\n \"main\"\n ]\n}\n" } From b784f61c90465f1ad6b1a8427d4b95b4a5e05c27 Mon Sep 17 00:00:00 2001 From: Rhys Arkins Date: Sat, 28 Jan 2023 08:52:05 +0100 Subject: [PATCH 03/16] feat(config)!: non-zero defaults for PR concurrent, hourly limits (#19958) Sets new defaults: - `prConcurrentLimit`: 10 (instead of 0) - `prHourlyLimit`: 2 (instead of 0) Closes #19800 BREAKING CHANGE: Renovate now defaults to applying hourly and concurrent PR limits. To revert to unlimited, configure them back to `0`. --- lib/config/options/index.ts | 8 ++++---- lib/config/presets/index.spec.ts | 2 -- lib/config/presets/internal/config.ts | 2 -- lib/modules/platform/codecommit/index.md | 1 - lib/workers/repository/process/limits.spec.ts | 18 ++++++++++-------- 5 files changed, 14 insertions(+), 17 deletions(-) diff --git a/lib/config/options/index.ts b/lib/config/options/index.ts index 77ed4a80add333..a4afb0ca8c3d9e 100644 --- a/lib/config/options/index.ts +++ b/lib/config/options/index.ts @@ -1580,16 +1580,16 @@ const options: RenovateOptions[] = [ { name: 'prHourlyLimit', description: - 'Rate limit PRs to maximum x created per hour. 0 (default) means no limit.', + 'Rate limit PRs to maximum x created per hour. 0 means no limit.', type: 'integer', - default: 0, // no limit + default: 2, }, { name: 'prConcurrentLimit', description: - 'Limit to a maximum of x concurrent branches/PRs. 0 (default) means no limit.', + 'Limit to a maximum of x concurrent branches/PRs. 0 means no limit.', type: 'integer', - default: 0, // no limit + default: 10, }, { name: 'branchConcurrentLimit', diff --git a/lib/config/presets/index.spec.ts b/lib/config/presets/index.spec.ts index 3bf5d5fffb5c49..92784b5a581251 100644 --- a/lib/config/presets/index.spec.ts +++ b/lib/config/presets/index.spec.ts @@ -839,8 +839,6 @@ describe('config/presets/index', () => { ':dependencyDashboard', ':semanticPrefixFixDepsChoreOthers', ':ignoreModulesAndTests', - ':prHourlyLimit2', - ':prConcurrentLimit10', 'group:monorepos', 'group:recommended', 'workarounds:all', diff --git a/lib/config/presets/internal/config.ts b/lib/config/presets/internal/config.ts index 355135deaa0727..040c102aae93c5 100644 --- a/lib/config/presets/internal/config.ts +++ b/lib/config/presets/internal/config.ts @@ -9,8 +9,6 @@ export const presets: Record = { ':dependencyDashboard', ':semanticPrefixFixDepsChoreOthers', ':ignoreModulesAndTests', - ':prHourlyLimit2', - ':prConcurrentLimit10', 'group:monorepos', 'group:recommended', 'workarounds:all', diff --git a/lib/modules/platform/codecommit/index.md b/lib/modules/platform/codecommit/index.md index de47f7b3aa5ab0..6b74cc66edf58b 100644 --- a/lib/modules/platform/codecommit/index.md +++ b/lib/modules/platform/codecommit/index.md @@ -133,7 +133,6 @@ module.exports = { password: 'SECRET_ACCESS_KEY_GOES_HERE', token: 'AWS_SESSION_TOKEN_GOES_HERE', gitAuthor: 'your_email@domain', - prConcurrentLimit: 10, packageRules: [ { matchPackageNames: ['package_name', 'package_name2'], diff --git a/lib/workers/repository/process/limits.spec.ts b/lib/workers/repository/process/limits.spec.ts index 2b8feb28536ece..4e09fb513daee0 100644 --- a/lib/workers/repository/process/limits.spec.ts +++ b/lib/workers/repository/process/limits.spec.ts @@ -41,13 +41,14 @@ describe('workers/repository/process/limits', () => { }); it('returns prHourlyLimit if errored', async () => { - config.prHourlyLimit = 2; + config.prHourlyLimit = 5; platform.getPrList.mockRejectedValue('Unknown error'); const res = await limits.getPrHourlyRemaining(config); - expect(res).toBe(2); + expect(res).toBe(5); }); it('returns 99 if no hourly limit', async () => { + config.prHourlyLimit = 0; const res = await limits.getPrHourlyRemaining(config); expect(res).toBe(99); }); @@ -73,6 +74,7 @@ describe('workers/repository/process/limits', () => { }); it('returns 99 if no concurrent limit', async () => { + config.prConcurrentLimit = 0; const res = await limits.getConcurrentPrsRemaining(config, []); expect(res).toBe(99); }); @@ -80,16 +82,16 @@ describe('workers/repository/process/limits', () => { describe('getPrsRemaining()', () => { it('returns hourly limit', async () => { - config.prHourlyLimit = 5; + config.prHourlyLimit = 1; platform.getPrList.mockResolvedValueOnce([]); const res = await limits.getPrsRemaining(config, []); - expect(res).toBe(5); + expect(res).toBe(1); }); it('returns concurrent limit', async () => { - config.prConcurrentLimit = 5; + config.prConcurrentLimit = 1; const res = await limits.getPrsRemaining(config, []); - expect(res).toBe(5); + expect(res).toBe(1); }); }); @@ -120,9 +122,9 @@ describe('workers/repository/process/limits', () => { expect(res).toBe(99); }); - it('returns 99 if no limits are set', async () => { + it('returns 10 if no limits are set', async () => { const res = await limits.getConcurrentBranchesRemaining(config, []); - expect(res).toBe(99); + expect(res).toBe(10); }); it('returns prConcurrentLimit if errored', async () => { From 0c681f7ef2c13cea539dc5019a9c114b0f9ff60e Mon Sep 17 00:00:00 2001 From: Rhys Arkins Date: Sat, 28 Jan 2023 11:41:52 +0100 Subject: [PATCH 04/16] feat(cache): default cacheHardTtlMinutes to 24 hours (#20079) --- lib/config/options/index.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/config/options/index.ts b/lib/config/options/index.ts index a4afb0ca8c3d9e..1f1588021c7b80 100644 --- a/lib/config/options/index.ts +++ b/lib/config/options/index.ts @@ -2257,9 +2257,8 @@ const options: RenovateOptions[] = [ 'Maximum duration in minutes to keep datasource cache entries.', type: 'integer', stage: 'repository', - default: 0, + default: 24 * 60, globalOnly: true, - experimental: true, }, { name: 'prBodyDefinitions', From 1b580353b009a3bf757aaa7747301122393839d9 Mon Sep 17 00:00:00 2001 From: Rhys Arkins Date: Sun, 29 Jan 2023 07:11:52 +0100 Subject: [PATCH 05/16] feat(go)!: default GOPROXY (#20081) Set default GOPROXY value to match `go`'s own default. Closes #20040 BREAKING CHANGE: Renovate will now use go's default `GOPROXY` settings. To avoid using the public proxy, configure `GOPROXY=direct`. --- lib/modules/datasource/go/index.spec.ts | 17 +----------- lib/modules/datasource/go/index.ts | 4 +-- lib/modules/datasource/go/readme.md | 5 ++++ .../datasource/go/releases-goproxy.spec.ts | 26 +++++++++++++++++-- lib/modules/datasource/go/releases-goproxy.ts | 6 +++-- 5 files changed, 35 insertions(+), 23 deletions(-) create mode 100644 lib/modules/datasource/go/readme.md diff --git a/lib/modules/datasource/go/index.spec.ts b/lib/modules/datasource/go/index.spec.ts index 170c1774e6a697..ab23fe6909d00b 100644 --- a/lib/modules/datasource/go/index.spec.ts +++ b/lib/modules/datasource/go/index.spec.ts @@ -53,25 +53,10 @@ describe('modules/datasource/go/index', () => { delete process.env.GOPROXY; }); - it('fetches release info directly from VCS', async () => { - const expected = { releases: [{ version: '0.0.1' }] }; - getReleasesProxyMock.mockResolvedValue(null); - getReleasesDirectMock.mockResolvedValue(expected); - - const res = await datasource.getReleases({ - packageName: 'golang.org/foo/bar', - }); - - expect(res).toBe(expected); - expect(getReleasesProxyMock).not.toHaveBeenCalled(); - expect(getReleasesDirectMock).toHaveBeenCalled(); - }); - - it('supports GOPROXY', async () => { + it('fetches releases', async () => { const expected = { releases: [{ version: '0.0.1' }] }; getReleasesProxyMock.mockResolvedValue(expected); getReleasesDirectMock.mockResolvedValue(null); - process.env.GOPROXY = 'https://proxy.golang.org,direct'; const res = await datasource.getReleases({ packageName: 'golang.org/foo/bar', diff --git a/lib/modules/datasource/go/index.ts b/lib/modules/datasource/go/index.ts index 6bd4934a63d1e0..89fcff28f1802c 100644 --- a/lib/modules/datasource/go/index.ts +++ b/lib/modules/datasource/go/index.ts @@ -36,9 +36,7 @@ export class GoDatasource extends Datasource { key: ({ packageName }: Partial) => `${packageName}-digest`, }) getReleases(config: GetReleasesConfig): Promise { - return process.env.GOPROXY - ? this.goproxy.getReleases(config) - : this.direct.getReleases(config); + return this.goproxy.getReleases(config); } /** diff --git a/lib/modules/datasource/go/readme.md b/lib/modules/datasource/go/readme.md new file mode 100644 index 00000000000000..1546b270d1796c --- /dev/null +++ b/lib/modules/datasource/go/readme.md @@ -0,0 +1,5 @@ +This datasource will default to using the `GOPROXY` settings `https://proxy.golang.org,direct` if there is no value defined in environment variables. + +To override this default and use a different proxy, simply configure `GOPROXY` to an alternative setting in env. + +To override this default and stop using any proxy at all, set `GOPROXY` to the value `direct`. diff --git a/lib/modules/datasource/go/releases-goproxy.spec.ts b/lib/modules/datasource/go/releases-goproxy.spec.ts index 4cbc7aa852300c..55250e597fadb4 100644 --- a/lib/modules/datasource/go/releases-goproxy.spec.ts +++ b/lib/modules/datasource/go/releases-goproxy.spec.ts @@ -285,6 +285,30 @@ describe('modules/datasource/go/releases-goproxy', () => { delete process.env.GOINSECURE; }); + it('handles direct', async () => { + process.env.GOPROXY = 'direct'; + + githubGetTags.mockResolvedValueOnce({ + releases: [ + { gitRef: 'v1.0.0', version: 'v1.0.0' }, + { gitRef: 'v1.0.1', version: 'v1.0.1' }, + ], + }); + githubGetReleases.mockResolvedValueOnce({ releases: [] }); + + const res = await datasource.getReleases({ + packageName: 'github.com/google/btree', + }); + + expect(res).toEqual({ + releases: [ + { gitRef: 'v1.0.0', version: 'v1.0.0' }, + { gitRef: 'v1.0.1', version: 'v1.0.1' }, + ], + sourceUrl: 'https://github.com/google/btree', + }); + }); + it('skips GONOPROXY and GOPRIVATE packages', async () => { process.env.GOPROXY = baseUrl; process.env.GOPRIVATE = 'github.com/google/*'; @@ -311,8 +335,6 @@ describe('modules/datasource/go/releases-goproxy', () => { }); it('fetches release data from goproxy', async () => { - process.env.GOPROXY = baseUrl; - httpMock .scope(`${baseUrl}/github.com/google/btree`) .get('/@v/list') diff --git a/lib/modules/datasource/go/releases-goproxy.ts b/lib/modules/datasource/go/releases-goproxy.ts index 000d2473e4ffbd..c3dd78d1608cbf 100644 --- a/lib/modules/datasource/go/releases-goproxy.ts +++ b/lib/modules/datasource/go/releases-goproxy.ts @@ -32,8 +32,10 @@ export class GoProxyDatasource extends Datasource { async getReleases(config: GetReleasesConfig): Promise { const { packageName } = config; logger.trace(`goproxy.getReleases(${packageName})`); - - const goproxy = process.env.GOPROXY; + const goproxy = process.env.GOPROXY ?? 'https://proxy.golang.org,direct'; + if (goproxy === 'direct') { + return this.direct.getReleases(config); + } const proxyList = this.parseGoproxy(goproxy); const noproxy = GoProxyDatasource.parseNoproxy(); From 885ce7937a8b2f5254dddeaf062f15d8a8e55d41 Mon Sep 17 00:00:00 2001 From: Rhys Arkins Date: Mon, 30 Jan 2023 07:37:24 +0100 Subject: [PATCH 06/16] =?UTF-8?q?fix(regex):=20don=E2=80=99t=20escape=20fo?= =?UTF-8?q?rward=20slash=20in=20fileMatch=20(#19314)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/usage/configuration-options.md | 4 ++-- lib/config/options/index.ts | 2 +- lib/config/presets/internal/group.ts | 2 +- lib/config/presets/internal/monorepo.ts | 2 +- lib/modules/datasource/deno/index.ts | 2 +- lib/modules/datasource/go/releases-goproxy.ts | 4 ++-- lib/modules/datasource/hermit/index.ts | 2 +- lib/modules/datasource/maven/index.ts | 2 +- lib/modules/datasource/pypi/common.ts | 2 +- lib/modules/manager/bazelisk/index.ts | 2 +- lib/modules/manager/cocoapods/extract.ts | 2 +- lib/modules/manager/flux/common.ts | 2 +- lib/modules/manager/fvm/index.ts | 2 +- lib/modules/manager/github-actions/index.ts | 4 ++-- lib/modules/manager/gitlabci/utils.ts | 2 +- lib/modules/manager/gradle/index.ts | 8 ++++---- lib/modules/manager/mint/index.ts | 2 +- lib/modules/manager/nix/index.ts | 2 +- lib/modules/manager/nuget/index.ts | 4 ++-- lib/modules/manager/pre-commit/extract.ts | 2 +- lib/modules/manager/puppet/index.ts | 2 +- lib/modules/manager/regex/readme.md | 4 ++-- lib/modules/manager/terraform/lockfile/hash.ts | 2 +- lib/modules/manager/terraform/lockfile/util.ts | 2 +- lib/modules/manager/woodpecker/index.ts | 2 +- lib/modules/versioning/kubernetes-api/index.ts | 2 +- lib/util/modules.ts | 5 ++--- .../repository/update/pr/changelog/release-notes.ts | 4 ++-- 28 files changed, 38 insertions(+), 39 deletions(-) diff --git a/docs/usage/configuration-options.md b/docs/usage/configuration-options.md index 1e86f6a1062a08..2f27ba582f733c 100644 --- a/docs/usage/configuration-options.md +++ b/docs/usage/configuration-options.md @@ -1809,7 +1809,7 @@ This field also supports Regular Expressions if they begin and end with `/`. e.g { "packageRules": [ { - "matchBaseBranches": ["/^release\\/.*/"], + "matchBaseBranches": ["/^release/.*/"], "excludePackagePatterns": ["^eslint"], "enabled": false } @@ -2782,7 +2782,7 @@ regex definition: { "fileMatch": ["values.yaml$"], "matchStrings": [ - "image:\\s+(?my\\.old\\.registry\\/aRepository\\/andImage):(?[^\\s]+)" + "image:\\s+(?my\\.old\\.registry/aRepository/andImage):(?[^\\s]+)" ], "depNameTemplate": "my.new.registry/aRepository/andImage", "autoReplaceStringTemplate": "image: {{{depName}}}:{{{newValue}}}", diff --git a/lib/config/options/index.ts b/lib/config/options/index.ts index 1f1588021c7b80..188c9f5ff13349 100644 --- a/lib/config/options/index.ts +++ b/lib/config/options/index.ts @@ -962,7 +962,7 @@ const options: RenovateOptions[] = [ { name: 'matchBaseBranches', description: - 'List of strings containing exact matches (e.g. `["main"]`) and/or regex expressions (e.g. `["/^release\\/.*/"]`). Valid only within a `packageRules` object.', + 'List of strings containing exact matches (e.g. `["main"]`) and/or regex expressions (e.g. `["/^release/.*/"]`). Valid only within a `packageRules` object.', type: 'array', subType: 'string', allowString: true, diff --git a/lib/config/presets/internal/group.ts b/lib/config/presets/internal/group.ts index 18a9bf8d2f68f8..4e4d71da789ad3 100644 --- a/lib/config/presets/internal/group.ts +++ b/lib/config/presets/internal/group.ts @@ -314,7 +314,7 @@ const staticGroups = { { groupName: 'PHPStan packages', matchDatasources: ['packagist'], - matchPackagePatterns: ['^phpstan\\/phpstan$', '\\/phpstan-'], + matchPackagePatterns: ['^phpstan/phpstan$', '/phpstan-'], }, ], }, diff --git a/lib/config/presets/internal/monorepo.ts b/lib/config/presets/internal/monorepo.ts index a471cdfbce0ce7..930bf6a3f73ee2 100644 --- a/lib/config/presets/internal/monorepo.ts +++ b/lib/config/presets/internal/monorepo.ts @@ -270,7 +270,7 @@ const patternGroups = { clarity: ['^@cds/', '^@clr/'], embroider: '^@embroider/', fullcalendar: '^@fullcalendar/', - spfx: ['^@microsoft\\/sp-', '^@microsoft\\/eslint-.+-spfx$'], + spfx: ['^@microsoft/sp-', '^@microsoft/eslint-.+-spfx$'], spock: '^org\\.spockframework:spock-', 'syncfusion-dotnet': '^Syncfusion\\.', wordpress: '^@wordpress/', diff --git a/lib/modules/datasource/deno/index.ts b/lib/modules/datasource/deno/index.ts index 1568c1d5cd8234..81b42542b57e2d 100644 --- a/lib/modules/datasource/deno/index.ts +++ b/lib/modules/datasource/deno/index.ts @@ -45,7 +45,7 @@ export class DenoDatasource extends Datasource { const massagedRegistryUrl = registryUrl!; const extractResult = regEx( - '^(https:\\/\\/deno.land\\/)(?[^@\\s]+)' + '^(https://deno.land/)(?[^@\\s]+)' ).exec(packageName); const rawPackageName = extractResult?.groups?.rawPackageName; if (is.nullOrUndefined(rawPackageName)) { diff --git a/lib/modules/datasource/go/releases-goproxy.ts b/lib/modules/datasource/go/releases-goproxy.ts index c3dd78d1608cbf..a541c06c2872b3 100644 --- a/lib/modules/datasource/go/releases-goproxy.ts +++ b/lib/modules/datasource/go/releases-goproxy.ts @@ -161,11 +161,11 @@ export class GoProxyDatasource extends Datasource { }, asterisk: { match: '*', - value: (_: string) => '[^\\/]*', + value: (_: string) => '[^/]*', }, qmark: { match: '?', - value: (_: string) => '[^\\/]', + value: (_: string) => '[^/]', }, characterRangeOpen: { match: '[', diff --git a/lib/modules/datasource/hermit/index.ts b/lib/modules/datasource/hermit/index.ts index f2015d3385674b..cb95421f5fe3f7 100644 --- a/lib/modules/datasource/hermit/index.ts +++ b/lib/modules/datasource/hermit/index.ts @@ -34,7 +34,7 @@ export class HermitDatasource extends Datasource { constructor() { super(HermitDatasource.id); this.http = new GithubHttp(id); - this.pathRegex = regEx('^\\/(?[^/]+)\\/(?[^/]+)$'); + this.pathRegex = regEx('^/(?[^/]+)/(?[^/]+)$'); } @cache({ diff --git a/lib/modules/datasource/maven/index.ts b/lib/modules/datasource/maven/index.ts index 19e327ec7dd365..a257edfcdeb526 100644 --- a/lib/modules/datasource/maven/index.ts +++ b/lib/modules/datasource/maven/index.ts @@ -53,7 +53,7 @@ function extractVersions(metadata: XmlDocument): string[] { } const mavenCentralHtmlVersionRegex = regEx( - '^(?:[^"]+)\\/<\\/a>\\s+(?\\d\\d\\d\\d-\\d\\d-\\d\\d \\d\\d:\\d\\d)\\s+-$', + '^(?:[^"]+)/\\s+(?\\d\\d\\d\\d-\\d\\d-\\d\\d \\d\\d:\\d\\d)\\s+-$', 'i' ); diff --git a/lib/modules/datasource/pypi/common.ts b/lib/modules/datasource/pypi/common.ts index 50310011e54b8f..ea46fddcc7530f 100644 --- a/lib/modules/datasource/pypi/common.ts +++ b/lib/modules/datasource/pypi/common.ts @@ -1,6 +1,6 @@ import { regEx } from '../../../util/regex'; -const githubRepoPattern = regEx(/^https?:\/\/github\.com\/[^\\/]+\/[^\\/]+$/); +const githubRepoPattern = regEx(/^https?:\/\/github\.com\/[^/]+\/[^/]+$/); export function isGitHubRepo(url: string): boolean { return !url.includes('sponsors') && githubRepoPattern.test(url); diff --git a/lib/modules/manager/bazelisk/index.ts b/lib/modules/manager/bazelisk/index.ts index 345989e1b4c99a..350125b3b3a06c 100644 --- a/lib/modules/manager/bazelisk/index.ts +++ b/lib/modules/manager/bazelisk/index.ts @@ -3,7 +3,7 @@ import { GithubReleasesDatasource } from '../../datasource/github-releases'; export { extractPackageFile } from './extract'; export const defaultConfig = { - fileMatch: ['(^|\\/)\\.bazelversion$'], + fileMatch: ['(^|/)\\.bazelversion$'], pinDigests: false, }; diff --git a/lib/modules/manager/cocoapods/extract.ts b/lib/modules/manager/cocoapods/extract.ts index e251df745da8ab..ddb17826e75413 100644 --- a/lib/modules/manager/cocoapods/extract.ts +++ b/lib/modules/manager/cocoapods/extract.ts @@ -9,7 +9,7 @@ import type { PackageDependency, PackageFileContent } from '../types'; import type { ParsedLine } from './types'; const regexMappings = [ - regEx(`^\\s*pod\\s+(['"])(?[^'"/]+)(\\/(?[^'"]+))?(['"])`), + regEx(`^\\s*pod\\s+(['"])(?[^'"/]+)(/(?[^'"]+))?(['"])`), regEx( `^\\s*pod\\s+(['"])[^'"]+(['"])\\s*,\\s*(['"])(?[^'"]+)(['"])\\s*$` ), diff --git a/lib/modules/manager/flux/common.ts b/lib/modules/manager/flux/common.ts index 320e7b9f31b92b..3d9b97896f1128 100644 --- a/lib/modules/manager/flux/common.ts +++ b/lib/modules/manager/flux/common.ts @@ -1,7 +1,7 @@ import { regEx } from '../../../util/regex'; export const systemManifestRegex = - '(^|\\/)flux-system\\/(?:.+\\/)?gotk-components\\.yaml$'; + '(^|/)flux-system/(?:.+/)?gotk-components\\.yaml$'; export function isSystemManifest(file: string): boolean { return regEx(systemManifestRegex).test(file); diff --git a/lib/modules/manager/fvm/index.ts b/lib/modules/manager/fvm/index.ts index 68b30f31387696..ebb67637e31e32 100644 --- a/lib/modules/manager/fvm/index.ts +++ b/lib/modules/manager/fvm/index.ts @@ -6,6 +6,6 @@ export { extractPackageFile } from './extract'; export const supportedDatasources = [FlutterVersionDatasource.id]; export const defaultConfig = { - fileMatch: ['(^|\\/)\\.fvm\\/fvm_config\\.json$'], + fileMatch: ['(^|/)\\.fvm/fvm_config\\.json$'], versioning: semverVersioning.id, }; diff --git a/lib/modules/manager/github-actions/index.ts b/lib/modules/manager/github-actions/index.ts index 8d6dc9282c5561..c2d7ad80bb6e42 100644 --- a/lib/modules/manager/github-actions/index.ts +++ b/lib/modules/manager/github-actions/index.ts @@ -4,8 +4,8 @@ export { extractPackageFile } from './extract'; export const defaultConfig = { fileMatch: [ - '^(workflow-templates|\\.github\\/workflows)\\/[^/]+\\.ya?ml$', - '(^|\\/)action\\.ya?ml$', + '^(workflow-templates|\\.github/workflows)/[^/]+\\.ya?ml$', + '(^|/)action\\.ya?ml$', ], }; diff --git a/lib/modules/manager/gitlabci/utils.ts b/lib/modules/manager/gitlabci/utils.ts index d8afde40bae366..15f094742b1282 100644 --- a/lib/modules/manager/gitlabci/utils.ts +++ b/lib/modules/manager/gitlabci/utils.ts @@ -16,7 +16,7 @@ export function replaceReferenceTags(content: string): string { } const depProxyRe = regEx( - `(?\\$\\{?CI_DEPENDENCY_PROXY_(?:DIRECT_)?GROUP_IMAGE_PREFIX\\}?\\/)(?.+)` + `(?\\$\\{?CI_DEPENDENCY_PROXY_(?:DIRECT_)?GROUP_IMAGE_PREFIX\\}?/)(?.+)` ); /** diff --git a/lib/modules/manager/gradle/index.ts b/lib/modules/manager/gradle/index.ts index bb0ce8edd10c74..ad83ff7f60ba5d 100644 --- a/lib/modules/manager/gradle/index.ts +++ b/lib/modules/manager/gradle/index.ts @@ -12,12 +12,12 @@ export const supportsLockFileMaintenance = true; export const defaultConfig = { fileMatch: [ '\\.gradle(\\.kts)?$', - '(^|\\/)gradle\\.properties$', - '(^|\\/)gradle\\/.+\\.toml$', + '(^|/)gradle\\.properties$', + '(^|/)gradle/.+\\.toml$', '\\.versions\\.toml$', // The two below is for gradle-consistent-versions plugin - `(^|\\/)versions.props$`, - `(^|\\/)versions.lock$`, + `(^|/)versions.props$`, + `(^|/)versions.lock$`, ], timeout: 600, versioning: gradleVersioning.id, diff --git a/lib/modules/manager/mint/index.ts b/lib/modules/manager/mint/index.ts index 34ac5845807e30..fffd5aadb1ddf5 100644 --- a/lib/modules/manager/mint/index.ts +++ b/lib/modules/manager/mint/index.ts @@ -8,5 +8,5 @@ export { extractPackageFile } from './extract'; export const supportedDatasources = [GitTagsDatasource.id]; export const defaultConfig = { - fileMatch: ['(^|\\/)Mintfile$'], + fileMatch: ['(^|/)Mintfile$'], }; diff --git a/lib/modules/manager/nix/index.ts b/lib/modules/manager/nix/index.ts index 58b43af4843689..7cdfa48cdeb1bd 100644 --- a/lib/modules/manager/nix/index.ts +++ b/lib/modules/manager/nix/index.ts @@ -6,7 +6,7 @@ export { updateArtifacts } from './artifacts'; export const supportsLockFileMaintenance = true; export const defaultConfig = { - fileMatch: ['(^|\\/)flake\\.nix$'], + fileMatch: ['(^|/)flake\\.nix$'], commitMessageTopic: 'nixpkgs', commitMessageExtra: 'to {{newValue}}', enabled: false, diff --git a/lib/modules/manager/nuget/index.ts b/lib/modules/manager/nuget/index.ts index 8f2a3253eb924f..c34ca3a67d8e78 100644 --- a/lib/modules/manager/nuget/index.ts +++ b/lib/modules/manager/nuget/index.ts @@ -12,8 +12,8 @@ export const defaultConfig = { fileMatch: [ '\\.(?:cs|fs|vb)proj$', '\\.(?:props|targets)$', - '(^|\\/)dotnet-tools\\.json$', - '(^|\\/)global\\.json$', + '(^|/)dotnet-tools\\.json$', + '(^|/)global\\.json$', ], }; diff --git a/lib/modules/manager/pre-commit/extract.ts b/lib/modules/manager/pre-commit/extract.ts index f7450cf713e9a8..7c9fba7561835f 100644 --- a/lib/modules/manager/pre-commit/extract.ts +++ b/lib/modules/manager/pre-commit/extract.ts @@ -83,7 +83,7 @@ function extractDependency( const urlMatchers = [ // This splits "http://my.github.com/user/repo" -> "my.github.com" "user/repo - regEx('^https?:\\/\\/(?[^\\/]+)\\/(?\\S*)'), + regEx('^https?://(?[^/]+)/(?\\S*)'), // This splits "git@private.registry.com:user/repo" -> "private.registry.com" "user/repo regEx('^git@(?[^:]+):(?\\S*)'), // This split "git://github.com/pre-commit/pre-commit-hooks" -> "github.com" "pre-commit/pre-commit-hooks" diff --git a/lib/modules/manager/puppet/index.ts b/lib/modules/manager/puppet/index.ts index 8743d2d408cfde..2b0735bb4c4c93 100644 --- a/lib/modules/manager/puppet/index.ts +++ b/lib/modules/manager/puppet/index.ts @@ -8,7 +8,7 @@ export { extractPackageFile } from './extract'; export const language: ProgrammingLanguage = 'ruby'; export const defaultConfig = { - fileMatch: ['(^|\\/)Puppetfile$'], + fileMatch: ['(^|/)Puppetfile$'], }; export const supportedDatasources = [ diff --git a/lib/modules/manager/regex/readme.md b/lib/modules/manager/regex/readme.md index a4a0ab618557b4..3adba3802f81bc 100644 --- a/lib/modules/manager/regex/readme.md +++ b/lib/modules/manager/regex/readme.md @@ -180,8 +180,8 @@ For example: "fileMatch": [".*y[a]?ml$"], "matchStringsStrategy": "combination", "matchStrings": [ - "['\"]?(?/pipeline-fragments\\/fragment-version-check)['\"]?\\s*ref:\\s['\"]?(?[\\d-]*)['\"]?", - "['\"]?(?pipeline-solutions\\/gitlab\\/fragments\\/fragment-version-check)['\"]?\\s*ref:\\s['\"]?(?[\\d-]*)['\"]?" + "['\"]?(?/pipeline-fragments/fragment-version-check)['\"]?\\s*ref:\\s['\"]?(?[\\d-]*)['\"]?", + "['\"]?(?pipeline-solutions/gitlab/fragments/fragment-version-check)['\"]?\\s*ref:\\s['\"]?(?[\\d-]*)['\"]?" ], "depNameTemplate": "pipeline-solutions/gitlab/fragments/fragment-version-check", "autoReplaceStringTemplate": "'{{{depName}}}'\n ref: {{{newValue}}}", diff --git a/lib/modules/manager/terraform/lockfile/hash.ts b/lib/modules/manager/terraform/lockfile/hash.ts index d3b37571630a2d..25afff41e2abef 100644 --- a/lib/modules/manager/terraform/lockfile/hash.ts +++ b/lib/modules/manager/terraform/lockfile/hash.ts @@ -32,7 +32,7 @@ export class TerraformProviderHash { // add double space, the filename and a new line char rootHash.update(' '); - const fileName = file.replace(regEx(/^.*[\\/]/), ''); + const fileName = file.replace(regEx(/^.*[/]/), ''); rootHash.update(fileName); rootHash.update('\n'); } diff --git a/lib/modules/manager/terraform/lockfile/util.ts b/lib/modules/manager/terraform/lockfile/util.ts index 774be9e7284914..2f59bb1e566722 100644 --- a/lib/modules/manager/terraform/lockfile/util.ts +++ b/lib/modules/manager/terraform/lockfile/util.ts @@ -10,7 +10,7 @@ import type { } from './types'; const providerStartLineRegex = regEx( - `^provider "(?[^/]*)\\/(?[^/]*)\\/(?[^/]*)"` + `^provider "(?[^/]*)/(?[^/]*)/(?[^/]*)"` ); const versionLineRegex = regEx( `^(?[\\s]*version[\\s]*=[\\s]*")(?[^"']+)(?".*)$` diff --git a/lib/modules/manager/woodpecker/index.ts b/lib/modules/manager/woodpecker/index.ts index aa823a82e0621e..07a0c38a5c7702 100644 --- a/lib/modules/manager/woodpecker/index.ts +++ b/lib/modules/manager/woodpecker/index.ts @@ -7,7 +7,7 @@ export const language: ProgrammingLanguage = 'docker'; export { extractPackageFile }; export const defaultConfig = { - fileMatch: ['^\\.woodpecker(?:\\/[^/]+)?\\.ya?ml$'], + fileMatch: ['^\\.woodpecker(?:/[^/]+)?\\.ya?ml$'], }; export const supportedDatasources = [DockerDatasource.id]; diff --git a/lib/modules/versioning/kubernetes-api/index.ts b/lib/modules/versioning/kubernetes-api/index.ts index c620991813d0fb..afcdf95438da3b 100644 --- a/lib/modules/versioning/kubernetes-api/index.ts +++ b/lib/modules/versioning/kubernetes-api/index.ts @@ -10,7 +10,7 @@ export const supportsRanges = false; export class KubernetesApiVersioningApi extends RegExpVersioningApi { private static readonly versionRegex = - '^(?:(?\\S+)\\/)?v(?\\d+)(?(?:alpha|beta)\\d+)?$'; + '^(?:(?\\S+)/)?v(?\\d+)(?(?:alpha|beta)\\d+)?$'; public constructor() { super(KubernetesApiVersioningApi.versionRegex); diff --git a/lib/util/modules.ts b/lib/util/modules.ts index e0bc3596cc0bf4..f0c6d4991335b3 100644 --- a/lib/util/modules.ts +++ b/lib/util/modules.ts @@ -1,10 +1,9 @@ import fs from 'fs'; import upath from 'upath'; -import { regEx } from './regex'; function relatePath(here: string, there: string): string { - const thereParts = upath.normalizeTrim(there).split(regEx(/[\\/]/)); - const hereParts = upath.normalizeTrim(here).split(regEx(/[\\/]/)); + const thereParts = upath.normalizeTrim(there).split('/'); + const hereParts = upath.normalizeTrim(here).split('/'); let idx = 0; while ( diff --git a/lib/workers/repository/update/pr/changelog/release-notes.ts b/lib/workers/repository/update/pr/changelog/release-notes.ts index 31446797c7c0f7..2cb7d2fbae582f 100644 --- a/lib/workers/repository/update/pr/changelog/release-notes.ts +++ b/lib/workers/repository/update/pr/changelog/release-notes.ts @@ -82,7 +82,7 @@ export function massageBody( body = body.replace(regEx(/^<\/a>\n/), ''); body = body.replace( regEx( - `^##? \\[[^\\]]*\\]\\(${baseUrl}[^/]*\\/[^/]*\\/compare\\/.*?\\n`, + `^##? \\[[^\\]]*\\]\\(${baseUrl}[^/]*/[^/]*/compare/.*?\\n`, undefined, false ), @@ -90,7 +90,7 @@ export function massageBody( ); // Clean-up unnecessary commits link body = `\n${body}\n`.replace( - regEx(`\\n${baseUrl}[^/]+\\/[^/]+\\/compare\\/[^\\n]+(\\n|$)`), + regEx(`\\n${baseUrl}[^/]+/[^/]+/compare/[^\\n]+(\\n|$)`), '\n' ); // Reduce headings size From 88cb161f4af4cc82b8617f7117f493db14b27989 Mon Sep 17 00:00:00 2001 From: Rhys Arkins Date: Wed, 1 Feb 2023 12:48:43 +0100 Subject: [PATCH 07/16] feat(cache): file cache cleanup (#20061) Checks file cache for expired items at the end of a run. Non-breaking change but it may result in some long cleanup jobs for any bots which have been left to populate their package cache for a long time. Closes #13732 --- lib/util/cache/package/file.spec.ts | 13 +++++++++- lib/util/cache/package/file.ts | 37 ++++++++++++++++++++++++++++- lib/util/cache/package/index.ts | 4 ++++ lib/util/cache/package/types.ts | 2 ++ 4 files changed, 54 insertions(+), 2 deletions(-) diff --git a/lib/util/cache/package/file.spec.ts b/lib/util/cache/package/file.spec.ts index bc15188900ceb9..f34ef5ee3fdf54 100644 --- a/lib/util/cache/package/file.spec.ts +++ b/lib/util/cache/package/file.spec.ts @@ -1,5 +1,6 @@ import os from 'os'; -import { get, init, set } from './file'; +import cacache from 'cacache'; +import { cleanup, get, init, set } from './file'; describe('util/cache/package/file', () => { it('returns if uninitiated', async () => { @@ -23,4 +24,14 @@ describe('util/cache/package/file', () => { await set('test', 'key', 1234, -5); expect(await get('test', 'key')).toBeUndefined(); }); + + it('cleans up', async () => { + const cacheFileName = init(os.tmpdir()); + await set('test', 'valid', 1234); + await set('test', 'expired', 1234, -5); + await cacache.put(cacheFileName, 'invalid', 'not json'); + await cleanup(); + const entries = await cacache.ls(cacheFileName); + expect(Object.keys(entries)).toEqual(['test-valid']); + }); }); diff --git a/lib/util/cache/package/file.ts b/lib/util/cache/package/file.ts index 4ed8baaea7a325..1415f8f2d83bed 100644 --- a/lib/util/cache/package/file.ts +++ b/lib/util/cache/package/file.ts @@ -64,7 +64,42 @@ export async function set( ); } -export function init(cacheDir: string): void { +export function init(cacheDir: string): string { cacheFileName = upath.join(cacheDir, '/renovate/renovate-cache-v1'); logger.debug('Initializing Renovate internal cache into ' + cacheFileName); + return cacheFileName; +} + +export async function cleanup(): Promise { + logger.debug('Checking file package cache for expired items'); + try { + let totalCount = 0; + let deletedCount = 0; + const startTime = Date.now(); + for await (const item of cacache.ls.stream(cacheFileName)) { + totalCount += 1; + const cachedItem = item as unknown as cacache.CacheObject; + const res = await cacache.get(cacheFileName, cachedItem.key); + let cachedValue: any; + try { + cachedValue = JSON.parse(res.data.toString()); + } catch (err) { + logger.debug('Error parsing cached value - deleting'); + } + if ( + !cachedValue || + (cachedValue?.expiry && + DateTime.local() > DateTime.fromISO(cachedValue.expiry)) + ) { + await cacache.rm.entry(cacheFileName, cachedItem.key); + deletedCount += 1; + } + } + const durationMs = Math.round(Date.now() - startTime); + logger.debug( + `Deleted ${deletedCount} of ${totalCount} file cached entries in ${durationMs}ms` + ); + } catch (err) /* istanbul ignore next */ { + logger.warn({ err }, 'Error cleaning up expired file cache'); + } } diff --git a/lib/util/cache/package/index.ts b/lib/util/cache/package/index.ts index 635ceea48d84aa..9cb48a05b271b2 100644 --- a/lib/util/cache/package/index.ts +++ b/lib/util/cache/package/index.ts @@ -65,6 +65,7 @@ export async function init(config: AllConfig): Promise { cacheProxy = { get: fileCache.get, set: fileCache.set, + cleanup: fileCache.cleanup, }; } } @@ -73,4 +74,7 @@ export async function cleanup(config: AllConfig): Promise { if (config?.redisUrl) { await redisCache.end(); } + if (cacheProxy.cleanup) { + await cacheProxy.cleanup(); + } } diff --git a/lib/util/cache/package/types.ts b/lib/util/cache/package/types.ts index 51fa8a0e7ca520..d345b6d4d2670f 100644 --- a/lib/util/cache/package/types.ts +++ b/lib/util/cache/package/types.ts @@ -7,4 +7,6 @@ export interface PackageCache { value: T, ttlMinutes?: number ): Promise; + + cleanup?(): Promise; } From 81c053120a4d15d598bfc10c68bf8209ea882315 Mon Sep 17 00:00:00 2001 From: Michael Kriese Date: Wed, 1 Feb 2023 17:47:24 +0100 Subject: [PATCH 08/16] feat(config): default `dockerImagePrefix` to `containerbase` (#20150) Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com> --- docs/usage/self-hosted-configuration.md | 12 ++++---- lib/config/options/index.ts | 2 +- lib/modules/manager/bundler/artifacts.spec.ts | 28 +++++++++---------- lib/modules/manager/cargo/artifacts.spec.ts | 4 +-- .../__snapshots__/artifacts.spec.ts.snap | 8 +++--- .../manager/cocoapods/artifacts.spec.ts | 4 +-- .../manager/composer/artifacts.spec.ts | 4 +-- lib/modules/manager/gomod/artifacts.spec.ts | 26 ++++++++--------- .../manager/gradle-wrapper/artifacts.spec.ts | 4 +-- lib/modules/manager/gradle/artifacts.spec.ts | 6 ++-- .../__snapshots__/artifacts.spec.ts.snap | 8 +++--- .../manager/maven-wrapper/artifacts.spec.ts | 4 +-- .../mix/__snapshots__/artifacts.spec.ts.snap | 6 ++-- lib/modules/manager/nix/artifacts.spec.ts | 8 +++--- .../manager/npm/post-update/lerna.spec.ts | 4 +-- .../manager/npm/post-update/npm.spec.ts | 4 +-- .../manager/npm/post-update/pnpm.spec.ts | 4 +-- .../manager/npm/post-update/yarn.spec.ts | 4 +-- lib/modules/manager/nuget/artifacts.spec.ts | 4 +-- .../manager/pip-compile/artifacts.spec.ts | 8 +++--- .../pip_requirements/artifacts.spec.ts | 4 +-- .../__snapshots__/artifacts.spec.ts.snap | 16 +++++------ lib/modules/manager/poetry/artifacts.spec.ts | 8 +++--- lib/modules/manager/pub/artifacts.spec.ts | 4 +-- lib/util/exec/docker/index.spec.ts | 2 +- lib/util/exec/docker/index.ts | 4 ++- lib/util/exec/index.spec.ts | 18 ++++++------ 27 files changed, 105 insertions(+), 103 deletions(-) diff --git a/docs/usage/self-hosted-configuration.md b/docs/usage/self-hosted-configuration.md index f0a8e3787dcaba..c927b117469a8d 100644 --- a/docs/usage/self-hosted-configuration.md +++ b/docs/usage/self-hosted-configuration.md @@ -302,9 +302,9 @@ You can skip the host part, and use just the datasource and credentials. Adds a custom prefix to the default Renovate sidecar Docker containers name and label. -For example, if you set `dockerChildPrefix=myprefix_` then the final container created from the `renovate/node` is: +For example, if you set `dockerChildPrefix=myprefix_` then the final container created from the `containerbase/sidecar` is: -- called `myprefix_node` instead of `renovate_node` +- called `myprefix_sidecar` instead of `renovate_sidecar` - labeled `myprefix_child` instead of `renovate_child` @@ -313,19 +313,19 @@ For example, if you set `dockerChildPrefix=myprefix_` then the final container c ## dockerImagePrefix -By default Renovate pulls the sidecar Docker containers from `docker.io/renovate`. +By default Renovate pulls the sidecar Docker containers from `docker.io/containerbase`. You can use the `dockerImagePrefix` option to override this default. -Say you want to pull your images from `ghcr.io/renovatebot`. +Say you want to pull your images from `ghcr.io/containerbase` to bypass Docker Hub limits. You would put this in your configuration file: ```json { - "dockerImagePrefix": "ghcr.io/renovatebot" + "dockerImagePrefix": "ghcr.io/containerbase" } ``` -If you pulled a new `node` image, the final image would be `ghcr.io/renovatebot/node` instead of `docker.io/renovate/node`. +Now when Renovate pulls a new `sidecar` image, the final image is `ghcr.io/containerbase/sidecar` instead of `docker.io/containerbase/sidecar`. ## dockerUser diff --git a/lib/config/options/index.ts b/lib/config/options/index.ts index 188c9f5ff13349..2a1e2493cdb9b3 100644 --- a/lib/config/options/index.ts +++ b/lib/config/options/index.ts @@ -348,7 +348,7 @@ const options: RenovateOptions[] = [ description: 'Change this value to override the default Renovate Docker sidecar image name prefix.', type: 'string', - default: 'docker.io/renovate', + default: 'docker.io/containerbase', globalOnly: true, }, { diff --git a/lib/modules/manager/bundler/artifacts.spec.ts b/lib/modules/manager/bundler/artifacts.spec.ts index 7271c99dab2035..a2eab121cdc71f 100644 --- a/lib/modules/manager/bundler/artifacts.spec.ts +++ b/lib/modules/manager/bundler/artifacts.spec.ts @@ -280,7 +280,7 @@ describe('modules/manager/bundler/artifacts', () => { }) ).toEqual([updatedGemfileLock]); expect(execSnapshots).toMatchObject([ - { cmd: 'docker pull renovate/sidecar' }, + { cmd: 'docker pull containerbase/sidecar' }, { cmd: 'docker ps --filter name=renovate_sidecar -aq' }, { cmd: @@ -291,7 +291,7 @@ describe('modules/manager/bundler/artifacts', () => { '-e BUILDPACK_CACHE_DIR ' + '-e CONTAINERBASE_CACHE_DIR ' + '-w "/tmp/github/some/repo" ' + - 'renovate/sidecar' + + 'containerbase/sidecar' + ' bash -l -c "' + 'install-tool ruby 1.2.0' + ' && ' + @@ -340,7 +340,7 @@ describe('modules/manager/bundler/artifacts', () => { }) ).toEqual([updatedGemfileLock]); expect(execSnapshots).toMatchObject([ - { cmd: 'docker pull renovate/sidecar' }, + { cmd: 'docker pull containerbase/sidecar' }, { cmd: 'docker ps --filter name=renovate_sidecar -aq' }, { cmd: @@ -351,7 +351,7 @@ describe('modules/manager/bundler/artifacts', () => { '-e BUILDPACK_CACHE_DIR ' + '-e CONTAINERBASE_CACHE_DIR ' + '-w "/tmp/github/some/repo" ' + - 'renovate/sidecar' + + 'containerbase/sidecar' + ' bash -l -c "' + 'install-tool ruby 1.2.5' + ' && ' + @@ -402,7 +402,7 @@ describe('modules/manager/bundler/artifacts', () => { }) ).toEqual([updatedGemfileLock]); expect(execSnapshots).toMatchObject([ - { cmd: 'docker pull renovate/sidecar' }, + { cmd: 'docker pull containerbase/sidecar' }, { cmd: 'docker ps --filter name=renovate_sidecar -aq' }, { cmd: @@ -413,7 +413,7 @@ describe('modules/manager/bundler/artifacts', () => { '-e BUILDPACK_CACHE_DIR ' + '-e CONTAINERBASE_CACHE_DIR ' + '-w "/tmp/github/some/repo" ' + - 'renovate/sidecar' + + 'containerbase/sidecar' + ' bash -l -c "' + 'install-tool ruby 1.3.0' + ' && ' + @@ -463,7 +463,7 @@ describe('modules/manager/bundler/artifacts', () => { }) ).toEqual([updatedGemfileLock]); expect(execSnapshots).toMatchObject([ - { cmd: 'docker pull renovate/sidecar' }, + { cmd: 'docker pull containerbase/sidecar' }, { cmd: 'docker ps --filter name=renovate_sidecar -aq' }, { cmd: @@ -475,7 +475,7 @@ describe('modules/manager/bundler/artifacts', () => { '-e BUILDPACK_CACHE_DIR ' + '-e CONTAINERBASE_CACHE_DIR ' + '-w "/tmp/github/some/repo" ' + - 'renovate/sidecar' + + 'containerbase/sidecar' + ' bash -l -c "' + 'install-tool ruby 1.2.0' + ' && ' + @@ -534,7 +534,7 @@ describe('modules/manager/bundler/artifacts', () => { }) ).toEqual([updatedGemfileLock]); expect(execSnapshots).toMatchObject([ - { cmd: 'docker pull renovate/sidecar' }, + { cmd: 'docker pull containerbase/sidecar' }, { cmd: 'docker ps --filter name=renovate_sidecar -aq' }, { cmd: @@ -545,7 +545,7 @@ describe('modules/manager/bundler/artifacts', () => { '-e BUILDPACK_CACHE_DIR ' + '-e CONTAINERBASE_CACHE_DIR ' + '-w "/tmp/github/some/repo" ' + - 'renovate/sidecar' + + 'containerbase/sidecar' + ' bash -l -c "' + 'install-tool ruby 1.2.0' + ' && ' + @@ -606,7 +606,7 @@ describe('modules/manager/bundler/artifacts', () => { }) ).toEqual([updatedGemfileLock]); expect(execSnapshots).toMatchObject([ - { cmd: 'docker pull renovate/sidecar' }, + { cmd: 'docker pull containerbase/sidecar' }, { cmd: 'docker ps --filter name=renovate_sidecar -aq' }, { cmd: @@ -617,7 +617,7 @@ describe('modules/manager/bundler/artifacts', () => { '-e BUILDPACK_CACHE_DIR ' + '-e CONTAINERBASE_CACHE_DIR ' + '-w "/tmp/github/some/repo" ' + - 'renovate/sidecar' + + 'containerbase/sidecar' + ' bash -l -c "' + 'install-tool ruby 1.2.0' + ' && ' + @@ -677,7 +677,7 @@ describe('modules/manager/bundler/artifacts', () => { }) ).toEqual([updatedGemfileLock]); expect(execSnapshots).toMatchObject([ - { cmd: 'docker pull renovate/sidecar' }, + { cmd: 'docker pull containerbase/sidecar' }, { cmd: 'docker ps --filter name=renovate_sidecar -aq' }, { cmd: @@ -688,7 +688,7 @@ describe('modules/manager/bundler/artifacts', () => { '-e BUILDPACK_CACHE_DIR ' + '-e CONTAINERBASE_CACHE_DIR ' + '-w "/tmp/github/some/repo" ' + - 'renovate/sidecar' + + 'containerbase/sidecar' + ' bash -l -c "' + 'install-tool ruby 1.2.0' + ' && ' + diff --git a/lib/modules/manager/cargo/artifacts.spec.ts b/lib/modules/manager/cargo/artifacts.spec.ts index f7be45d07709d6..1ad6453f3c6331 100644 --- a/lib/modules/manager/cargo/artifacts.spec.ts +++ b/lib/modules/manager/cargo/artifacts.spec.ts @@ -210,7 +210,7 @@ describe('modules/manager/cargo/artifacts', () => { }, ]); expect(execSnapshots).toMatchObject([ - { cmd: 'docker pull renovate/sidecar' }, + { cmd: 'docker pull containerbase/sidecar' }, {}, { cmd: @@ -220,7 +220,7 @@ describe('modules/manager/cargo/artifacts', () => { '-e BUILDPACK_CACHE_DIR ' + '-e CONTAINERBASE_CACHE_DIR ' + '-w "/tmp/github/some/repo" ' + - 'renovate/sidecar ' + + 'containerbase/sidecar ' + 'bash -l -c "' + 'install-tool rust 1.65.0' + ' && ' + diff --git a/lib/modules/manager/cocoapods/__snapshots__/artifacts.spec.ts.snap b/lib/modules/manager/cocoapods/__snapshots__/artifacts.spec.ts.snap index f23ccb9731a49f..3dab15063ae67d 100644 --- a/lib/modules/manager/cocoapods/__snapshots__/artifacts.spec.ts.snap +++ b/lib/modules/manager/cocoapods/__snapshots__/artifacts.spec.ts.snap @@ -57,13 +57,13 @@ exports[`modules/manager/cocoapods/artifacts returns pod exec error 1`] = ` exports[`modules/manager/cocoapods/artifacts returns updated Podfile 1`] = ` [ { - "cmd": "docker pull renovate/sidecar", + "cmd": "docker pull containerbase/sidecar", "options": { "encoding": "utf-8", }, }, { - "cmd": "docker run --rm --name=renovate_sidecar --label=renovate_child -v "/tmp/github/some/repo":"/tmp/github/some/repo" -v "/tmp/cache":"/tmp/cache" -e BUILDPACK_CACHE_DIR -e CONTAINERBASE_CACHE_DIR -w "/tmp/github/some/repo" renovate/sidecar bash -l -c "install-tool ruby 3.1.0 && install-tool cocoapods 3.1.0 && gem install cocoapods-acknowledgements && pod install"", + "cmd": "docker run --rm --name=renovate_sidecar --label=renovate_child -v "/tmp/github/some/repo":"/tmp/github/some/repo" -v "/tmp/cache":"/tmp/cache" -e BUILDPACK_CACHE_DIR -e CONTAINERBASE_CACHE_DIR -w "/tmp/github/some/repo" containerbase/sidecar bash -l -c "install-tool ruby 3.1.0 && install-tool cocoapods 3.1.0 && gem install cocoapods-acknowledgements && pod install"", "options": { "cwd": "/tmp/github/some/repo", "encoding": "utf-8", @@ -88,13 +88,13 @@ exports[`modules/manager/cocoapods/artifacts returns updated Podfile 1`] = ` exports[`modules/manager/cocoapods/artifacts returns updated Podfile and Pods files 1`] = ` [ { - "cmd": "docker pull renovate/sidecar", + "cmd": "docker pull containerbase/sidecar", "options": { "encoding": "utf-8", }, }, { - "cmd": "docker run --rm --name=renovate_sidecar --label=renovate_child -v "/tmp/github/some/repo":"/tmp/github/some/repo" -v "/tmp/cache":"/tmp/cache" -e BUILDPACK_CACHE_DIR -e CONTAINERBASE_CACHE_DIR -w "/tmp/github/some/repo" renovate/sidecar bash -l -c "install-tool ruby 3.1.0 && install-tool cocoapods 3.1.0 && pod install"", + "cmd": "docker run --rm --name=renovate_sidecar --label=renovate_child -v "/tmp/github/some/repo":"/tmp/github/some/repo" -v "/tmp/cache":"/tmp/cache" -e BUILDPACK_CACHE_DIR -e CONTAINERBASE_CACHE_DIR -w "/tmp/github/some/repo" containerbase/sidecar bash -l -c "install-tool ruby 3.1.0 && install-tool cocoapods 3.1.0 && pod install"", "options": { "cwd": "/tmp/github/some/repo", "encoding": "utf-8", diff --git a/lib/modules/manager/cocoapods/artifacts.spec.ts b/lib/modules/manager/cocoapods/artifacts.spec.ts index 514954474de213..a4caf0fe10d5b8 100644 --- a/lib/modules/manager/cocoapods/artifacts.spec.ts +++ b/lib/modules/manager/cocoapods/artifacts.spec.ts @@ -252,7 +252,7 @@ describe('modules/manager/cocoapods/artifacts', () => { config, }); expect(execSnapshots).toMatchObject([ - { cmd: 'docker pull renovate/sidecar' }, + { cmd: 'docker pull containerbase/sidecar' }, { cmd: 'docker run --rm --name=renovate_sidecar --label=renovate_child ' + @@ -261,7 +261,7 @@ describe('modules/manager/cocoapods/artifacts', () => { '-e BUILDPACK_CACHE_DIR ' + '-e CONTAINERBASE_CACHE_DIR ' + '-w "/tmp/github/some/repo" ' + - 'renovate/sidecar' + + 'containerbase/sidecar' + ' bash -l -c "' + 'install-tool ruby 3.1.0' + ' && ' + diff --git a/lib/modules/manager/composer/artifacts.spec.ts b/lib/modules/manager/composer/artifacts.spec.ts index 2191ab49e9998a..d7486171970396 100644 --- a/lib/modules/manager/composer/artifacts.spec.ts +++ b/lib/modules/manager/composer/artifacts.spec.ts @@ -461,7 +461,7 @@ describe('modules/manager/composer/artifacts', () => { ]); expect(execSnapshots).toMatchObject([ { - cmd: 'docker pull renovate/sidecar', + cmd: 'docker pull containerbase/sidecar', options: { encoding: 'utf-8', }, @@ -481,7 +481,7 @@ describe('modules/manager/composer/artifacts', () => { '-e BUILDPACK_CACHE_DIR ' + '-e CONTAINERBASE_CACHE_DIR ' + '-w "/tmp/github/some/repo" ' + - 'renovate/sidecar' + + 'containerbase/sidecar' + ' bash -l -c "' + 'install-tool php 7.3' + ' && ' + diff --git a/lib/modules/manager/gomod/artifacts.spec.ts b/lib/modules/manager/gomod/artifacts.spec.ts index 16c65b5fdfafbd..9d3d392ec2905b 100644 --- a/lib/modules/manager/gomod/artifacts.spec.ts +++ b/lib/modules/manager/gomod/artifacts.spec.ts @@ -298,7 +298,7 @@ describe('modules/manager/gomod/artifacts', () => { }, ]); expect(execSnapshots).toMatchObject([ - { cmd: 'docker pull renovate/sidecar' }, + { cmd: 'docker pull containerbase/sidecar' }, { cmd: 'docker ps --filter name=renovate_sidecar -aq' }, { cmd: @@ -315,7 +315,7 @@ describe('modules/manager/gomod/artifacts', () => { '-e BUILDPACK_CACHE_DIR ' + '-e CONTAINERBASE_CACHE_DIR ' + '-w "/tmp/github/some/repo" ' + - 'renovate/sidecar' + + 'containerbase/sidecar' + ' bash -l -c "' + 'install-tool golang 1.14.0' + ' && ' + @@ -455,7 +455,7 @@ describe('modules/manager/gomod/artifacts', () => { }, ]); expect(execSnapshots).toMatchObject([ - { cmd: 'docker pull renovate/sidecar' }, + { cmd: 'docker pull containerbase/sidecar' }, { cmd: 'docker ps --filter name=renovate_sidecar -aq' }, { cmd: @@ -485,7 +485,7 @@ describe('modules/manager/gomod/artifacts', () => { '-e BUILDPACK_CACHE_DIR ' + '-e CONTAINERBASE_CACHE_DIR ' + '-w "/tmp/github/some/repo" ' + - 'renovate/sidecar' + + 'containerbase/sidecar' + ' bash -l -c "' + 'install-tool golang 1.14.0' + ' && ' + @@ -566,7 +566,7 @@ describe('modules/manager/gomod/artifacts', () => { }, ]); expect(execSnapshots).toMatchObject([ - { cmd: 'docker pull renovate/sidecar' }, + { cmd: 'docker pull containerbase/sidecar' }, {}, { options: { @@ -980,7 +980,7 @@ describe('modules/manager/gomod/artifacts', () => { { file: { contents: 'New go.sum 2', path: 'go.mod', type: 'addition' } }, ]); expect(execSnapshots).toMatchObject([ - { cmd: 'docker pull renovate/sidecar' }, + { cmd: 'docker pull containerbase/sidecar' }, {}, { cmd: @@ -997,7 +997,7 @@ describe('modules/manager/gomod/artifacts', () => { '-e BUILDPACK_CACHE_DIR ' + '-e CONTAINERBASE_CACHE_DIR ' + '-w "/tmp/github/some/repo" ' + - 'renovate/sidecar' + + 'containerbase/sidecar' + ' bash -l -c "' + 'install-tool golang 1.14.0' + ' && ' + @@ -1045,7 +1045,7 @@ describe('modules/manager/gomod/artifacts', () => { { file: { contents: 'New go.sum 2', path: 'go.mod', type: 'addition' } }, ]); expect(execSnapshots).toMatchObject([ - { cmd: 'docker pull renovate/sidecar' }, + { cmd: 'docker pull containerbase/sidecar' }, {}, { cmd: @@ -1062,7 +1062,7 @@ describe('modules/manager/gomod/artifacts', () => { '-e BUILDPACK_CACHE_DIR ' + '-e CONTAINERBASE_CACHE_DIR ' + '-w "/tmp/github/some/repo" ' + - 'renovate/sidecar' + + 'containerbase/sidecar' + ' bash -l -c "' + 'install-tool golang 1.14.0' + ' && ' + @@ -1683,7 +1683,7 @@ describe('modules/manager/gomod/artifacts', () => { ]); const expectedResult = [ { - cmd: 'docker pull renovate/sidecar', + cmd: 'docker pull containerbase/sidecar', }, {}, { @@ -1701,7 +1701,7 @@ describe('modules/manager/gomod/artifacts', () => { '-e BUILDPACK_CACHE_DIR ' + '-e CONTAINERBASE_CACHE_DIR ' + '-w "/tmp/github/some/repo" ' + - 'renovate/sidecar' + + 'containerbase/sidecar' + ' bash -l -c "' + 'install-tool golang 1.17.0' + ' && ' + @@ -1757,7 +1757,7 @@ describe('modules/manager/gomod/artifacts', () => { ]); const expectedResult = [ { - cmd: 'docker pull renovate/sidecar', + cmd: 'docker pull containerbase/sidecar', }, {}, { @@ -1775,7 +1775,7 @@ describe('modules/manager/gomod/artifacts', () => { '-e BUILDPACK_CACHE_DIR ' + '-e CONTAINERBASE_CACHE_DIR ' + '-w "/tmp/github/some/repo" ' + - 'renovate/sidecar' + + 'containerbase/sidecar' + ' bash -l -c "' + 'install-tool golang 1.14.0' + ' && ' + diff --git a/lib/modules/manager/gradle-wrapper/artifacts.spec.ts b/lib/modules/manager/gradle-wrapper/artifacts.spec.ts index 184e18eac25eab..d6996cde05251e 100644 --- a/lib/modules/manager/gradle-wrapper/artifacts.spec.ts +++ b/lib/modules/manager/gradle-wrapper/artifacts.spec.ts @@ -198,7 +198,7 @@ describe('modules/manager/gradle-wrapper/artifacts', () => { }, ]); expect(execSnapshots).toMatchObject([ - { cmd: 'docker pull renovate/sidecar' }, + { cmd: 'docker pull containerbase/sidecar' }, { cmd: 'docker ps --filter name=renovate_sidecar -aq' }, { cmd: @@ -209,7 +209,7 @@ describe('modules/manager/gradle-wrapper/artifacts', () => { '-e BUILDPACK_CACHE_DIR ' + '-e CONTAINERBASE_CACHE_DIR ' + '-w "/tmp/github/some/repo" ' + - 'renovate/sidecar' + + 'containerbase/sidecar' + ' bash -l -c "' + 'install-tool java 11.0.1' + ' && ' + diff --git a/lib/modules/manager/gradle/artifacts.spec.ts b/lib/modules/manager/gradle/artifacts.spec.ts index b3b0426da2b3d9..fb8d06bdca7890 100644 --- a/lib/modules/manager/gradle/artifacts.spec.ts +++ b/lib/modules/manager/gradle/artifacts.spec.ts @@ -279,7 +279,7 @@ describe('modules/manager/gradle/artifacts', () => { }, ]); expect(execSnapshots).toMatchObject([ - { cmd: 'docker pull renovate/sidecar' }, + { cmd: 'docker pull containerbase/sidecar' }, { cmd: 'docker ps --filter name=renovate_sidecar -aq' }, { cmd: @@ -290,7 +290,7 @@ describe('modules/manager/gradle/artifacts', () => { '-e BUILDPACK_CACHE_DIR ' + '-e CONTAINERBASE_CACHE_DIR ' + '-w "/tmp/github/some/repo" ' + - 'renovate/sidecar' + + 'containerbase/sidecar' + ' bash -l -c "' + 'install-tool java 16.0.1' + ' && ' + @@ -308,7 +308,7 @@ describe('modules/manager/gradle/artifacts', () => { '-e BUILDPACK_CACHE_DIR ' + '-e CONTAINERBASE_CACHE_DIR ' + '-w "/tmp/github/some/repo" ' + - 'renovate/sidecar' + + 'containerbase/sidecar' + ' bash -l -c "' + 'install-tool java 16.0.1' + ' && ' + diff --git a/lib/modules/manager/helmv3/__snapshots__/artifacts.spec.ts.snap b/lib/modules/manager/helmv3/__snapshots__/artifacts.spec.ts.snap index 205dd8746507ec..6fcb8eb6787c86 100644 --- a/lib/modules/manager/helmv3/__snapshots__/artifacts.spec.ts.snap +++ b/lib/modules/manager/helmv3/__snapshots__/artifacts.spec.ts.snap @@ -399,7 +399,7 @@ exports[`modules/manager/helmv3/artifacts returns updated Chart.lock for lockfil exports[`modules/manager/helmv3/artifacts returns updated Chart.lock with docker 1`] = ` [ { - "cmd": "docker pull renovate/sidecar", + "cmd": "docker pull containerbase/sidecar", "options": { "encoding": "utf-8", }, @@ -411,7 +411,7 @@ exports[`modules/manager/helmv3/artifacts returns updated Chart.lock with docker }, }, { - "cmd": "docker run --rm --name=renovate_sidecar --label=renovate_child -v "/tmp/github/some/repo":"/tmp/github/some/repo" -v "/tmp/renovate/cache":"/tmp/renovate/cache" -e HELM_EXPERIMENTAL_OCI -e BUILDPACK_CACHE_DIR -e CONTAINERBASE_CACHE_DIR -w "/tmp/github/some/repo" renovate/sidecar bash -l -c "install-tool helm v3.7.2 && helm repo add repo-test --registry-config /tmp/renovate/cache/__renovate-private-cache/registry.json --repository-config /tmp/renovate/cache/__renovate-private-cache/repositories.yaml --repository-cache /tmp/renovate/cache/__renovate-private-cache/repositories https://gitlab.com/api/v4/projects/xxxxxxx/packages/helm/stable && helm dependency update --registry-config /tmp/renovate/cache/__renovate-private-cache/registry.json --repository-config /tmp/renovate/cache/__renovate-private-cache/repositories.yaml --repository-cache /tmp/renovate/cache/__renovate-private-cache/repositories ''"", + "cmd": "docker run --rm --name=renovate_sidecar --label=renovate_child -v "/tmp/github/some/repo":"/tmp/github/some/repo" -v "/tmp/renovate/cache":"/tmp/renovate/cache" -e HELM_EXPERIMENTAL_OCI -e BUILDPACK_CACHE_DIR -e CONTAINERBASE_CACHE_DIR -w "/tmp/github/some/repo" containerbase/sidecar bash -l -c "install-tool helm v3.7.2 && helm repo add repo-test --registry-config /tmp/renovate/cache/__renovate-private-cache/registry.json --repository-config /tmp/renovate/cache/__renovate-private-cache/repositories.yaml --repository-cache /tmp/renovate/cache/__renovate-private-cache/repositories https://gitlab.com/api/v4/projects/xxxxxxx/packages/helm/stable && helm dependency update --registry-config /tmp/renovate/cache/__renovate-private-cache/registry.json --repository-config /tmp/renovate/cache/__renovate-private-cache/repositories.yaml --repository-cache /tmp/renovate/cache/__renovate-private-cache/repositories ''"", "options": { "cwd": "/tmp/github/some/repo", "encoding": "utf-8", @@ -518,7 +518,7 @@ exports[`modules/manager/helmv3/artifacts sets repositories from registryAliases exports[`modules/manager/helmv3/artifacts sets repositories from registryAliases with docker 1`] = ` [ { - "cmd": "docker pull renovate/sidecar", + "cmd": "docker pull containerbase/sidecar", "options": { "encoding": "utf-8", }, @@ -530,7 +530,7 @@ exports[`modules/manager/helmv3/artifacts sets repositories from registryAliases }, }, { - "cmd": "docker run --rm --name=renovate_sidecar --label=renovate_child -v "/tmp/github/some/repo":"/tmp/github/some/repo" -v "/tmp/renovate/cache":"/tmp/renovate/cache" -e HELM_EXPERIMENTAL_OCI -e BUILDPACK_CACHE_DIR -e CONTAINERBASE_CACHE_DIR -w "/tmp/github/some/repo" renovate/sidecar bash -l -c "install-tool helm v3.7.2 && helm repo add stable --registry-config /tmp/renovate/cache/__renovate-private-cache/registry.json --repository-config /tmp/renovate/cache/__renovate-private-cache/repositories.yaml --repository-cache /tmp/renovate/cache/__renovate-private-cache/repositories the_stable_url && helm repo add repo1 --registry-config /tmp/renovate/cache/__renovate-private-cache/registry.json --repository-config /tmp/renovate/cache/__renovate-private-cache/repositories.yaml --repository-cache /tmp/renovate/cache/__renovate-private-cache/repositories the_repo1_url && helm repo add repo-test --registry-config /tmp/renovate/cache/__renovate-private-cache/registry.json --repository-config /tmp/renovate/cache/__renovate-private-cache/repositories.yaml --repository-cache /tmp/renovate/cache/__renovate-private-cache/repositories https://gitlab.com/api/v4/projects/xxxxxxx/packages/helm/stable && helm dependency update --registry-config /tmp/renovate/cache/__renovate-private-cache/registry.json --repository-config /tmp/renovate/cache/__renovate-private-cache/repositories.yaml --repository-cache /tmp/renovate/cache/__renovate-private-cache/repositories ''"", + "cmd": "docker run --rm --name=renovate_sidecar --label=renovate_child -v "/tmp/github/some/repo":"/tmp/github/some/repo" -v "/tmp/renovate/cache":"/tmp/renovate/cache" -e HELM_EXPERIMENTAL_OCI -e BUILDPACK_CACHE_DIR -e CONTAINERBASE_CACHE_DIR -w "/tmp/github/some/repo" containerbase/sidecar bash -l -c "install-tool helm v3.7.2 && helm repo add stable --registry-config /tmp/renovate/cache/__renovate-private-cache/registry.json --repository-config /tmp/renovate/cache/__renovate-private-cache/repositories.yaml --repository-cache /tmp/renovate/cache/__renovate-private-cache/repositories the_stable_url && helm repo add repo1 --registry-config /tmp/renovate/cache/__renovate-private-cache/registry.json --repository-config /tmp/renovate/cache/__renovate-private-cache/repositories.yaml --repository-cache /tmp/renovate/cache/__renovate-private-cache/repositories the_repo1_url && helm repo add repo-test --registry-config /tmp/renovate/cache/__renovate-private-cache/registry.json --repository-config /tmp/renovate/cache/__renovate-private-cache/repositories.yaml --repository-cache /tmp/renovate/cache/__renovate-private-cache/repositories https://gitlab.com/api/v4/projects/xxxxxxx/packages/helm/stable && helm dependency update --registry-config /tmp/renovate/cache/__renovate-private-cache/registry.json --repository-config /tmp/renovate/cache/__renovate-private-cache/repositories.yaml --repository-cache /tmp/renovate/cache/__renovate-private-cache/repositories ''"", "options": { "cwd": "/tmp/github/some/repo", "encoding": "utf-8", diff --git a/lib/modules/manager/maven-wrapper/artifacts.spec.ts b/lib/modules/manager/maven-wrapper/artifacts.spec.ts index c90b68fc7018c8..01e55ce5b2f160 100644 --- a/lib/modules/manager/maven-wrapper/artifacts.spec.ts +++ b/lib/modules/manager/maven-wrapper/artifacts.spec.ts @@ -193,7 +193,7 @@ describe('modules/manager/maven-wrapper/artifacts', () => { ]); expect(execSnapshots).toMatchObject([ { - cmd: 'docker pull renovate/sidecar', + cmd: 'docker pull containerbase/sidecar', options: { encoding: 'utf-8' }, }, { cmd: 'docker ps --filter name=renovate_sidecar -aq' }, @@ -204,7 +204,7 @@ describe('modules/manager/maven-wrapper/artifacts', () => { '-e BUILDPACK_CACHE_DIR ' + '-e CONTAINERBASE_CACHE_DIR ' + '-w "../.." ' + - 'renovate/sidecar' + + 'containerbase/sidecar' + ' bash -l -c "' + 'install-tool java 17.0.0 ' + '&& ' + diff --git a/lib/modules/manager/mix/__snapshots__/artifacts.spec.ts.snap b/lib/modules/manager/mix/__snapshots__/artifacts.spec.ts.snap index 8970d0fae224e5..8c77419ecea365 100644 --- a/lib/modules/manager/mix/__snapshots__/artifacts.spec.ts.snap +++ b/lib/modules/manager/mix/__snapshots__/artifacts.spec.ts.snap @@ -21,7 +21,7 @@ exports[`modules/manager/mix/artifacts authenticates to private repositories 2`] }, }, { - "cmd": "docker run --rm --name=renovate_sidecar --label=renovate_child -v "/tmp/github/some/repo":"/tmp/github/some/repo" -v "/tmp/cache":"/tmp/cache" -e BUILDPACK_CACHE_DIR -e CONTAINERBASE_CACHE_DIR -w "/tmp/github/some/repo" renovate/sidecar bash -l -c "install-tool erlang 24.3.4.2 && install-tool elixir v1.13.4 && mix hex.organization auth renovate_test --key valid_test_token && mix deps.update private_package other_package"", + "cmd": "docker run --rm --name=renovate_sidecar --label=renovate_child -v "/tmp/github/some/repo":"/tmp/github/some/repo" -v "/tmp/cache":"/tmp/cache" -e BUILDPACK_CACHE_DIR -e CONTAINERBASE_CACHE_DIR -w "/tmp/github/some/repo" containerbase/sidecar bash -l -c "install-tool erlang 24.3.4.2 && install-tool elixir v1.13.4 && mix hex.organization auth renovate_test --key valid_test_token && mix deps.update private_package other_package"", "options": { "cwd": "/tmp/github/some/repo", "encoding": "utf-8", @@ -69,7 +69,7 @@ exports[`modules/manager/mix/artifacts returns null if unchanged 1`] = ` exports[`modules/manager/mix/artifacts returns updated mix.lock 1`] = ` [ { - "cmd": "docker pull renovate/sidecar", + "cmd": "docker pull containerbase/sidecar", "options": { "encoding": "utf-8", }, @@ -81,7 +81,7 @@ exports[`modules/manager/mix/artifacts returns updated mix.lock 1`] = ` }, }, { - "cmd": "docker run --rm --name=renovate_sidecar --label=renovate_child -v "/tmp/github/some/repo":"/tmp/github/some/repo" -v "/tmp/cache":"/tmp/cache" -e BUILDPACK_CACHE_DIR -e CONTAINERBASE_CACHE_DIR -w "/tmp/github/some/repo" renovate/sidecar bash -l -c "install-tool erlang 24.3.4.2 && install-tool elixir 1.13.4 && mix deps.update plug"", + "cmd": "docker run --rm --name=renovate_sidecar --label=renovate_child -v "/tmp/github/some/repo":"/tmp/github/some/repo" -v "/tmp/cache":"/tmp/cache" -e BUILDPACK_CACHE_DIR -e CONTAINERBASE_CACHE_DIR -w "/tmp/github/some/repo" containerbase/sidecar bash -l -c "install-tool erlang 24.3.4.2 && install-tool elixir 1.13.4 && mix deps.update plug"", "options": { "cwd": "/tmp/github/some/repo", "encoding": "utf-8", diff --git a/lib/modules/manager/nix/artifacts.spec.ts b/lib/modules/manager/nix/artifacts.spec.ts index 474768a28a4c60..7b4808aed1bb70 100644 --- a/lib/modules/manager/nix/artifacts.spec.ts +++ b/lib/modules/manager/nix/artifacts.spec.ts @@ -137,7 +137,7 @@ describe('modules/manager/nix/artifacts', () => { }, ]); expect(execSnapshots).toMatchObject([ - { cmd: 'docker pull renovate/sidecar' }, + { cmd: 'docker pull containerbase/sidecar' }, { cmd: 'docker ps --filter name=renovate_sidecar -aq' }, { cmd: @@ -147,7 +147,7 @@ describe('modules/manager/nix/artifacts', () => { '-e BUILDPACK_CACHE_DIR ' + '-e CONTAINERBASE_CACHE_DIR ' + '-w "/tmp/github/some/repo" ' + - 'renovate/sidecar ' + + 'containerbase/sidecar ' + 'bash -l -c "' + 'install-tool nix 2.10.0 ' + '&& ' + @@ -268,7 +268,7 @@ describe('modules/manager/nix/artifacts', () => { }, ]); expect(execSnapshots).toMatchObject([ - { cmd: 'docker pull renovate/sidecar' }, + { cmd: 'docker pull containerbase/sidecar' }, { cmd: 'docker ps --filter name=renovate_sidecar -aq' }, { cmd: @@ -278,7 +278,7 @@ describe('modules/manager/nix/artifacts', () => { '-e BUILDPACK_CACHE_DIR ' + '-e CONTAINERBASE_CACHE_DIR ' + '-w "/tmp/github/some/repo" ' + - 'renovate/sidecar ' + + 'containerbase/sidecar ' + 'bash -l -c "' + 'install-tool nix 2.10.0 ' + '&& ' + diff --git a/lib/modules/manager/npm/post-update/lerna.spec.ts b/lib/modules/manager/npm/post-update/lerna.spec.ts index 40a219bd9bbde7..76e7eb405ee8c4 100644 --- a/lib/modules/manager/npm/post-update/lerna.spec.ts +++ b/lib/modules/manager/npm/post-update/lerna.spec.ts @@ -144,7 +144,7 @@ describe('modules/manager/npm/post-update/lerna', () => { ); expect(execSnapshots).toMatchObject([ { - cmd: 'docker pull renovate/sidecar', + cmd: 'docker pull containerbase/sidecar', }, { cmd: 'docker ps --filter name=renovate_sidecar -aq', @@ -155,7 +155,7 @@ describe('modules/manager/npm/post-update/lerna', () => { '-v "/tmp/cache":"/tmp/cache" ' + '-e BUILDPACK_CACHE_DIR ' + '-e CONTAINERBASE_CACHE_DIR ' + - '-w "some-dir" renovate/sidecar ' + + '-w "some-dir" containerbase/sidecar ' + 'bash -l -c "' + 'install-tool node 16.16.0 ' + '&& ' + diff --git a/lib/modules/manager/npm/post-update/npm.spec.ts b/lib/modules/manager/npm/post-update/npm.spec.ts index 73703f8ef0f92b..3ecda1373e87a0 100644 --- a/lib/modules/manager/npm/post-update/npm.spec.ts +++ b/lib/modules/manager/npm/post-update/npm.spec.ts @@ -258,7 +258,7 @@ describe('modules/manager/npm/post-update/npm', () => { expect(fs.readLocalFile).toHaveBeenCalledTimes(1); expect(res.lockFile).toBe('package-lock-contents'); expect(execSnapshots).toMatchObject([ - { cmd: 'docker pull renovate/sidecar' }, + { cmd: 'docker pull containerbase/sidecar' }, { cmd: 'docker ps --filter name=renovate_sidecar -aq' }, { cmd: @@ -267,7 +267,7 @@ describe('modules/manager/npm/post-update/npm', () => { '-e BUILDPACK_CACHE_DIR ' + '-e CONTAINERBASE_CACHE_DIR ' + '-w "some-dir" ' + - 'renovate/sidecar ' + + 'containerbase/sidecar ' + 'bash -l -c "' + 'install-tool node 16.16.0 ' + '&& ' + diff --git a/lib/modules/manager/npm/post-update/pnpm.spec.ts b/lib/modules/manager/npm/post-update/pnpm.spec.ts index 8f5091329b7dfe..c2625d9dafe5a3 100644 --- a/lib/modules/manager/npm/post-update/pnpm.spec.ts +++ b/lib/modules/manager/npm/post-update/pnpm.spec.ts @@ -223,7 +223,7 @@ describe('modules/manager/npm/post-update/pnpm', () => { expect(fs.readLocalFile).toHaveBeenCalledTimes(1); expect(res.lockFile).toBe('package-lock-contents'); expect(execSnapshots).toMatchObject([ - { cmd: 'docker pull renovate/sidecar' }, + { cmd: 'docker pull containerbase/sidecar' }, { cmd: 'docker ps --filter name=renovate_sidecar -aq' }, { cmd: @@ -232,7 +232,7 @@ describe('modules/manager/npm/post-update/pnpm', () => { '-e BUILDPACK_CACHE_DIR ' + '-e CONTAINERBASE_CACHE_DIR ' + '-w "some-dir" ' + - 'renovate/sidecar ' + + 'containerbase/sidecar ' + 'bash -l -c "' + 'install-tool node 16.16.0 ' + '&& install-tool pnpm 6.0.0 ' + diff --git a/lib/modules/manager/npm/post-update/yarn.spec.ts b/lib/modules/manager/npm/post-update/yarn.spec.ts index 43c775685d250b..3a525661942559 100644 --- a/lib/modules/manager/npm/post-update/yarn.spec.ts +++ b/lib/modules/manager/npm/post-update/yarn.spec.ts @@ -555,10 +555,10 @@ describe('modules/manager/npm/post-update/yarn', () => { expect(res.lockFile).toBe(plocktest1YarnLockV1); const options = { encoding: 'utf-8' }; expect(execSnapshots).toMatchObject([ - { cmd: 'docker pull renovate/sidecar', options }, + { cmd: 'docker pull containerbase/sidecar', options }, { cmd: - `docker run --rm --name=renovate_sidecar --label=renovate_child -v ".":"." -v "/tmp/cache":"/tmp/cache" -e CI -e BUILDPACK_CACHE_DIR -e CONTAINERBASE_CACHE_DIR -w "some-dir" renovate/sidecar ` + + `docker run --rm --name=renovate_sidecar --label=renovate_child -v ".":"." -v "/tmp/cache":"/tmp/cache" -e CI -e BUILDPACK_CACHE_DIR -e CONTAINERBASE_CACHE_DIR -w "some-dir" containerbase/sidecar ` + `bash -l -c "` + `install-tool node 16.16.0` + ` && ` + diff --git a/lib/modules/manager/nuget/artifacts.spec.ts b/lib/modules/manager/nuget/artifacts.spec.ts index aa22079b096e2c..ac0bc96f93886b 100644 --- a/lib/modules/manager/nuget/artifacts.spec.ts +++ b/lib/modules/manager/nuget/artifacts.spec.ts @@ -248,7 +248,7 @@ describe('modules/manager/nuget/artifacts', () => { ]); expect(execSnapshots).toMatchObject([ { - cmd: 'docker pull renovate/sidecar', + cmd: 'docker pull containerbase/sidecar', }, { cmd: 'docker ps --filter name=renovate_sidecar -aq', @@ -263,7 +263,7 @@ describe('modules/manager/nuget/artifacts', () => { '-e BUILDPACK_CACHE_DIR ' + '-e CONTAINERBASE_CACHE_DIR ' + '-w "/tmp/github/some/repo" ' + - 'renovate/sidecar ' + + 'containerbase/sidecar ' + 'bash -l -c "' + 'install-tool dotnet 7.0.100' + ' && ' + diff --git a/lib/modules/manager/pip-compile/artifacts.spec.ts b/lib/modules/manager/pip-compile/artifacts.spec.ts index c55714dda42a41..94c8463f29e48d 100644 --- a/lib/modules/manager/pip-compile/artifacts.spec.ts +++ b/lib/modules/manager/pip-compile/artifacts.spec.ts @@ -114,7 +114,7 @@ describe('modules/manager/pip-compile/artifacts', () => { ).not.toBeNull(); expect(execSnapshots).toMatchObject([ - { cmd: 'docker pull renovate/sidecar' }, + { cmd: 'docker pull containerbase/sidecar' }, { cmd: 'docker ps --filter name=renovate_sidecar -aq' }, { cmd: @@ -125,7 +125,7 @@ describe('modules/manager/pip-compile/artifacts', () => { '-e BUILDPACK_CACHE_DIR ' + '-e CONTAINERBASE_CACHE_DIR ' + '-w "/tmp/github/some/repo" ' + - 'renovate/sidecar ' + + 'containerbase/sidecar ' + 'bash -l -c "' + 'install-tool python 3.10.2 ' + '&& ' + @@ -231,7 +231,7 @@ describe('modules/manager/pip-compile/artifacts', () => { ).not.toBeNull(); expect(execSnapshots).toMatchObject([ - { cmd: 'docker pull renovate/sidecar' }, + { cmd: 'docker pull containerbase/sidecar' }, { cmd: 'docker ps --filter name=renovate_sidecar -aq' }, { cmd: @@ -242,7 +242,7 @@ describe('modules/manager/pip-compile/artifacts', () => { '-e BUILDPACK_CACHE_DIR ' + '-e CONTAINERBASE_CACHE_DIR ' + '-w "/tmp/github/some/repo" ' + - 'renovate/sidecar ' + + 'containerbase/sidecar ' + 'bash -l -c "' + 'install-tool python 3.10.2 ' + '&& ' + diff --git a/lib/modules/manager/pip_requirements/artifacts.spec.ts b/lib/modules/manager/pip_requirements/artifacts.spec.ts index 1031300d02734d..69e2152cea29b2 100644 --- a/lib/modules/manager/pip_requirements/artifacts.spec.ts +++ b/lib/modules/manager/pip_requirements/artifacts.spec.ts @@ -207,7 +207,7 @@ describe('modules/manager/pip_requirements/artifacts', () => { ]); expect(execSnapshots).toMatchObject([ - { cmd: 'docker pull renovate/sidecar' }, + { cmd: 'docker pull containerbase/sidecar' }, { cmd: 'docker ps --filter name=renovate_sidecar -aq' }, { cmd: @@ -218,7 +218,7 @@ describe('modules/manager/pip_requirements/artifacts', () => { '-e BUILDPACK_CACHE_DIR ' + '-e CONTAINERBASE_CACHE_DIR ' + '-w "/tmp/github/some/repo" ' + - 'renovate/sidecar ' + + 'containerbase/sidecar ' + 'bash -l -c "' + 'install-tool python 3.10.2 ' + '&& ' + diff --git a/lib/modules/manager/pipenv/__snapshots__/artifacts.spec.ts.snap b/lib/modules/manager/pipenv/__snapshots__/artifacts.spec.ts.snap index 231d1d43302a11..81581b65c5806e 100644 --- a/lib/modules/manager/pipenv/__snapshots__/artifacts.spec.ts.snap +++ b/lib/modules/manager/pipenv/__snapshots__/artifacts.spec.ts.snap @@ -99,7 +99,7 @@ exports[`modules/manager/pipenv/artifacts returns updated Pipfile.lock 1`] = ` exports[`modules/manager/pipenv/artifacts supports docker mode 1`] = ` [ { - "cmd": "docker pull renovate/sidecar", + "cmd": "docker pull containerbase/sidecar", "options": { "encoding": "utf-8", }, @@ -111,7 +111,7 @@ exports[`modules/manager/pipenv/artifacts supports docker mode 1`] = ` }, }, { - "cmd": "docker run --rm --name=renovate_sidecar --label=renovate_child -v "/tmp/github/some/repo":"/tmp/github/some/repo" -v "/tmp/renovate/cache":"/tmp/renovate/cache" -e PIPENV_CACHE_DIR -e PIP_CACHE_DIR -e BUILDPACK_CACHE_DIR -e CONTAINERBASE_CACHE_DIR -w "/tmp/github/some/repo" renovate/sidecar bash -l -c "install-tool python 3.7.6 && pip install --user pipenv && pipenv lock"", + "cmd": "docker run --rm --name=renovate_sidecar --label=renovate_child -v "/tmp/github/some/repo":"/tmp/github/some/repo" -v "/tmp/renovate/cache":"/tmp/renovate/cache" -e PIPENV_CACHE_DIR -e PIP_CACHE_DIR -e BUILDPACK_CACHE_DIR -e CONTAINERBASE_CACHE_DIR -w "/tmp/github/some/repo" containerbase/sidecar bash -l -c "install-tool python 3.7.6 && pip install --user pipenv && pipenv lock"", "options": { "cwd": "/tmp/github/some/repo", "encoding": "utf-8", @@ -138,7 +138,7 @@ exports[`modules/manager/pipenv/artifacts supports docker mode 1`] = ` exports[`modules/manager/pipenv/artifacts uses pipenv version from Pipfile 1`] = ` [ { - "cmd": "docker pull renovate/sidecar", + "cmd": "docker pull containerbase/sidecar", "options": { "encoding": "utf-8", }, @@ -150,7 +150,7 @@ exports[`modules/manager/pipenv/artifacts uses pipenv version from Pipfile 1`] = }, }, { - "cmd": "docker run --rm --name=renovate_sidecar --label=renovate_child -v "/tmp/github/some/repo":"/tmp/github/some/repo" -v "/tmp/renovate/cache":"/tmp/renovate/cache" -e PIPENV_CACHE_DIR -e BUILDPACK_CACHE_DIR -e CONTAINERBASE_CACHE_DIR -w "/tmp/github/some/repo" renovate/sidecar bash -l -c "install-tool python 3.10.2 && pip install --user pipenv==2020.8.13 && pipenv lock"", + "cmd": "docker run --rm --name=renovate_sidecar --label=renovate_child -v "/tmp/github/some/repo":"/tmp/github/some/repo" -v "/tmp/renovate/cache":"/tmp/renovate/cache" -e PIPENV_CACHE_DIR -e BUILDPACK_CACHE_DIR -e CONTAINERBASE_CACHE_DIR -w "/tmp/github/some/repo" containerbase/sidecar bash -l -c "install-tool python 3.10.2 && pip install --user pipenv==2020.8.13 && pipenv lock"", "options": { "cwd": "/tmp/github/some/repo", "encoding": "utf-8", @@ -176,7 +176,7 @@ exports[`modules/manager/pipenv/artifacts uses pipenv version from Pipfile 1`] = exports[`modules/manager/pipenv/artifacts uses pipenv version from Pipfile dev packages 1`] = ` [ { - "cmd": "docker pull renovate/sidecar", + "cmd": "docker pull containerbase/sidecar", "options": { "encoding": "utf-8", }, @@ -188,7 +188,7 @@ exports[`modules/manager/pipenv/artifacts uses pipenv version from Pipfile dev p }, }, { - "cmd": "docker run --rm --name=renovate_sidecar --label=renovate_child -v "/tmp/github/some/repo":"/tmp/github/some/repo" -v "/tmp/renovate/cache":"/tmp/renovate/cache" -e PIPENV_CACHE_DIR -e BUILDPACK_CACHE_DIR -e CONTAINERBASE_CACHE_DIR -w "/tmp/github/some/repo" renovate/sidecar bash -l -c "install-tool python 3.10.2 && pip install --user pipenv==2020.8.13 && pipenv lock"", + "cmd": "docker run --rm --name=renovate_sidecar --label=renovate_child -v "/tmp/github/some/repo":"/tmp/github/some/repo" -v "/tmp/renovate/cache":"/tmp/renovate/cache" -e PIPENV_CACHE_DIR -e BUILDPACK_CACHE_DIR -e CONTAINERBASE_CACHE_DIR -w "/tmp/github/some/repo" containerbase/sidecar bash -l -c "install-tool python 3.10.2 && pip install --user pipenv==2020.8.13 && pipenv lock"", "options": { "cwd": "/tmp/github/some/repo", "encoding": "utf-8", @@ -214,7 +214,7 @@ exports[`modules/manager/pipenv/artifacts uses pipenv version from Pipfile dev p exports[`modules/manager/pipenv/artifacts uses pipenv version from config 1`] = ` [ { - "cmd": "docker pull renovate/sidecar", + "cmd": "docker pull containerbase/sidecar", "options": { "encoding": "utf-8", }, @@ -226,7 +226,7 @@ exports[`modules/manager/pipenv/artifacts uses pipenv version from config 1`] = }, }, { - "cmd": "docker run --rm --name=renovate_sidecar --label=renovate_child -v "/tmp/github/some/repo":"/tmp/github/some/repo" -v "/tmp/renovate/cache":"/tmp/renovate/cache" -e PIPENV_CACHE_DIR -e BUILDPACK_CACHE_DIR -e CONTAINERBASE_CACHE_DIR -w "/tmp/github/some/repo" renovate/sidecar bash -l -c "install-tool python 3.10.2 && pip install --user pipenv==2020.1.1 && pipenv lock"", + "cmd": "docker run --rm --name=renovate_sidecar --label=renovate_child -v "/tmp/github/some/repo":"/tmp/github/some/repo" -v "/tmp/renovate/cache":"/tmp/renovate/cache" -e PIPENV_CACHE_DIR -e BUILDPACK_CACHE_DIR -e CONTAINERBASE_CACHE_DIR -w "/tmp/github/some/repo" containerbase/sidecar bash -l -c "install-tool python 3.10.2 && pip install --user pipenv==2020.1.1 && pipenv lock"", "options": { "cwd": "/tmp/github/some/repo", "encoding": "utf-8", diff --git a/lib/modules/manager/poetry/artifacts.spec.ts b/lib/modules/manager/poetry/artifacts.spec.ts index 7ca281a043d5cc..733d5ad9870bdc 100644 --- a/lib/modules/manager/poetry/artifacts.spec.ts +++ b/lib/modules/manager/poetry/artifacts.spec.ts @@ -267,7 +267,7 @@ describe('modules/manager/poetry/artifacts', () => { }, ]); expect(execSnapshots).toMatchObject([ - { cmd: 'docker pull renovate/sidecar' }, + { cmd: 'docker pull containerbase/sidecar' }, { cmd: 'docker ps --filter name=renovate_sidecar -aq' }, { cmd: @@ -278,7 +278,7 @@ describe('modules/manager/poetry/artifacts', () => { '-e BUILDPACK_CACHE_DIR ' + '-e CONTAINERBASE_CACHE_DIR ' + '-w "/tmp/github/some/repo" ' + - 'renovate/sidecar ' + + 'containerbase/sidecar ' + 'bash -l -c "' + 'install-tool python 3.4.2 ' + '&& ' + @@ -330,7 +330,7 @@ describe('modules/manager/poetry/artifacts', () => { }, ]); expect(execSnapshots).toMatchObject([ - { cmd: 'docker pull renovate/sidecar' }, + { cmd: 'docker pull containerbase/sidecar' }, { cmd: 'docker ps --filter name=renovate_sidecar -aq' }, { cmd: @@ -341,7 +341,7 @@ describe('modules/manager/poetry/artifacts', () => { '-e BUILDPACK_CACHE_DIR ' + '-e CONTAINERBASE_CACHE_DIR ' + '-w "/tmp/github/some/repo" ' + - 'renovate/sidecar ' + + 'containerbase/sidecar ' + 'bash -l -c "' + 'install-tool python 2.7.5 ' + '&& ' + diff --git a/lib/modules/manager/pub/artifacts.spec.ts b/lib/modules/manager/pub/artifacts.spec.ts index 857f67cd3d850d..af46405b091b6e 100644 --- a/lib/modules/manager/pub/artifacts.spec.ts +++ b/lib/modules/manager/pub/artifacts.spec.ts @@ -162,7 +162,7 @@ describe('modules/manager/pub/artifacts', () => { ]); expect(execSnapshots).toMatchObject([ { - cmd: 'docker pull renovate/sidecar', + cmd: 'docker pull containerbase/sidecar', }, { cmd: 'docker ps --filter name=renovate_sidecar -aq', @@ -175,7 +175,7 @@ describe('modules/manager/pub/artifacts', () => { '-e BUILDPACK_CACHE_DIR ' + '-e CONTAINERBASE_CACHE_DIR ' + '-w "/tmp/github/some/repo" ' + - 'renovate/sidecar ' + + 'containerbase/sidecar ' + 'bash -l -c "' + `install-tool ${params.sdk} 3.3.9` + ' && ' + diff --git a/lib/util/exec/docker/index.spec.ts b/lib/util/exec/docker/index.spec.ts index 8231750f0d7a24..cdbfade27138d0 100644 --- a/lib/util/exec/docker/index.spec.ts +++ b/lib/util/exec/docker/index.spec.ts @@ -216,7 +216,7 @@ describe('util/exec/docker/index', () => { (vol ? `${vol} ` : '') + `-e FOO -e BAR ` + `-w "/tmp/foobar" ` + - `renovate/${img} ` + + `containerbase/${img} ` + `bash -l -c "foo && bar"`; beforeEach(() => { diff --git a/lib/util/exec/docker/index.ts b/lib/util/exec/docker/index.ts index d980793c2e3879..291a97523a9a90 100644 --- a/lib/util/exec/docker/index.ts +++ b/lib/util/exec/docker/index.ts @@ -259,7 +259,9 @@ export async function generateDockerCommand( result.push(`-w "${cwd}"`); } - image = `${ensureTrailingSlash(dockerImagePrefix ?? 'renovate')}${image}`; + image = `${ensureTrailingSlash( + dockerImagePrefix ?? 'containerbase' + )}${image}`; // TODO: add constraint: const tag = getDockerTag(image, sideCarImageVersion, 'semver'); logger.debug( diff --git a/lib/util/exec/index.spec.ts b/lib/util/exec/index.spec.ts index 03f36081d68b88..909880e061ad0e 100644 --- a/lib/util/exec/index.spec.ts +++ b/lib/util/exec/index.spec.ts @@ -54,7 +54,7 @@ describe('util/exec/index', () => { }); const image = dockerModule.sideCarImage; - const fullImage = `renovate/${image}`; + const fullImage = `containerbase/${image}`; const name = `renovate_${image}`; const inCmd = 'echo hello'; const outCmd = ['echo hello']; @@ -397,9 +397,9 @@ describe('util/exec/index', () => { inCmd, inOpts: { docker }, outCmd: [ - `docker pull ghcr.io/renovatebot/${image}`, + `docker pull ghcr.io/containerbase/${image}`, dockerRemoveCmd, - `docker run --rm --name=${name} --label=renovate_child ${defaultVolumes} -e BUILDPACK_CACHE_DIR -e CONTAINERBASE_CACHE_DIR -w "${cwd}" ghcr.io/renovatebot/${image} bash -l -c "${inCmd}"`, + `docker run --rm --name=${name} --label=renovate_child ${defaultVolumes} -e BUILDPACK_CACHE_DIR -e CONTAINERBASE_CACHE_DIR -w "${cwd}" ghcr.io/containerbase/${image} bash -l -c "${inCmd}"`, ], outOpts: [ dockerPullOpts, @@ -413,7 +413,7 @@ describe('util/exec/index', () => { }, ], adminConfig: { - dockerImagePrefix: 'ghcr.io/renovatebot', + dockerImagePrefix: 'ghcr.io/containerbase', binarySource: 'docker', }, }, @@ -792,17 +792,17 @@ describe('util/exec/index', () => { expect(actualCmd).toEqual([ `echo hello`, `echo hello`, - `docker pull renovate/${image}`, + `docker pull ${fullImage}`, `docker ps --filter name=renovate_${image} -aq`, - `docker run --rm --name=renovate_${image} --label=renovate_child ${defaultCacheVolume} -e BUILDPACK_CACHE_DIR -e CONTAINERBASE_CACHE_DIR renovate/${image} bash -l -c "echo hello"`, + `docker run --rm --name=renovate_${image} --label=renovate_child ${defaultCacheVolume} -e BUILDPACK_CACHE_DIR -e CONTAINERBASE_CACHE_DIR ${fullImage} bash -l -c "echo hello"`, `docker ps --filter name=renovate_${image} -aq`, - `docker run --rm --name=renovate_${image} --label=renovate_child ${defaultCacheVolume} -e BUILDPACK_CACHE_DIR -e CONTAINERBASE_CACHE_DIR renovate/${image} bash -l -c "echo hello"`, + `docker run --rm --name=renovate_${image} --label=renovate_child ${defaultCacheVolume} -e BUILDPACK_CACHE_DIR -e CONTAINERBASE_CACHE_DIR ${fullImage} bash -l -c "echo hello"`, `echo hello`, `echo hello`, `docker ps --filter name=renovate_${image} -aq`, - `docker run --rm --name=renovate_${image} --label=renovate_child ${defaultCacheVolume} -e BUILDPACK_CACHE_DIR -e CONTAINERBASE_CACHE_DIR renovate/${image} bash -l -c "echo hello"`, + `docker run --rm --name=renovate_${image} --label=renovate_child ${defaultCacheVolume} -e BUILDPACK_CACHE_DIR -e CONTAINERBASE_CACHE_DIR ${fullImage} bash -l -c "echo hello"`, `docker ps --filter name=renovate_${image} -aq`, - `docker run --rm --name=renovate_${image} --label=renovate_child ${defaultCacheVolume} -e BUILDPACK_CACHE_DIR -e CONTAINERBASE_CACHE_DIR renovate/${image} bash -l -c "echo hello"`, + `docker run --rm --name=renovate_${image} --label=renovate_child ${defaultCacheVolume} -e BUILDPACK_CACHE_DIR -e CONTAINERBASE_CACHE_DIR ${fullImage} bash -l -c "echo hello"`, ]); }); From 3a7597b0e3fa6473af363f3fa20452550afcbea0 Mon Sep 17 00:00:00 2001 From: Rhys Arkins Date: Sat, 11 Feb 2023 08:21:27 +0100 Subject: [PATCH 09/16] chore: fix artifacts tests --- lib/modules/manager/gomod/artifacts.spec.ts | 8 ++++---- lib/modules/manager/helmfile/artifacts.spec.ts | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/modules/manager/gomod/artifacts.spec.ts b/lib/modules/manager/gomod/artifacts.spec.ts index 9d3d392ec2905b..2f982a5a90a01b 100644 --- a/lib/modules/manager/gomod/artifacts.spec.ts +++ b/lib/modules/manager/gomod/artifacts.spec.ts @@ -1110,7 +1110,7 @@ describe('modules/manager/gomod/artifacts', () => { { file: { contents: 'New go.sum 2', path: 'go.mod', type: 'addition' } }, ]); expect(execSnapshots).toMatchObject([ - { cmd: 'docker pull renovate/sidecar' }, + { cmd: 'docker pull containerbase/sidecar' }, {}, { cmd: @@ -1127,7 +1127,7 @@ describe('modules/manager/gomod/artifacts', () => { '-e BUILDPACK_CACHE_DIR ' + '-e CONTAINERBASE_CACHE_DIR ' + '-w "/tmp/github/some/repo" ' + - 'renovate/sidecar' + + 'containerbase/sidecar' + ' bash -l -c "' + 'install-tool golang 1.14.0' + ' && ' + @@ -1175,7 +1175,7 @@ describe('modules/manager/gomod/artifacts', () => { { file: { contents: 'New go.sum 2', path: 'go.mod', type: 'addition' } }, ]); expect(execSnapshots).toMatchObject([ - { cmd: 'docker pull renovate/sidecar' }, + { cmd: 'docker pull containerbase/sidecar' }, {}, { cmd: @@ -1192,7 +1192,7 @@ describe('modules/manager/gomod/artifacts', () => { '-e BUILDPACK_CACHE_DIR ' + '-e CONTAINERBASE_CACHE_DIR ' + '-w "/tmp/github/some/repo" ' + - 'renovate/sidecar' + + 'containerbase/sidecar' + ' bash -l -c "' + 'install-tool golang 1.14.0' + ' && ' + diff --git a/lib/modules/manager/helmfile/artifacts.spec.ts b/lib/modules/manager/helmfile/artifacts.spec.ts index 9c699bcfbbf9e0..d2213cbb15902a 100644 --- a/lib/modules/manager/helmfile/artifacts.spec.ts +++ b/lib/modules/manager/helmfile/artifacts.spec.ts @@ -155,7 +155,7 @@ describe('modules/manager/helmfile/artifacts', () => { { binarySource: 'docker', expectedCommands: [ - { cmd: 'docker pull renovate/sidecar' }, + { cmd: 'docker pull containerbase/sidecar' }, { cmd: 'docker ps --filter name=renovate_sidecar -aq' }, { cmd: @@ -165,7 +165,7 @@ describe('modules/manager/helmfile/artifacts', () => { '-e BUILDPACK_CACHE_DIR ' + '-e CONTAINERBASE_CACHE_DIR ' + '-w "/tmp/github/some/repo" ' + - 'renovate/sidecar ' + + 'containerbase/sidecar ' + 'bash -l -c "' + 'install-tool helm v3.7.2' + ' && ' + From 9fbe4a218b21ff569349869b2d632c226cd756e8 Mon Sep 17 00:00:00 2001 From: Rhys Arkins Date: Mon, 20 Feb 2023 18:11:12 +0100 Subject: [PATCH 10/16] fix(versioning)!: bump short ranges to version (#20494) --- lib/modules/versioning/cargo/index.spec.ts | 6 ++--- lib/modules/versioning/composer/index.spec.ts | 2 +- lib/modules/versioning/helm/index.spec.ts | 10 ++++---- lib/modules/versioning/npm/index.spec.ts | 10 ++++---- lib/modules/versioning/npm/range.ts | 24 ------------------- lib/modules/versioning/poetry/index.spec.ts | 8 +++---- 6 files changed, 18 insertions(+), 42 deletions(-) diff --git a/lib/modules/versioning/cargo/index.spec.ts b/lib/modules/versioning/cargo/index.spec.ts index beb92118f248e0..c9cc7d47f098a8 100644 --- a/lib/modules/versioning/cargo/index.spec.ts +++ b/lib/modules/versioning/cargo/index.spec.ts @@ -111,11 +111,11 @@ describe('modules/versioning/cargo/index', () => { ${' = 1.0.0'} | ${'bump'} | ${'1.0.0'} | ${'1.1.0'} | ${'=1.1.0'} ${'= 1.0.0'} | ${'bump'} | ${'1.0.0'} | ${'1.1.0'} | ${'= 1.1.0'} ${'1.0.0'} | ${'bump'} | ${'1.0.0'} | ${'1.1.0'} | ${'1.1.0'} - ${'^1.0'} | ${'bump'} | ${'1.0.0'} | ${'1.0.7'} | ${'^1.0'} + ${'^1.0'} | ${'bump'} | ${'1.0.0'} | ${'1.0.7'} | ${'^1.0.7'} ${'^1.0.0'} | ${'replace'} | ${'1.0.0'} | ${'2.0.7'} | ${'^2.0.0'} ${'1.0.0'} | ${'replace'} | ${'1.0.0'} | ${'2.0.7'} | ${'2.0.0'} - ${'^1'} | ${'bump'} | ${'1.0.0'} | ${'2.1.7'} | ${'^2'} - ${'~1'} | ${'bump'} | ${'1.0.0'} | ${'1.1.7'} | ${'~1'} + ${'^1'} | ${'bump'} | ${'1.0.0'} | ${'2.1.7'} | ${'^2.1.7'} + ${'~1'} | ${'bump'} | ${'1.0.0'} | ${'1.1.7'} | ${'~1.1.7'} ${'5'} | ${'bump'} | ${'5.0.0'} | ${'5.1.7'} | ${'5'} ${'5'} | ${'bump'} | ${'5.0.0'} | ${'6.1.7'} | ${'6'} ${'5.0'} | ${'bump'} | ${'5.0.0'} | ${'5.0.7'} | ${'5.0'} diff --git a/lib/modules/versioning/composer/index.spec.ts b/lib/modules/versioning/composer/index.spec.ts index 21b03a642a03a6..8f4e30b9283f92 100644 --- a/lib/modules/versioning/composer/index.spec.ts +++ b/lib/modules/versioning/composer/index.spec.ts @@ -147,7 +147,7 @@ describe('modules/versioning/composer/index', () => { ${'~1.0 || >=3.0 <=4.0'} | ${'widen'} | ${'2.9.0'} | ${'5.0.0'} | ${'~1.0 || >=3.0 <=5.0'} ${'+4.0.0'} | ${'replace'} | ${'4.0.0'} | ${'4.2.0'} | ${'4.2.0'} ${'v4.0.0'} | ${'replace'} | ${'4.0.0'} | ${'4.2.0'} | ${'v4.2.0'} - ${'^v1.0'} | ${'bump'} | ${'1.0.0'} | ${'1.1.7'} | ${'^v1.1'} + ${'^v1.0'} | ${'bump'} | ${'1.0.0'} | ${'1.1.7'} | ${'^v1.1.7'} ${'^v1.0@beta'} | ${'bump'} | ${'1.0.0-beta3'} | ${'1.0.0-beta5'} | ${'^v1.0.0-beta5@beta'} ${'^v1.0@beta'} | ${'replace'} | ${'1.0.0-beta3'} | ${'2.0.0-beta5'} | ${'^v2.0.0-beta5@beta'} ${'^4.0@alpha'} | ${'replace'} | ${'4.0.0-alpha1'} | ${'4.0.0-beta5'} | ${'^4.0.0-beta5@alpha'} diff --git a/lib/modules/versioning/helm/index.spec.ts b/lib/modules/versioning/helm/index.spec.ts index 58584c94858622..1ef08aa9b16cfe 100644 --- a/lib/modules/versioning/helm/index.spec.ts +++ b/lib/modules/versioning/helm/index.spec.ts @@ -34,13 +34,13 @@ describe('modules/versioning/helm/index', () => { test.each` currentValue | rangeStrategy | currentVersion | newVersion | expected ${'=1.0.0'} | ${'bump'} | ${'1.0.0'} | ${'1.1.0'} | ${'=1.1.0'} - ${'^1.0'} | ${'bump'} | ${'1.0.0'} | ${'1.0.7'} | ${'^1.0'} + ${'^1.0'} | ${'bump'} | ${'1.0.0'} | ${'1.0.7'} | ${'^1.0.7'} ${'^1'} | ${'bump'} | ${'1.0.0'} | ${'1.0.7-prerelease.1'} | ${'^1.0.7-prerelease.1'} - ${'^1.0'} | ${'bump'} | ${'1.0.0'} | ${'1.1.7'} | ${'^1.1'} - ${'~1.0'} | ${'bump'} | ${'1.0.0'} | ${'1.1.7'} | ${'~1.1'} + ${'^1.0'} | ${'bump'} | ${'1.0.0'} | ${'1.1.7'} | ${'^1.1.7'} + ${'~1.0'} | ${'bump'} | ${'1.0.0'} | ${'1.1.7'} | ${'~1.1.7'} ${'~1.0'} | ${'bump'} | ${'1.0.0'} | ${'1.0.7-prerelease.1'} | ${'~1.0.7-prerelease.1'} - ${'^1'} | ${'bump'} | ${'1.0.0'} | ${'2.1.7'} | ${'^2'} - ${'~1'} | ${'bump'} | ${'1.0.0'} | ${'1.1.7'} | ${'~1'} + ${'^1'} | ${'bump'} | ${'1.0.0'} | ${'2.1.7'} | ${'^2.1.7'} + ${'~1'} | ${'bump'} | ${'1.0.0'} | ${'1.1.7'} | ${'~1.1.7'} ${'5'} | ${'bump'} | ${'5.0.0'} | ${'5.1.7'} | ${'5'} ${'5'} | ${'bump'} | ${'5.0.0'} | ${'6.1.7'} | ${'6'} ${'5.0'} | ${'bump'} | ${'5.0.0'} | ${'5.0.7'} | ${'5.0'} diff --git a/lib/modules/versioning/npm/index.spec.ts b/lib/modules/versioning/npm/index.spec.ts index 8330064d653422..20dedb0f82616c 100644 --- a/lib/modules/versioning/npm/index.spec.ts +++ b/lib/modules/versioning/npm/index.spec.ts @@ -58,14 +58,14 @@ describe('modules/versioning/npm/index', () => { test.each` currentValue | rangeStrategy | currentVersion | newVersion | expected ${'=1.0.0'} | ${'bump'} | ${'1.0.0'} | ${'1.1.0'} | ${'=1.1.0'} - ${'^1.0'} | ${'bump'} | ${'1.0.0'} | ${'1.0.7'} | ${'^1.0'} + ${'^1.0'} | ${'bump'} | ${'1.0.0'} | ${'1.0.7'} | ${'^1.0.7'} ${'^1'} | ${'bump'} | ${'1.0.0'} | ${'1.0.7-prerelease.1'} | ${'^1.0.7-prerelease.1'} ${'~> 1.0.0'} | ${'replace'} | ${'1.0.0'} | ${'1.1.7'} | ${'~> 1.1.0'} - ${'^1.0'} | ${'bump'} | ${'1.0.0'} | ${'1.1.7'} | ${'^1.1'} - ${'~1.0'} | ${'bump'} | ${'1.0.0'} | ${'1.1.7'} | ${'~1.1'} + ${'^1.0'} | ${'bump'} | ${'1.0.0'} | ${'1.1.7'} | ${'^1.1.7'} + ${'~1.0'} | ${'bump'} | ${'1.0.0'} | ${'1.1.7'} | ${'~1.1.7'} ${'~1.0'} | ${'bump'} | ${'1.0.0'} | ${'1.0.7-prerelease.1'} | ${'~1.0.7-prerelease.1'} - ${'^1'} | ${'bump'} | ${'1.0.0'} | ${'2.1.7'} | ${'^2'} - ${'~1'} | ${'bump'} | ${'1.0.0'} | ${'1.1.7'} | ${'~1'} + ${'^1'} | ${'bump'} | ${'1.0.0'} | ${'2.1.7'} | ${'^2.1.7'} + ${'~1'} | ${'bump'} | ${'1.0.0'} | ${'1.1.7'} | ${'~1.1.7'} ${'5'} | ${'bump'} | ${'5.0.0'} | ${'5.1.7'} | ${'5'} ${'5'} | ${'bump'} | ${'5.0.0'} | ${'6.1.7'} | ${'6'} ${'5.0'} | ${'bump'} | ${'5.0.0'} | ${'5.0.7'} | ${'5.0'} diff --git a/lib/modules/versioning/npm/range.ts b/lib/modules/versioning/npm/range.ts index 37140e3d9cce2f..f8c37b0157bb65 100644 --- a/lib/modules/versioning/npm/range.ts +++ b/lib/modules/versioning/npm/range.ts @@ -136,33 +136,9 @@ export function getNewValue({ }); } if (element.operator === '^') { - const split = currentValue.split('.'); - if (suffix.length) { - return `^${newVersion}`; - } - if (split.length === 1) { - // ^4 - return `^${toVersionMajor}`; - } - if (split.length === 2) { - // ^4.1 - return `^${toVersionMajor}.${toVersionMinor}`; - } return `^${newVersion}`; } if (element.operator === '~') { - const split = currentValue.split('.'); - if (suffix.length) { - return `~${newVersion}`; - } - if (split.length === 1) { - // ~4 - return `~${toVersionMajor}`; - } - if (split.length === 2) { - // ~4.1 - return `~${toVersionMajor}.${toVersionMinor}`; - } return `~${newVersion}`; } if (element.operator === '=') { diff --git a/lib/modules/versioning/poetry/index.spec.ts b/lib/modules/versioning/poetry/index.spec.ts index 7d919a24c6cbb2..d0c69c2c3e5417 100644 --- a/lib/modules/versioning/poetry/index.spec.ts +++ b/lib/modules/versioning/poetry/index.spec.ts @@ -189,15 +189,15 @@ describe('modules/versioning/poetry/index', () => { ${' = 1.0.0'} | ${'bump'} | ${'1.0.0'} | ${'1.1.0'} | ${'=1.1.0'} ${' = 1.0.0'} | ${'bump'} | ${'1.0.0'} | ${'1.1.0'} | ${'=1.1.0'} ${'= 1.0.0'} | ${'bump'} | ${'1.0.0'} | ${'1.1.0'} | ${'=1.1.0'} - ${'^1.0'} | ${'bump'} | ${'1.0.0'} | ${'1.0.7'} | ${'^1.0'} + ${'^1.0'} | ${'bump'} | ${'1.0.0'} | ${'1.0.7'} | ${'^1.0.7'} ${'^1.0.0'} | ${'replace'} | ${'1.0.0'} | ${'2.0.7'} | ${'^2.0.0'} ${'^5.0.3'} | ${'replace'} | ${'5.3.1'} | ${'5.5'} | ${'^5.0.3'} ${'1.0.0'} | ${'replace'} | ${'1.0.0'} | ${'2.0.7'} | ${'2.0.7'} ${'^1.0.0'} | ${'replace'} | ${'1.0.0'} | ${'2.0.7'} | ${'^2.0.0'} ${'^0.5.15'} | ${'replace'} | ${'0.5.15'} | ${'0.6'} | ${'^0.5.15'} ${'^0.5.15'} | ${'replace'} | ${'0.5.15'} | ${'0.6b.4'} | ${'^0.5.15'} - ${'^1'} | ${'bump'} | ${'1.0.0'} | ${'2.1.7'} | ${'^2'} - ${'~1'} | ${'bump'} | ${'1.0.0'} | ${'1.1.7'} | ${'~1'} + ${'^1'} | ${'bump'} | ${'1.0.0'} | ${'2.1.7'} | ${'^2.1.7'} + ${'~1'} | ${'bump'} | ${'1.0.0'} | ${'1.1.7'} | ${'~1.1.7'} ${'5'} | ${'bump'} | ${'5.0.0'} | ${'5.1.7'} | ${'5'} ${'5'} | ${'bump'} | ${'5.0.0'} | ${'6.1.7'} | ${'6'} ${'5.0'} | ${'bump'} | ${'5.0.0'} | ${'5.0.7'} | ${'5.0'} @@ -211,7 +211,7 @@ describe('modules/versioning/poetry/index', () => { ${'^0.8.0-alpha.0'} | ${'bump'} | ${'0.8.0-alpha.0'} | ${'0.8.0-alpha.1'} | ${'^0.8.0-alpha.1'} ${'^0.8.0-alpha.0'} | ${'bump'} | ${'0.8.0-alpha.0'} | ${'0.8.0a1'} | ${'^0.8.0-alpha.1'} ${'^1.0.0'} | ${'replace'} | ${'1.0.0'} | ${'1.2.3'} | ${'^1.0.0'} - ${'~1.0'} | ${'bump'} | ${'1.0.0'} | ${'1.1.7'} | ${'~1.1'} + ${'~1.0'} | ${'bump'} | ${'1.0.0'} | ${'1.1.7'} | ${'~1.1.7'} ${'1.0.*'} | ${'replace'} | ${'1.0.0'} | ${'1.1.0'} | ${'1.1.*'} ${'1.*'} | ${'replace'} | ${'1.0.0'} | ${'2.1.0'} | ${'2.*'} ${'~0.6.1'} | ${'replace'} | ${'0.6.8'} | ${'0.7.0-rc.2'} | ${'~0.7.0-rc'} From 05929423aaeedcc666ce21bf01b613786dc9645b Mon Sep 17 00:00:00 2001 From: Rhys Arkins Date: Tue, 21 Feb 2023 06:54:16 +0100 Subject: [PATCH 11/16] refactor!: use packageName and not depName for datasource lookups (#20474) --- .../datasource/artifactory/index.spec.ts | 4 +- lib/modules/datasource/artifactory/readme.md | 2 +- .../aws-machine-image/index.spec.ts | 18 +- lib/modules/datasource/aws-rds/index.spec.ts | 6 +- .../azure-pipelines-tasks/index.spec.ts | 8 +- .../datasource/bitbucket-tags/index.spec.ts | 8 +- lib/modules/datasource/cdnjs/index.spec.ts | 20 +- lib/modules/datasource/clojure/index.spec.ts | 4 +- lib/modules/datasource/common.ts | 2 +- lib/modules/datasource/conan/common.ts | 4 +- lib/modules/datasource/conan/index.spec.ts | 19 +- lib/modules/datasource/conan/index.ts | 24 +- lib/modules/datasource/conan/types.ts | 2 +- lib/modules/datasource/conda/index.spec.ts | 24 +- lib/modules/datasource/cpan/index.spec.ts | 10 +- lib/modules/datasource/crate/index.spec.ts | 40 +-- .../datasource/dart-version/index.spec.ts | 10 +- lib/modules/datasource/dart/index.spec.ts | 14 +- lib/modules/datasource/docker/index.spec.ts | 120 ++++----- .../datasource/dotnet-version/index.spec.ts | 18 +- .../datasource/flutter-version/index.spec.ts | 10 +- .../galaxy-collection/index.spec.ts | 20 +- lib/modules/datasource/galaxy/index.spec.ts | 18 +- lib/modules/datasource/git-refs/index.spec.ts | 10 +- lib/modules/datasource/git-refs/readme.md | 2 +- lib/modules/datasource/git-tags/index.spec.ts | 8 +- .../datasource/github-releases/index.spec.ts | 14 +- .../datasource/github-tags/index.spec.ts | 4 +- .../datasource/gitlab-packages/index.spec.ts | 8 +- .../datasource/gitlab-packages/readme.md | 2 +- .../datasource/gitlab-releases/index.spec.ts | 6 +- .../datasource/gitlab-releases/readme.md | 2 +- .../datasource/gitlab-tags/index.spec.ts | 14 +- lib/modules/datasource/gitlab-tags/readme.md | 2 +- .../datasource/golang-version/index.spec.ts | 20 +- .../datasource/gradle-version/index.spec.ts | 2 +- lib/modules/datasource/helm/index.spec.ts | 24 +- lib/modules/datasource/hex/index.spec.ts | 22 +- .../datasource/hexpm-bob/index.spec.ts | 18 +- lib/modules/datasource/index.spec.ts | 71 ++--- lib/modules/datasource/index.ts | 11 +- .../datasource/java-version/index.spec.ts | 18 +- .../datasource/jenkins-plugins/index.spec.ts | 4 +- .../datasource/kubernetes-api/index.spec.ts | 6 +- lib/modules/datasource/maven/index.spec.ts | 4 +- lib/modules/datasource/maven/s3.spec.ts | 4 +- lib/modules/datasource/node/index.spec.ts | 8 +- lib/modules/datasource/npm/index.spec.ts | 62 +++-- lib/modules/datasource/nuget/index.spec.ts | 16 +- lib/modules/datasource/orb/index.spec.ts | 12 +- .../datasource/packagist/index.spec.ts | 28 +- lib/modules/datasource/pod/index.spec.ts | 4 +- .../datasource/puppet-forge/index.spec.ts | 13 +- lib/modules/datasource/pypi/index.spec.ts | 54 ++-- lib/modules/datasource/repology/index.spec.ts | 36 +-- .../datasource/ruby-version/index.spec.ts | 6 +- lib/modules/datasource/rubygems/index.spec.ts | 2 +- .../datasource/sbt-package/index.spec.ts | 14 +- .../datasource/sbt-plugin/index.spec.ts | 10 +- .../datasource/terraform-module/index.spec.ts | 26 +- .../terraform-provider/index.spec.ts | 21 +- lib/modules/datasource/types.ts | 6 +- .../common/parent-version.ts | 10 +- .../manager/terraform/lockfile/index.ts | 2 +- lib/util/exec/containerbase.ts | 54 ++-- lib/util/exec/docker/index.ts | 12 +- lib/util/exec/types.ts | 2 +- .../process/__snapshots__/fetch.spec.ts.snap | 4 + lib/workers/repository/process/fetch.ts | 3 +- .../repository/process/lookup/index.spec.ts | 252 +++++++++--------- .../repository/process/lookup/index.ts | 32 +-- .../repository/process/lookup/types.ts | 2 +- .../update/pr/changelog/releases.spec.ts | 10 +- 73 files changed, 704 insertions(+), 678 deletions(-) diff --git a/lib/modules/datasource/artifactory/index.spec.ts b/lib/modules/datasource/artifactory/index.spec.ts index e0d6c1b9499e43..d84c402ef52403 100644 --- a/lib/modules/datasource/artifactory/index.spec.ts +++ b/lib/modules/datasource/artifactory/index.spec.ts @@ -12,7 +12,7 @@ const testRegistryUrl = 'https://jfrog.company.com/artifactory'; const testLookupName = 'project'; const testConfig = { registryUrls: [testRegistryUrl], - depName: testLookupName, + packageName: testLookupName, }; const fixtureReleasesAsFolders = Fixtures.get('releases-as-folders.html'); const fixtureReleasesAsFiles = Fixtures.get('releases-as-files.html'); @@ -70,7 +70,6 @@ describe('modules/datasource/artifactory/index', () => { .reply(200, '\n

Header

\n
1.3.0\n'); const res = await getPkgReleases({ registryUrls: [testRegistryUrl, secondRegistryUrl], - depName: testLookupName, datasource, packageName: testLookupName, }); @@ -81,7 +80,6 @@ describe('modules/datasource/artifactory/index', () => { it('returns null without registryUrl + warning', async () => { const res = await getPkgReleases({ datasource, - depName: testLookupName, packageName: testLookupName, }); expect(logger.warn).toHaveBeenCalledTimes(1); diff --git a/lib/modules/datasource/artifactory/readme.md b/lib/modules/datasource/artifactory/readme.md index 87b5342d66e82e..bebfc586c407bb 100644 --- a/lib/modules/datasource/artifactory/readme.md +++ b/lib/modules/datasource/artifactory/readme.md @@ -2,6 +2,6 @@ Artifactory is the recommended registry for Conan packages. This datasource returns releases from given custom `registryUrl`(s). -The target URL is composed by the `registryUrl` and the `packageName`, which defaults to `depName` when `packageName` is not defined. +The target URL is composed by the `registryUrl` and the `packageName`. The release timestamp is taken from the date in the directory listing, and is assumed to be in UTC time. diff --git a/lib/modules/datasource/aws-machine-image/index.spec.ts b/lib/modules/datasource/aws-machine-image/index.spec.ts index d3bca1ce1417f2..ff8f7aef304409 100644 --- a/lib/modules/datasource/aws-machine-image/index.spec.ts +++ b/lib/modules/datasource/aws-machine-image/index.spec.ts @@ -276,7 +276,7 @@ describe('modules/datasource/aws-machine-image/index', () => { mockDescribeImagesCommand(mockEmpty); const res = await getDigest({ datasource, - depName: + packageName: '[{"Name":"owner-id","Values":["602401143452"]},{"Name":"name","Values":["without newValue, without returned images to be null"]}]', }); expect(res).toBeNull(); @@ -286,7 +286,7 @@ describe('modules/datasource/aws-machine-image/index', () => { mockDescribeImagesCommand(mock1Image); const res = await getDigest({ datasource, - depName: + packageName: '[{"Name":"owner-id","Values":["602401143452"]},{"Name":"name","Values":["without newValue, with one matching image to return that image"]}]', }); expect(res).toStrictEqual(image3.Name); @@ -296,7 +296,7 @@ describe('modules/datasource/aws-machine-image/index', () => { mockDescribeImagesCommand(mock3Images); const res = await getDigest({ datasource, - depName: + packageName: '[{"Name":"owner-id","Values":["602401143452"]},{"Name":"name","Values":["without newValue, with 3 matching image to return the newest image"]}]', }); expect(res).toStrictEqual(image3.Name); @@ -307,7 +307,7 @@ describe('modules/datasource/aws-machine-image/index', () => { const res = await getDigest( { datasource, - depName: + packageName: '[{"Name":"owner-id","Values":["602401143452"]},{"Name":"name","Values":["with matching newValue, with 3 matching image to return the matching image"]}]', }, image1.ImageId @@ -320,7 +320,7 @@ describe('modules/datasource/aws-machine-image/index', () => { const res = await getDigest( { datasource, - depName: + packageName: '[{"Name":"owner-id","Values":["602401143452"]},{"Name":"name","Values":["with not matching newValue, with 3 matching images to return the matching image"]}]', }, 'will never match' @@ -334,7 +334,7 @@ describe('modules/datasource/aws-machine-image/index', () => { mockDescribeImagesCommand(mockEmpty); const res = await getPkgReleases({ datasource, - depName: + packageName: '[{"Name":"owner-id","Values":["602401143452"]},{"Name":"name","Values":["without returned images to be null"]}]', }); expect(res).toBeNull(); @@ -344,7 +344,7 @@ describe('modules/datasource/aws-machine-image/index', () => { mockDescribeImagesCommand(mock1Image); const res = await getPkgReleases({ datasource, - depName: + packageName: '[{"Name":"owner-id","Values":["602401143452"]},{"Name":"name","Values":["with one matching image to return that image"]}]', }); expect(res).toStrictEqual({ @@ -363,7 +363,7 @@ describe('modules/datasource/aws-machine-image/index', () => { mockDescribeImagesCommand({ Images: [image2] }); const res = await getPkgReleases({ datasource, - depName: + packageName: '[{"Name":"owner-id","Values":["602401143452"]},{"Name":"name","Values":["with one deprecated matching image to return that image"]}]', }); expect(res).toStrictEqual({ @@ -382,7 +382,7 @@ describe('modules/datasource/aws-machine-image/index', () => { mockDescribeImagesCommand(mock3Images); const res = await getPkgReleases({ datasource, - depName: + packageName: '[{"Name":"owner-id","Values":["602401143452"]},{"Name":"name","Values":["with 3 matching image to return the newest image"]}]', }); expect(res).toStrictEqual({ diff --git a/lib/modules/datasource/aws-rds/index.spec.ts b/lib/modules/datasource/aws-rds/index.spec.ts index fa94db92adcfe6..d0eda95cfac8ff 100644 --- a/lib/modules/datasource/aws-rds/index.spec.ts +++ b/lib/modules/datasource/aws-rds/index.spec.ts @@ -105,7 +105,7 @@ describe('modules/datasource/aws-rds/index', () => { }); const res = await getPkgReleases({ datasource: AwsRdsDataSource.id, - depName: '[{"Name":"engine","Values":["mysql"]}]', + packageName: '[{"Name":"engine","Values":["mysql"]}]', }); expect(res).toBeNull(); }); @@ -117,7 +117,7 @@ describe('modules/datasource/aws-rds/index', () => { }); const res = await getPkgReleases({ datasource: AwsRdsDataSource.id, - depName: '[{"Name":"engine","Values":["mysql"]}]', + packageName: '[{"Name":"engine","Values":["mysql"]}]', }); expect(res).toStrictEqual({ releases: [ @@ -136,7 +136,7 @@ describe('modules/datasource/aws-rds/index', () => { }); const res = await getPkgReleases({ datasource: AwsRdsDataSource.id, - depName: '[{"Name":"engine","Values":["mysql"]}]', + packageName: '[{"Name":"engine","Values":["mysql"]}]', }); expect(res).toStrictEqual({ releases: [ diff --git a/lib/modules/datasource/azure-pipelines-tasks/index.spec.ts b/lib/modules/datasource/azure-pipelines-tasks/index.spec.ts index 4b009a5ae85bfc..75d3b009e7932c 100644 --- a/lib/modules/datasource/azure-pipelines-tasks/index.spec.ts +++ b/lib/modules/datasource/azure-pipelines-tasks/index.spec.ts @@ -6,7 +6,7 @@ describe('modules/datasource/azure-pipelines-tasks/index', () => { expect( await getPkgReleases({ datasource: AzurePipelinesTasksDatasource.id, - depName: 'unknown', + packageName: 'unknown', }) ).toBeNull(); }); @@ -15,7 +15,7 @@ describe('modules/datasource/azure-pipelines-tasks/index', () => { expect( await getPkgReleases({ datasource: AzurePipelinesTasksDatasource.id, - depName: 'AutomatedAnalysis', + packageName: 'AutomatedAnalysis', }) ).toEqual({ releases: [{ version: '0.171.0' }, { version: '0.198.0' }] }); }); @@ -24,7 +24,7 @@ describe('modules/datasource/azure-pipelines-tasks/index', () => { expect( await getPkgReleases({ datasource: AzurePipelinesTasksDatasource.id, - depName: 'AutomatedAnalysis-Marketplace', + packageName: 'AutomatedAnalysis-Marketplace', }) ).toEqual({ releases: [{ version: '0.171.0' }, { version: '0.198.0' }] }); }); @@ -33,7 +33,7 @@ describe('modules/datasource/azure-pipelines-tasks/index', () => { expect( await getPkgReleases({ datasource: AzurePipelinesTasksDatasource.id, - depName: 'automatedanalysis', + packageName: 'automatedanalysis', }) ).toEqual({ releases: [{ version: '0.171.0' }, { version: '0.198.0' }] }); }); diff --git a/lib/modules/datasource/bitbucket-tags/index.spec.ts b/lib/modules/datasource/bitbucket-tags/index.spec.ts index 369f646c3cb170..79ac0913e9f30b 100644 --- a/lib/modules/datasource/bitbucket-tags/index.spec.ts +++ b/lib/modules/datasource/bitbucket-tags/index.spec.ts @@ -32,7 +32,7 @@ describe('modules/datasource/bitbucket-tags/index', () => { .reply(200, body); const res = await getPkgReleases({ datasource, - depName: 'some/dep2', + packageName: 'some/dep2', }); expect(res).toMatchSnapshot(); expect(res?.releases).toHaveLength(3); @@ -69,7 +69,7 @@ describe('modules/datasource/bitbucket-tags/index', () => { .reply(200, body); const res = await getDigest({ datasource, - depName: 'some/dep2', + packageName: 'some/dep2', }); expect(res).toMatchSnapshot(); expect(res).toBeString(); @@ -94,7 +94,7 @@ describe('modules/datasource/bitbucket-tags/index', () => { .reply(200, body); const res = await getDigest({ datasource, - depName: 'some/dep2', + packageName: 'some/dep2', }); expect(res).toBeNull(); }); @@ -116,7 +116,7 @@ describe('modules/datasource/bitbucket-tags/index', () => { const res = await getDigest( { datasource, - depName: 'some/dep2', + packageName: 'some/dep2', }, 'v1.0.0' ); diff --git a/lib/modules/datasource/cdnjs/index.spec.ts b/lib/modules/datasource/cdnjs/index.spec.ts index 922777da2e90a2..67b1945a07bfb1 100644 --- a/lib/modules/datasource/cdnjs/index.spec.ts +++ b/lib/modules/datasource/cdnjs/index.spec.ts @@ -18,7 +18,7 @@ describe('modules/datasource/cdnjs/index', () => { await expect( getPkgReleases({ datasource: CdnJsDatasource.id, - depName: 'foo/bar', + packageName: 'foo/bar', }) ).rejects.toThrow(EXTERNAL_HOST_ERROR); }); @@ -28,7 +28,7 @@ describe('modules/datasource/cdnjs/index', () => { await expect( getPkgReleases({ datasource: CdnJsDatasource.id, - depName: 'foo/bar', + packageName: 'foo/bar', }) ).rejects.toThrow(EXTERNAL_HOST_ERROR); }); @@ -38,7 +38,7 @@ describe('modules/datasource/cdnjs/index', () => { expect( await getPkgReleases({ datasource: CdnJsDatasource.id, - depName: 'foo/bar', + packageName: 'foo/bar', }) ).toBeNull(); }); @@ -51,7 +51,7 @@ describe('modules/datasource/cdnjs/index', () => { expect( await getPkgReleases({ datasource: CdnJsDatasource.id, - depName: 'doesnotexist/doesnotexist', + packageName: 'doesnotexist/doesnotexist', }) ).toBeNull(); }); @@ -61,7 +61,7 @@ describe('modules/datasource/cdnjs/index', () => { await expect( getPkgReleases({ datasource: CdnJsDatasource.id, - depName: 'foo/bar', + packageName: 'foo/bar', }) ).rejects.toThrow(EXTERNAL_HOST_ERROR); }); @@ -71,7 +71,7 @@ describe('modules/datasource/cdnjs/index', () => { await expect( getPkgReleases({ datasource: CdnJsDatasource.id, - depName: 'foo/bar', + packageName: 'foo/bar', }) ).rejects.toThrow(EXTERNAL_HOST_ERROR); }); @@ -81,7 +81,7 @@ describe('modules/datasource/cdnjs/index', () => { await expect( getPkgReleases({ datasource: CdnJsDatasource.id, - depName: 'foo/bar', + packageName: 'foo/bar', }) ).rejects.toThrow(EXTERNAL_HOST_ERROR); }); @@ -91,7 +91,7 @@ describe('modules/datasource/cdnjs/index', () => { await expect( getPkgReleases({ datasource: CdnJsDatasource.id, - depName: 'foo/bar', + packageName: 'foo/bar', }) ).rejects.toThrow(EXTERNAL_HOST_ERROR); }); @@ -103,7 +103,7 @@ describe('modules/datasource/cdnjs/index', () => { .reply(200, Fixtures.get('d3-force.json')); const res = await getPkgReleases({ datasource: CdnJsDatasource.id, - depName: 'd3-force/d3-force.js', + packageName: 'd3-force/d3-force.js', }); expect(res).toMatchSnapshot(); }); @@ -115,7 +115,7 @@ describe('modules/datasource/cdnjs/index', () => { .reply(200, Fixtures.get('bulma.json')); const res = await getPkgReleases({ datasource: CdnJsDatasource.id, - depName: 'bulma/only/0.7.5/style.css', + packageName: 'bulma/only/0.7.5/style.css', }); expect(res).toMatchSnapshot(); }); diff --git a/lib/modules/datasource/clojure/index.spec.ts b/lib/modules/datasource/clojure/index.spec.ts index 87b876cb4ef4d7..6e6fef32ebf9e2 100644 --- a/lib/modules/datasource/clojure/index.spec.ts +++ b/lib/modules/datasource/clojure/index.spec.ts @@ -144,10 +144,10 @@ function mockGenericPackage(opts: MockOpts = {}) { } } function get( - depName = 'org.example:package', + packageName = 'org.example:package', ...registryUrls: string[] ): Promise { - const conf = { versioning, datasource: ClojureDatasource.id, depName }; + const conf = { versioning, datasource: ClojureDatasource.id, packageName }; return getPkgReleases(registryUrls ? { ...conf, registryUrls } : conf); } diff --git a/lib/modules/datasource/common.ts b/lib/modules/datasource/common.ts index 69c68360b25a45..e02c77e620af85 100644 --- a/lib/modules/datasource/common.ts +++ b/lib/modules/datasource/common.ts @@ -5,6 +5,6 @@ export function isGetPkgReleasesConfig( ): input is GetPkgReleasesConfig { return ( (input as GetPkgReleasesConfig).datasource !== undefined && - (input as GetPkgReleasesConfig).depName !== undefined + (input as GetPkgReleasesConfig).packageName !== undefined ); } diff --git a/lib/modules/datasource/conan/common.ts b/lib/modules/datasource/conan/common.ts index 505aadb2c9669e..4758658f67b437 100644 --- a/lib/modules/datasource/conan/common.ts +++ b/lib/modules/datasource/conan/common.ts @@ -11,7 +11,7 @@ export const conanDatasourceRegex = regEx( ); export function getConanPackage(packageName: string): ConanPackage { - const depName = packageName.split('/')[0]; + const conanName = packageName.split('/')[0]; const userAndChannel = packageName.split('@')[1]; - return { depName, userAndChannel }; + return { conanName, userAndChannel }; } diff --git a/lib/modules/datasource/conan/index.spec.ts b/lib/modules/datasource/conan/index.spec.ts index 68fc393a514315..84c1a98c2fb56b 100644 --- a/lib/modules/datasource/conan/index.spec.ts +++ b/lib/modules/datasource/conan/index.spec.ts @@ -16,14 +16,14 @@ const datasource = ConanDatasource.id; const nonDefaultRegistryUrl = 'https://not.conan.io/'; const config: GetPkgReleasesConfig = { - depName: '', + packageName: '', datasource, versioning: conan.id, registryUrls: [nonDefaultRegistryUrl], }; const digestConfig: GetDigestInputConfig = { - depName: 'fake', + packageName: 'fake', datasource, registryUrls: [nonDefaultRegistryUrl], }; @@ -59,7 +59,6 @@ describe('modules/datasource/conan/index', () => { .scope(nonDefaultRegistryUrl) .get('/v2/conans/search?q=fakepackage') .reply(200); - config.depName = 'fakepackage'; expect( await getPkgReleases({ ...config, @@ -73,7 +72,6 @@ describe('modules/datasource/conan/index', () => { .scope(nonDefaultRegistryUrl) .get('/v2/conans/search?q=fakepackage') .reply(200, {}); - config.depName = 'fakepackage'; expect( await getPkgReleases({ ...config, @@ -88,7 +86,6 @@ describe('modules/datasource/conan/index', () => { .get('/v2/conans/search?q=poco') .reply(404); config.registryUrls = ['https://fake.bintray.com/']; - config.depName = 'poco'; expect( await getPkgReleases({ ...config, @@ -102,7 +99,6 @@ describe('modules/datasource/conan/index', () => { .scope(nonDefaultRegistryUrl) .get('/v2/conans/search?q=fakepackage') .reply(200, fakeJson); - config.depName = 'fakepackage'; expect( await getPkgReleases({ ...config, @@ -116,7 +112,6 @@ describe('modules/datasource/conan/index', () => { .scope(nonDefaultRegistryUrl) .get('/v2/conans/search?q=poco') .reply(200, pocoJson); - config.depName = 'poco'; expect( await getPkgReleases({ ...config, @@ -155,7 +150,6 @@ describe('modules/datasource/conan/index', () => { await getPkgReleases({ ...config, registryUrls: [defaultRegistryUrl], - depName: 'poco', packageName: 'poco/1.2@_/_', }) ).toEqual({ @@ -191,7 +185,6 @@ describe('modules/datasource/conan/index', () => { await getPkgReleases({ ...config, registryUrls: [defaultRegistryUrl], - depName: 'poco', packageName: 'poco/1.2@foo/bar', }) ).toBeNull(); @@ -202,7 +195,7 @@ describe('modules/datasource/conan/index', () => { .scope(nonDefaultRegistryUrl) .get('/v2/conans/search?q=poco') .reply(200, pocoJson); - config.depName = 'poco'; + config.packageName = 'poco'; expect( await getPkgReleases({ ...config, @@ -216,7 +209,7 @@ describe('modules/datasource/conan/index', () => { .scope(nonDefaultRegistryUrl) .get('/v2/conans/search?q=bad') .reply(200, malformedJson); - config.depName = 'bad'; + config.packageName = 'bad'; expect( await getPkgReleases({ ...config, @@ -238,7 +231,7 @@ describe('modules/datasource/conan/index', () => { .get('/v2/conans/search?q=poco') .replyWithError('error'); config.registryUrls = ['https://fake.bintray.com/']; - config.depName = 'poco'; + config.packageName = 'poco'; expect( await getPkgReleases({ ...config, @@ -253,7 +246,7 @@ describe('modules/datasource/conan/index', () => { .get('/v2/conans/search?q=poco') .reply(200, fakeJson); config.registryUrls = ['https://fake.bintray.com']; - config.depName = 'poco'; + config.packageName = 'poco'; expect( await getPkgReleases({ ...config, diff --git a/lib/modules/datasource/conan/index.ts b/lib/modules/datasource/conan/index.ts index 037062c1276140..c77dc6e8126049 100644 --- a/lib/modules/datasource/conan/index.ts +++ b/lib/modules/datasource/conan/index.ts @@ -36,17 +36,17 @@ export class ConanDatasource extends Datasource { } async getConanCenterReleases( - depName: string, + conanName: string, userAndChannel: string ): Promise { if (userAndChannel && userAndChannel !== '@_/_') { logger.debug( - { depName, userAndChannel }, + { conanName, userAndChannel }, 'User/channel not supported for Conan Center lookups' ); return null; } - const url = `https://api.github.com/repos/conan-io/conan-center-index/contents/recipes/${depName}/config.yml`; + const url = `https://api.github.com/repos/conan-io/conan-center-index/contents/recipes/${conanName}/config.yml`; const res = await this.githubHttp.get(url, { headers: { accept: 'application/vnd.github.v3.raw' }, }); @@ -78,7 +78,7 @@ export class ConanDatasource extends Datasource { const revisionLookUp = joinUrlParts( url, 'v2/conans/', - conanPackage.depName, + conanPackage.conanName, newValue, conanPackage.userAndChannel, '/revisions' @@ -102,19 +102,27 @@ export class ConanDatasource extends Datasource { packageName, }: GetReleasesConfig): Promise { const conanPackage = getConanPackage(packageName); - const depName = conanPackage.depName; const userAndChannel = '@' + conanPackage.userAndChannel; if ( is.string(registryUrl) && ensureTrailingSlash(registryUrl) === defaultRegistryUrl ) { - return this.getConanCenterReleases(depName, userAndChannel); + return this.getConanCenterReleases( + conanPackage.conanName, + userAndChannel + ); } - logger.trace({ depName, registryUrl }, 'Looking up conan api dependency'); + logger.trace( + { packageName, registryUrl }, + 'Looking up conan api dependency' + ); if (registryUrl) { const url = ensureTrailingSlash(registryUrl); - const lookupUrl = joinUrlParts(url, `v2/conans/search?q=${depName}`); + const lookupUrl = joinUrlParts( + url, + `v2/conans/search?q=${conanPackage.conanName}` + ); try { const rep = await this.http.getJson(lookupUrl); diff --git a/lib/modules/datasource/conan/types.ts b/lib/modules/datasource/conan/types.ts index 543ff3d6876386..854935c11c2d7b 100644 --- a/lib/modules/datasource/conan/types.ts +++ b/lib/modules/datasource/conan/types.ts @@ -16,6 +16,6 @@ export interface ConanYAML { } export interface ConanPackage { - depName: string; + conanName: string; userAndChannel: string; } diff --git a/lib/modules/datasource/conda/index.spec.ts b/lib/modules/datasource/conda/index.spec.ts index 44235fd2bea0c8..0085c36c69122e 100644 --- a/lib/modules/datasource/conda/index.spec.ts +++ b/lib/modules/datasource/conda/index.spec.ts @@ -5,8 +5,8 @@ import { EXTERNAL_HOST_ERROR } from '../../../constants/error-messages'; import { datasource, defaultRegistryUrl } from './common'; import { CondaDatasource } from './index'; -const depName = 'main/pytest'; -const depUrl = `/${depName}`; +const packageName = 'main/pytest'; +const depUrl = `/${packageName}`; describe('modules/datasource/conda/index', () => { describe('getReleases', () => { @@ -15,7 +15,7 @@ describe('modules/datasource/conda/index', () => { await expect( getPkgReleases({ datasource, - depName, + packageName, }) ).rejects.toThrow(EXTERNAL_HOST_ERROR); }); @@ -25,7 +25,7 @@ describe('modules/datasource/conda/index', () => { expect( await getPkgReleases({ datasource, - depName, + packageName, }) ).toBeNull(); }); @@ -35,7 +35,7 @@ describe('modules/datasource/conda/index', () => { expect( await getPkgReleases({ datasource, - depName, + packageName, }) ).toBeNull(); }); @@ -45,7 +45,7 @@ describe('modules/datasource/conda/index', () => { await expect( getPkgReleases({ datasource, - depName, + packageName, }) ).rejects.toThrow(EXTERNAL_HOST_ERROR); }); @@ -57,7 +57,7 @@ describe('modules/datasource/conda/index', () => { .reply(200, Fixtures.get('pytest.json')); const res = await getPkgReleases({ datasource, - depName, + packageName, }); expect(res).toMatchSnapshot(); expect(res?.releases).toHaveLength(94); @@ -67,20 +67,20 @@ describe('modules/datasource/conda/index', () => { const condaDatasource = new CondaDatasource(); const res = await condaDatasource.getReleases({ registryUrl: '', - packageName: depName, + packageName, }); expect(res).toBeNull(); }); it('supports multiple custom datasource urls', async () => { - const depName = 'pytest'; + const packageName = 'pytest'; httpMock .scope('https://api.anaconda.org/package/rapids') - .get(`/${depName}`) + .get(`/${packageName}`) .reply(404); httpMock .scope('https://api.anaconda.org/package/conda-forge') - .get(`/${depName}`) + .get(`/${packageName}`) .reply(200, { html_url: 'http://anaconda.org/anaconda/pytest', dev_url: 'https://github.com/pytest-dev/pytest/', @@ -96,7 +96,7 @@ describe('modules/datasource/conda/index', () => { const res = await getPkgReleases({ ...config, datasource, - depName, + packageName, }); expect(res).toMatchObject({ homepage: 'http://anaconda.org/anaconda/pytest', diff --git a/lib/modules/datasource/cpan/index.spec.ts b/lib/modules/datasource/cpan/index.spec.ts index 1f5f31882c5df3..291da75a49e7e6 100644 --- a/lib/modules/datasource/cpan/index.spec.ts +++ b/lib/modules/datasource/cpan/index.spec.ts @@ -20,7 +20,7 @@ describe('modules/datasource/cpan/index', () => { expect( await getPkgReleases({ datasource: CpanDatasource.id, - depName: 'FooBar', + packageName: 'FooBar', }) ).toBeNull(); }); @@ -30,7 +30,7 @@ describe('modules/datasource/cpan/index', () => { expect( await getPkgReleases({ datasource: CpanDatasource.id, - depName: 'Plack', + packageName: 'Plack', }) ).toBeNull(); }); @@ -40,7 +40,7 @@ describe('modules/datasource/cpan/index', () => { await expect( getPkgReleases({ datasource: CpanDatasource.id, - depName: 'Plack', + packageName: 'Plack', }) ).rejects.toThrow(EXTERNAL_HOST_ERROR); }); @@ -50,7 +50,7 @@ describe('modules/datasource/cpan/index', () => { expect( await getPkgReleases({ datasource: CpanDatasource.id, - depName: 'Plack', + packageName: 'Plack', }) ).toBeNull(); }); @@ -66,7 +66,7 @@ describe('modules/datasource/cpan/index', () => { .reply(200, Fixtures.get('Plack.json')); const res = await getPkgReleases({ datasource: CpanDatasource.id, - depName: 'Plack', + packageName: 'Plack', }); expect(res).toMatchObject({ changelogUrl: 'https://metacpan.org/dist/Plack/changes', diff --git a/lib/modules/datasource/crate/index.spec.ts b/lib/modules/datasource/crate/index.spec.ts index c8d0637391734f..4e4e76afbb3d55 100644 --- a/lib/modules/datasource/crate/index.spec.ts +++ b/lib/modules/datasource/crate/index.spec.ts @@ -126,7 +126,7 @@ describe('modules/datasource/crate/index', () => { expect( await getPkgReleases({ datasource, - depName: 'non_existent_crate', + packageName: 'non_existent_crate', registryUrls: [], }) ).toBeNull(); @@ -136,7 +136,7 @@ describe('modules/datasource/crate/index', () => { expect( await getPkgReleases({ datasource, - depName: 'non_existent_crate', + packageName: 'non_existent_crate', registryUrls: ['3'], }) ).toBeNull(); @@ -148,7 +148,7 @@ describe('modules/datasource/crate/index', () => { expect( await getPkgReleases({ datasource, - depName: 'non_existent_crate', + packageName: 'non_existent_crate', registryUrls: ['https://crates.io'], }) ).toBeNull(); @@ -163,7 +163,7 @@ describe('modules/datasource/crate/index', () => { expect( await getPkgReleases({ datasource, - depName: 'non_existent_crate', + packageName: 'non_existent_crate', registryUrls: ['https://crates.io'], }) ).toBeNull(); @@ -175,7 +175,7 @@ describe('modules/datasource/crate/index', () => { expect( await getPkgReleases({ datasource, - depName: 'non_existent_crate', + packageName: 'non_existent_crate', registryUrls: ['https://crates.io'], }) ).toBeNull(); @@ -186,7 +186,7 @@ describe('modules/datasource/crate/index', () => { expect( await getPkgReleases({ datasource, - depName: 'some_crate', + packageName: 'some_crate', registryUrls: ['https://crates.io'], }) ).toBeNull(); @@ -197,7 +197,7 @@ describe('modules/datasource/crate/index', () => { await expect( getPkgReleases({ datasource, - depName: 'some_crate', + packageName: 'some_crate', registryUrls: ['https://crates.io'], }) ).rejects.toThrow(EXTERNAL_HOST_ERROR); @@ -208,7 +208,7 @@ describe('modules/datasource/crate/index', () => { expect( await getPkgReleases({ datasource, - depName: 'some_crate', + packageName: 'some_crate', registryUrls: ['https://crates.io'], }) ).toBeNull(); @@ -223,7 +223,7 @@ describe('modules/datasource/crate/index', () => { .reply(200, Fixtures.get('libc')); const res = await getPkgReleases({ datasource, - depName: 'libc', + packageName: 'libc', registryUrls: ['https://crates.io'], }); expect(res).toMatchSnapshot(); @@ -240,7 +240,7 @@ describe('modules/datasource/crate/index', () => { .reply(200, Fixtures.get('amethyst')); const res = await getPkgReleases({ datasource, - depName: 'amethyst', + packageName: 'amethyst', registryUrls: ['https://crates.io'], }); expect(res).toMatchSnapshot(); @@ -254,7 +254,7 @@ describe('modules/datasource/crate/index', () => { const url = 'https://dl.cloudsmith.io/basic/myorg/myrepo/cargo/index.git'; const res = await getPkgReleases({ datasource, - depName: 'mypkg', + packageName: 'mypkg', registryUrls: [url], }); expect(mockClone).toHaveBeenCalledTimes(0); @@ -267,7 +267,7 @@ describe('modules/datasource/crate/index', () => { const url = 'https://dl.cloudsmith.io/basic/myorg/myrepo/cargo/index.git'; const res = await getPkgReleases({ datasource, - depName: 'mypkg', + packageName: 'mypkg', registryUrls: [url], }); expect(mockClone).toHaveBeenCalled(); @@ -282,7 +282,7 @@ describe('modules/datasource/crate/index', () => { const url = 'https://github.com/mcorbin/testregistry'; const res = await getPkgReleases({ datasource, - depName: 'mypkg', + packageName: 'mypkg', registryUrls: [url], }); expect(mockClone).toHaveBeenCalled(); @@ -297,12 +297,12 @@ describe('modules/datasource/crate/index', () => { const url = 'https://github.com/mcorbin/othertestregistry'; await getPkgReleases({ datasource, - depName: 'mypkg', + packageName: 'mypkg', registryUrls: [url], }); await getPkgReleases({ datasource, - depName: 'mypkg', + packageName: 'mypkg', registryUrls: [url], }); expect(mockClone).toHaveBeenCalledTimes(1); @@ -316,19 +316,19 @@ describe('modules/datasource/crate/index', () => { await Promise.all([ getPkgReleases({ datasource, - depName: 'mypkg', + packageName: 'mypkg', registryUrls: [url], }), getPkgReleases({ datasource, - depName: 'mypkg-2', + packageName: 'mypkg-2', registryUrls: [url], }), ]); await getPkgReleases({ datasource, - depName: 'mypkg-3', + packageName: 'mypkg-3', registryUrls: [url], }); @@ -342,12 +342,12 @@ describe('modules/datasource/crate/index', () => { const result = await getPkgReleases({ datasource, - depName: 'mypkg', + packageName: 'mypkg', registryUrls: [url], }); const result2 = await getPkgReleases({ datasource, - depName: 'mypkg-2', + packageName: 'mypkg-2', registryUrls: [url], }); diff --git a/lib/modules/datasource/dart-version/index.spec.ts b/lib/modules/datasource/dart-version/index.spec.ts index 798bab2496f07d..ae41cd725dfa84 100644 --- a/lib/modules/datasource/dart-version/index.spec.ts +++ b/lib/modules/datasource/dart-version/index.spec.ts @@ -8,7 +8,7 @@ const baseUrl = 'https://storage.googleapis.com'; const urlPath = '/storage/v1/b/dart-archive/o?delimiter=%2F&prefix=channels%2Fstable%2Frelease%2F&alt=json'; const datasource = DartVersionDatasource.id; -const depName = 'dart'; +const packageName = 'dart'; const channels = ['stable', 'beta', 'dev']; describe('modules/datasource/dart-version/index', () => { @@ -18,7 +18,7 @@ describe('modules/datasource/dart-version/index', () => { await expect( getPkgReleases({ datasource, - depName, + packageName, }) ).rejects.toThrow(EXTERNAL_HOST_ERROR); }); @@ -28,7 +28,7 @@ describe('modules/datasource/dart-version/index', () => { expect( await getPkgReleases({ datasource, - depName, + packageName, }) ).toBeNull(); }); @@ -38,7 +38,7 @@ describe('modules/datasource/dart-version/index', () => { expect( await getPkgReleases({ datasource, - depName, + packageName, }) ).toBeNull(); }); @@ -55,7 +55,7 @@ describe('modules/datasource/dart-version/index', () => { const res = await getPkgReleases({ datasource, - depName, + packageName, }); expect(res).toBeDefined(); diff --git a/lib/modules/datasource/dart/index.spec.ts b/lib/modules/datasource/dart/index.spec.ts index b3472322c6b6a1..06bad8e6f21dc4 100644 --- a/lib/modules/datasource/dart/index.spec.ts +++ b/lib/modules/datasource/dart/index.spec.ts @@ -15,7 +15,7 @@ describe('modules/datasource/dart/index', () => { expect( await getPkgReleases({ datasource: DartDatasource.id, - depName: 'non_sense', + packageName: 'non_sense', }) ).toBeNull(); }); @@ -32,7 +32,7 @@ describe('modules/datasource/dart/index', () => { expect( await getPkgReleases({ datasource: DartDatasource.id, - depName: 'shared_preferences', + packageName: 'shared_preferences', }) ).toBeNull(); @@ -47,7 +47,7 @@ describe('modules/datasource/dart/index', () => { expect( await getPkgReleases({ datasource: DartDatasource.id, - depName: 'shared_preferences', + packageName: 'shared_preferences', }) ).toBeNull(); }); @@ -57,7 +57,7 @@ describe('modules/datasource/dart/index', () => { expect( await getPkgReleases({ datasource: DartDatasource.id, - depName: 'shared_preferences', + packageName: 'shared_preferences', }) ).toBeNull(); }); @@ -67,7 +67,7 @@ describe('modules/datasource/dart/index', () => { await expect( getPkgReleases({ datasource: DartDatasource.id, - depName: 'shared_preferences', + packageName: 'shared_preferences', }) ).rejects.toThrow(EXTERNAL_HOST_ERROR); }); @@ -77,7 +77,7 @@ describe('modules/datasource/dart/index', () => { expect( await getPkgReleases({ datasource: DartDatasource.id, - depName: 'shared_preferences', + packageName: 'shared_preferences', }) ).toBeNull(); }); @@ -86,7 +86,7 @@ describe('modules/datasource/dart/index', () => { httpMock.scope(baseUrl).get('/shared_preferences').reply(200, body); const res = await getPkgReleases({ datasource: DartDatasource.id, - depName: 'shared_preferences', + packageName: 'shared_preferences', }); expect(res).toMatchSnapshot(); }); diff --git a/lib/modules/datasource/docker/index.spec.ts b/lib/modules/datasource/docker/index.spec.ts index 30b17f3afe7d20..9fd3052b56f6b2 100644 --- a/lib/modules/datasource/docker/index.spec.ts +++ b/lib/modules/datasource/docker/index.spec.ts @@ -221,7 +221,7 @@ describe('modules/datasource/docker/index', () => { }) .reply(401); const res = await getDigest( - { datasource: 'docker', depName: 'some-dep' }, + { datasource: 'docker', packageName: 'some-dep' }, 'some-new-value' ); expect(res).toBeNull(); @@ -237,7 +237,7 @@ describe('modules/datasource/docker/index', () => { }) .replyWithError('error'); const res = await getDigest( - { datasource: 'docker', depName: 'some-dep' }, + { datasource: 'docker', packageName: 'some-dep' }, 'some-new-value' ); expect(res).toBeNull(); @@ -251,7 +251,7 @@ describe('modules/datasource/docker/index', () => { .head('/library/some-dep/manifests/some-new-value') .reply(200, undefined, { 'docker-content-digest': '' }); const res = await getDigest( - { datasource: 'docker', depName: 'some-dep' }, + { datasource: 'docker', packageName: 'some-dep' }, 'some-new-value' ); expect(res).toBeNull(); @@ -277,7 +277,7 @@ describe('modules/datasource/docker/index', () => { hostRules.find.mockReturnValue({}); const res = await getDigest({ datasource: 'docker', - depName: 'some-dep', + packageName: 'some-dep', }); expect(res).toBe('some-digest'); }); @@ -326,7 +326,7 @@ describe('modules/datasource/docker/index', () => { .twice() .reply(200, { token: 'some-token' }); const res = await getDigest( - { datasource: 'docker', depName: 'some-dep' }, + { datasource: 'docker', packageName: 'some-dep' }, 'some-new-value' ); expect(res).toBe( @@ -344,7 +344,7 @@ describe('modules/datasource/docker/index', () => { hostRules.find.mockReturnValue({ insecureRegistry: true }); const res = await getDigest({ datasource: 'docker', - depName: 'some-dep', + packageName: 'some-dep', }); expect(res).toBe('some-digest'); }); @@ -364,7 +364,7 @@ describe('modules/datasource/docker/index', () => { ) .reply(200, '', { 'docker-content-digest': 'some-digest' }); const res = await getDigest( - { datasource: 'docker', depName: 'some-dep' }, + { datasource: 'docker', packageName: 'some-dep' }, 'some-tag' ); expect(res).toBe('some-digest'); @@ -380,7 +380,7 @@ describe('modules/datasource/docker/index', () => { .head('/library/some-dep/manifests/some-tag') .reply(403); const res = await getDigest( - { datasource: 'docker', depName: 'some-dep' }, + { datasource: 'docker', packageName: 'some-dep' }, 'some-tag' ); expect(res).toBeNull(); @@ -405,7 +405,7 @@ describe('modules/datasource/docker/index', () => { await getDigest( { datasource: 'docker', - depName: '123456789.dkr.ecr.us-east-1.amazonaws.com/node', + packageName: '123456789.dkr.ecr.us-east-1.amazonaws.com/node', }, 'some-tag' ) @@ -444,7 +444,7 @@ describe('modules/datasource/docker/index', () => { await getDigest( { datasource: 'docker', - depName: '123456789.dkr.ecr.us-east-1.amazonaws.com/node', + packageName: '123456789.dkr.ecr.us-east-1.amazonaws.com/node', }, 'some-tag' ) @@ -477,7 +477,7 @@ describe('modules/datasource/docker/index', () => { const res = await getDigest( { datasource: 'docker', - depName: '123456789.dkr.ecr.us-east-1.amazonaws.com/node', + packageName: '123456789.dkr.ecr.us-east-1.amazonaws.com/node', }, 'some-tag' ); @@ -494,7 +494,7 @@ describe('modules/datasource/docker/index', () => { const res = await getDigest( { datasource: 'docker', - depName: '123456789.dkr.ecr.us-east-1.amazonaws.com/node', + packageName: '123456789.dkr.ecr.us-east-1.amazonaws.com/node', }, 'some-tag' ); @@ -510,7 +510,7 @@ describe('modules/datasource/docker/index', () => { const res = await getDigest( { datasource: 'docker', - depName: '123456789.dkr.ecr.us-east-1.amazonaws.com/node', + packageName: '123456789.dkr.ecr.us-east-1.amazonaws.com/node', }, 'some-tag' ); @@ -527,7 +527,7 @@ describe('modules/datasource/docker/index', () => { .head('/library/some-dep/manifests/some-new-value') .reply(200, {}, { 'docker-content-digest': 'some-digest' }); const res = await getDigest( - { datasource: 'docker', depName: 'some-dep' }, + { datasource: 'docker', packageName: 'some-dep' }, 'some-new-value' ); expect(res).toBe('some-digest'); @@ -548,7 +548,7 @@ describe('modules/datasource/docker/index', () => { .get('/token?service=&scope=repository:library/some-other-dep:pull') .reply(200, { access_token: 'test' }); const res = await getDigest( - { datasource: 'docker', depName: 'some-other-dep' }, + { datasource: 'docker', packageName: 'some-other-dep' }, '8.0.0-alpine' ); expect(res).toBe('some-digest'); @@ -571,7 +571,7 @@ describe('modules/datasource/docker/index', () => { ) .reply(200, { access_token: 'test' }); const res = await getDigest( - { datasource: 'docker', depName: 'some-other-dep' }, + { datasource: 'docker', packageName: 'some-other-dep' }, '8.0.0-alpine' ); expect(res).toBe('some-digest'); @@ -580,14 +580,14 @@ describe('modules/datasource/docker/index', () => { it('should throw error for 429', async () => { httpMock.scope(baseUrl).get('/').replyWithError({ statusCode: 429 }); await expect( - getDigest({ datasource: 'docker', depName: 'some-dep' }, 'latest') + getDigest({ datasource: 'docker', packageName: 'some-dep' }, 'latest') ).rejects.toThrow(EXTERNAL_HOST_ERROR); }); it('should throw error for 5xx', async () => { httpMock.scope(baseUrl).get('/').replyWithError({ statusCode: 504 }); await expect( - getDigest({ datasource: 'docker', depName: 'some-dep' }, 'latest') + getDigest({ datasource: 'docker', packageName: 'some-dep' }, 'latest') ).rejects.toThrow(EXTERNAL_HOST_ERROR); }); @@ -669,7 +669,7 @@ describe('modules/datasource/docker/index', () => { const res = await getDigest( { datasource: 'docker', - depName: 'some-dep', + packageName: 'some-dep', currentDigest, }, 'some-new-value' @@ -762,7 +762,7 @@ describe('modules/datasource/docker/index', () => { const res = await getDigest( { datasource: 'docker', - depName: 'some-dep', + packageName: 'some-dep', currentDigest, }, 'some-new-value' @@ -839,7 +839,7 @@ describe('modules/datasource/docker/index', () => { const res = await getDigest( { datasource: 'docker', - depName: 'some-dep', + packageName: 'some-dep', currentDigest, }, 'some-new-value' @@ -906,7 +906,7 @@ describe('modules/datasource/docker/index', () => { const res = await getDigest( { datasource: 'docker', - depName: 'some-dep', + packageName: 'some-dep', currentDigest, }, 'some-new-value' @@ -991,7 +991,7 @@ describe('modules/datasource/docker/index', () => { const res = await getDigest( { datasource: 'docker', - depName: 'some-dep', + packageName: 'some-dep', currentDigest, }, 'some-new-value' @@ -1044,7 +1044,7 @@ describe('modules/datasource/docker/index', () => { const res = await getDigest( { datasource: 'docker', - depName: 'some-dep', + packageName: 'some-dep', currentDigest, }, 'some-new-value' @@ -1077,7 +1077,7 @@ describe('modules/datasource/docker/index', () => { const res = await getDigest( { datasource: 'docker', - depName: 'some-dep', + packageName: 'some-dep', currentDigest: 'sha256:0101010101010101010101010101010101010101010101010101010101010101', }, @@ -1097,7 +1097,7 @@ describe('modules/datasource/docker/index', () => { .reply(403); const res = await getPkgReleases({ datasource: DockerDatasource.id, - depName: 'node', + packageName: 'node', registryUrls: ['https://docker.io'], }); expect(res).toBeNull(); @@ -1127,14 +1127,14 @@ describe('modules/datasource/docker/index', () => { .reply(200, { tags: ['latest'] }, {}); const config = { datasource: DockerDatasource.id, - depName: 'node', + packageName: 'node', registryUrls: ['https://registry.company.com'], }; const res = await getPkgReleases(config); expect(res?.releases).toHaveLength(1); }); - it('uses custom registry in depName', async () => { + it('uses custom registry in packageName', async () => { const tags = ['1.0.0']; httpMock .scope('https://registry.company.com/v2') @@ -1148,7 +1148,7 @@ describe('modules/datasource/docker/index', () => { .reply(200, '', {}); const res = await getPkgReleases({ datasource: DockerDatasource.id, - depName: 'registry.company.com/node', + packageName: 'registry.company.com/node', }); expect(res?.releases).toHaveLength(1); }); @@ -1171,7 +1171,7 @@ describe('modules/datasource/docker/index', () => { .reply(200, '', {}); const config = { datasource: DockerDatasource.id, - depName: 'bitnami/redis', + packageName: 'bitnami/redis', registryUrls: ['https://quay.io'], }; const res = await getPkgReleases(config); @@ -1187,7 +1187,7 @@ describe('modules/datasource/docker/index', () => { .reply(500); const config = { datasource: DockerDatasource.id, - depName: 'bitnami/redis', + packageName: 'bitnami/redis', registryUrls: ['https://quay.io'], }; await expect(getPkgReleases(config)).rejects.toThrow(EXTERNAL_HOST_ERROR); @@ -1211,7 +1211,7 @@ describe('modules/datasource/docker/index', () => { .reply(200, '', {}); const res = await getPkgReleases({ datasource: DockerDatasource.id, - depName: 'org.jfrog.io/virtual-mirror/node', + packageName: 'org.jfrog.io/virtual-mirror/node', }); expect(res?.releases).toHaveLength(1); }); @@ -1232,7 +1232,7 @@ describe('modules/datasource/docker/index', () => { expect( await getPkgReleases({ datasource: DockerDatasource.id, - depName: '123456789.dkr.ecr.us-east-1.amazonaws.com/node', + packageName: '123456789.dkr.ecr.us-east-1.amazonaws.com/node', }) ).toEqual({ registryUrl: 'https://123456789.dkr.ecr.us-east-1.amazonaws.com', @@ -1284,7 +1284,7 @@ describe('modules/datasource/docker/index', () => { expect( await getPkgReleases({ datasource: DockerDatasource.id, - depName: 'public.ecr.aws/amazonlinux/amazonlinux', + packageName: 'public.ecr.aws/amazonlinux/amazonlinux', }) ).toEqual({ registryUrl: 'https://public.ecr.aws', @@ -1338,7 +1338,7 @@ describe('modules/datasource/docker/index', () => { expect( await getPkgReleases({ datasource: DockerDatasource.id, - depName: 'ecr-proxy.company.com/node', + packageName: 'ecr-proxy.company.com/node', }) ).toEqual({ registryUrl: 'https://ecr-proxy.company.com', @@ -1373,7 +1373,7 @@ describe('modules/datasource/docker/index', () => { expect( await getPkgReleases({ datasource: DockerDatasource.id, - depName: 'ecr-proxy.company.com/node', + packageName: 'ecr-proxy.company.com/node', }) ).toBeNull(); }); @@ -1404,7 +1404,7 @@ describe('modules/datasource/docker/index', () => { expect( await getPkgReleases({ datasource: DockerDatasource.id, - depName: 'ecr-proxy.company.com/node', + packageName: 'ecr-proxy.company.com/node', }) ).toBeNull(); }); @@ -1427,7 +1427,7 @@ describe('modules/datasource/docker/index', () => { expect( await getPkgReleases({ datasource: DockerDatasource.id, - depName: 'ecr-proxy.company.com/node', + packageName: 'ecr-proxy.company.com/node', }) ).toBeNull(); }); @@ -1456,7 +1456,7 @@ describe('modules/datasource/docker/index', () => { expect( await getPkgReleases({ datasource: DockerDatasource.id, - depName: 'ecr-proxy.company.com/node', + packageName: 'ecr-proxy.company.com/node', }) ).toBeNull(); }); @@ -1477,7 +1477,7 @@ describe('modules/datasource/docker/index', () => { expect( await getPkgReleases({ datasource: DockerDatasource.id, - depName: 'ecr-proxy.company.com/node', + packageName: 'ecr-proxy.company.com/node', }) ).toBeNull(); }); @@ -1500,7 +1500,7 @@ describe('modules/datasource/docker/index', () => { expect( await getPkgReleases({ datasource: DockerDatasource.id, - depName: 'ecr-proxy.company.com/node', + packageName: 'ecr-proxy.company.com/node', }) ).toBeNull(); }); @@ -1527,7 +1527,7 @@ describe('modules/datasource/docker/index', () => { expect( await getPkgReleases({ datasource: DockerDatasource.id, - depName: 'ecr-proxy.company.com/node', + packageName: 'ecr-proxy.company.com/node', }) ).toBeNull(); }); @@ -1555,7 +1555,7 @@ describe('modules/datasource/docker/index', () => { expect( await getPkgReleases({ datasource: DockerDatasource.id, - depName: 'ecr-proxy.company.com/node', + packageName: 'ecr-proxy.company.com/node', }) ).toBeNull(); }); @@ -1584,7 +1584,7 @@ describe('modules/datasource/docker/index', () => { .reply(200, { token: 'test' }); const res = await getPkgReleases({ datasource: DockerDatasource.id, - depName: 'node', + packageName: 'node', }); expect(res?.releases).toHaveLength(1); }); @@ -1612,7 +1612,7 @@ describe('modules/datasource/docker/index', () => { .reply(200, { token: 'test' }); const res = await getPkgReleases({ datasource: DockerDatasource.id, - depName: 'docker.io/node', + packageName: 'docker.io/node', }); expect(res?.releases).toHaveLength(1); }); @@ -1638,7 +1638,7 @@ describe('modules/datasource/docker/index', () => { .reply(200); const res = await getPkgReleases({ datasource: DockerDatasource.id, - depName: 'k8s.gcr.io/kubernetes-dashboard-amd64', + packageName: 'k8s.gcr.io/kubernetes-dashboard-amd64', }); expect(res?.releases).toHaveLength(1); }); @@ -1652,7 +1652,7 @@ describe('modules/datasource/docker/index', () => { .replyWithError('error'); const res = await getPkgReleases({ datasource: DockerDatasource.id, - depName: 'my/node', + packageName: 'my/node', }); expect(res).toBeNull(); }); @@ -1677,7 +1677,7 @@ describe('modules/datasource/docker/index', () => { .reply(200, { token: 'some-token ' }); const res = await getPkgReleases({ datasource: DockerDatasource.id, - depName: 'my/node', + packageName: 'my/node', registryUrls: ['https://index.docker.io/'], }); expect(res?.releases).toHaveLength(1); @@ -1693,7 +1693,7 @@ describe('modules/datasource/docker/index', () => { }); const res = await getPkgReleases({ datasource: DockerDatasource.id, - depName: 'node', + packageName: 'node', }); expect(res).toBeNull(); }); @@ -1737,7 +1737,7 @@ describe('modules/datasource/docker/index', () => { }); const res = await getPkgReleases({ datasource: DockerDatasource.id, - depName: 'registry.company.com/node', + packageName: 'registry.company.com/node', }); expect(res).toStrictEqual({ registryUrl: 'https://registry.company.com', @@ -1788,7 +1788,7 @@ describe('modules/datasource/docker/index', () => { .reply(200, {}); // DockerDatasource.getLabels() inner response const res = await getPkgReleases({ datasource: DockerDatasource.id, - depName: 'registry.company.com/node', + packageName: 'registry.company.com/node', }); expect(res).toStrictEqual({ registryUrl: 'https://registry.company.com', @@ -1842,7 +1842,7 @@ describe('modules/datasource/docker/index', () => { }); const res = await getPkgReleases({ datasource: DockerDatasource.id, - depName: 'registry.company.com/node', + packageName: 'registry.company.com/node', }); expect(res).toStrictEqual({ registryUrl: 'https://registry.company.com', @@ -1869,7 +1869,7 @@ describe('modules/datasource/docker/index', () => { }); const res = await getPkgReleases({ datasource: DockerDatasource.id, - depName: 'registry.company.com/node', + packageName: 'registry.company.com/node', }); expect(res).toStrictEqual({ registryUrl: 'https://registry.company.com', @@ -1893,7 +1893,7 @@ describe('modules/datasource/docker/index', () => { }); const res = await getPkgReleases({ datasource: DockerDatasource.id, - depName: 'registry.company.com/node', + packageName: 'registry.company.com/node', }); expect(res).toStrictEqual({ registryUrl: 'https://registry.company.com', @@ -1914,7 +1914,7 @@ describe('modules/datasource/docker/index', () => { .reply(200, {}); const res = await getPkgReleases({ datasource: DockerDatasource.id, - depName: 'registry.company.com/node', + packageName: 'registry.company.com/node', }); expect(res).toStrictEqual({ registryUrl: 'https://registry.company.com', @@ -1955,7 +1955,7 @@ describe('modules/datasource/docker/index', () => { }); const res = await getPkgReleases({ datasource: DockerDatasource.id, - depName: 'registry.company.com/node', + packageName: 'registry.company.com/node', }); expect(res).toStrictEqual({ registryUrl: 'https://registry.company.com', @@ -2000,7 +2000,7 @@ describe('modules/datasource/docker/index', () => { }); const res = await getPkgReleases({ datasource: DockerDatasource.id, - depName: 'registry.company.com/node', + packageName: 'registry.company.com/node', }); expect(res).toStrictEqual({ registryUrl: 'https://registry.company.com', @@ -2030,7 +2030,7 @@ describe('modules/datasource/docker/index', () => { }); const res = await getPkgReleases({ datasource: DockerDatasource.id, - depName: 'registry.company.com/node', + packageName: 'registry.company.com/node', }); expect(res).toStrictEqual({ registryUrl: 'https://registry.company.com', @@ -2080,7 +2080,7 @@ describe('modules/datasource/docker/index', () => { }); const res = await getPkgReleases({ datasource: DockerDatasource.id, - depName: 'registry.company.com/node', + packageName: 'registry.company.com/node', }); expect(res).toStrictEqual({ registryUrl: 'https://registry.company.com', @@ -2136,7 +2136,7 @@ describe('modules/datasource/docker/index', () => { const res = await getPkgReleases({ datasource: DockerDatasource.id, - depName: 'ghcr.io/visualon/drone-git', + packageName: 'ghcr.io/visualon/drone-git', }); expect(res).toStrictEqual({ registryUrl: 'https://ghcr.io', diff --git a/lib/modules/datasource/dotnet-version/index.spec.ts b/lib/modules/datasource/dotnet-version/index.spec.ts index a0e3e0e18891be..d6bc44a8790aec 100644 --- a/lib/modules/datasource/dotnet-version/index.spec.ts +++ b/lib/modules/datasource/dotnet-version/index.spec.ts @@ -19,7 +19,7 @@ describe('modules/datasource/dotnet-version/index', () => { expect( await getPkgReleases({ datasource: DotnetVersionDatasource.id, - depName: 'non-dotnet', + packageName: 'non-dotnet', }) ).toBeNull(); }); @@ -30,7 +30,7 @@ describe('modules/datasource/dotnet-version/index', () => { expect( await getPkgReleases({ datasource: DotnetVersionDatasource.id, - depName: 'dotnet-sdk', + packageName: 'dotnet-sdk', }) ).toBeNull(); }); @@ -46,7 +46,7 @@ describe('modules/datasource/dotnet-version/index', () => { expect( await getPkgReleases({ datasource: DotnetVersionDatasource.id, - depName: 'dotnet-sdk', + packageName: 'dotnet-sdk', }) ).toBeNull(); }); @@ -57,7 +57,7 @@ describe('modules/datasource/dotnet-version/index', () => { await expect( getPkgReleases({ datasource: DotnetVersionDatasource.id, - depName: 'dotnet-sdk', + packageName: 'dotnet-sdk', }) ).rejects.toThrow(EXTERNAL_HOST_ERROR); }); @@ -73,7 +73,7 @@ describe('modules/datasource/dotnet-version/index', () => { await expect( getPkgReleases({ datasource: DotnetVersionDatasource.id, - depName: 'dotnet-sdk', + packageName: 'dotnet-sdk', }) ).rejects.toThrow(EXTERNAL_HOST_ERROR); }); @@ -84,7 +84,7 @@ describe('modules/datasource/dotnet-version/index', () => { expect( await getPkgReleases({ datasource: DotnetVersionDatasource.id, - depName: 'dotnet-sdk', + packageName: 'dotnet-sdk', }) ).toBeNull(); }); @@ -100,7 +100,7 @@ describe('modules/datasource/dotnet-version/index', () => { expect( await getPkgReleases({ datasource: DotnetVersionDatasource.id, - depName: 'dotnet-sdk', + packageName: 'dotnet-sdk', }) ).toBeNull(); }); @@ -121,7 +121,7 @@ describe('modules/datasource/dotnet-version/index', () => { const res = await getPkgReleases({ datasource: DotnetVersionDatasource.id, - depName: 'dotnet-sdk', + packageName: 'dotnet-sdk', }); expect(res).toBeDefined(); @@ -155,7 +155,7 @@ describe('modules/datasource/dotnet-version/index', () => { const res = await getPkgReleases({ datasource: DotnetVersionDatasource.id, - depName: 'dotnet-runtime', + packageName: 'dotnet-runtime', }); expect(res).toBeDefined(); diff --git a/lib/modules/datasource/flutter-version/index.spec.ts b/lib/modules/datasource/flutter-version/index.spec.ts index bd217e16e04361..8e333b66583e43 100644 --- a/lib/modules/datasource/flutter-version/index.spec.ts +++ b/lib/modules/datasource/flutter-version/index.spec.ts @@ -7,7 +7,7 @@ import { FlutterVersionDatasource } from '.'; const baseUrl = 'https://storage.googleapis.com'; const urlPath = '/flutter_infra_release/releases/releases_linux.json'; const datasource = FlutterVersionDatasource.id; -const depName = 'flutter'; +const packageName = 'flutter'; describe('modules/datasource/flutter-version/index', () => { describe('getReleases', () => { @@ -16,7 +16,7 @@ describe('modules/datasource/flutter-version/index', () => { await expect( getPkgReleases({ datasource, - depName, + packageName, }) ).rejects.toThrow(EXTERNAL_HOST_ERROR); }); @@ -26,7 +26,7 @@ describe('modules/datasource/flutter-version/index', () => { expect( await getPkgReleases({ datasource, - depName, + packageName, }) ).toBeNull(); }); @@ -36,7 +36,7 @@ describe('modules/datasource/flutter-version/index', () => { expect( await getPkgReleases({ datasource, - depName, + packageName, }) ).toBeNull(); }); @@ -48,7 +48,7 @@ describe('modules/datasource/flutter-version/index', () => { .reply(200, Fixtures.get('index.json')); const res = await getPkgReleases({ datasource, - depName, + packageName, }); expect(res).toMatchSnapshot(); expect(res?.releases).toHaveLength(31); diff --git a/lib/modules/datasource/galaxy-collection/index.spec.ts b/lib/modules/datasource/galaxy-collection/index.spec.ts index 019ccaa90e54b8..5c9979779e1ca8 100644 --- a/lib/modules/datasource/galaxy-collection/index.spec.ts +++ b/lib/modules/datasource/galaxy-collection/index.spec.ts @@ -29,7 +29,7 @@ describe('modules/datasource/galaxy-collection/index', () => { expect( await getPkgReleases({ datasource, - depName: 'foo.bar', + packageName: 'foo.bar', }) ).toBeNull(); }); @@ -39,7 +39,7 @@ describe('modules/datasource/galaxy-collection/index', () => { await expect( getPkgReleases({ datasource, - depName: 'foo.bar', + packageName: 'foo.bar', }) ).rejects.toThrow(EXTERNAL_HOST_ERROR); }); @@ -52,7 +52,7 @@ describe('modules/datasource/galaxy-collection/index', () => { expect( await getPkgReleases({ datasource, - depName: 'community.kubernetes', + packageName: 'community.kubernetes', }) ).toBeNull(); }); @@ -67,7 +67,7 @@ describe('modules/datasource/galaxy-collection/index', () => { expect( await getPkgReleases({ datasource, - depName: 'community.kubernetes', + packageName: 'community.kubernetes', }) ).toBeNull(); }); @@ -82,7 +82,7 @@ describe('modules/datasource/galaxy-collection/index', () => { await expect( getPkgReleases({ datasource, - depName: 'community.kubernetes', + packageName: 'community.kubernetes', }) ).rejects.toThrow(EXTERNAL_HOST_ERROR); }); @@ -103,7 +103,7 @@ describe('modules/datasource/galaxy-collection/index', () => { const res = await getPkgReleases({ datasource, - depName: 'community.kubernetes', + packageName: 'community.kubernetes', }); expect(res).toMatchSnapshot(); expect(res).not.toBeNull(); @@ -115,7 +115,7 @@ describe('modules/datasource/galaxy-collection/index', () => { expect( await getPkgReleases({ datasource, - depName: '', + packageName: '', }) ).toBeNull(); }); @@ -124,7 +124,7 @@ describe('modules/datasource/galaxy-collection/index', () => { expect( await getPkgReleases({ datasource, - depName: '', + packageName: '', }) ).toBeNull(); }); @@ -137,7 +137,7 @@ describe('modules/datasource/galaxy-collection/index', () => { expect( await getPkgReleases({ datasource, - depName: 'foo.bar', + packageName: 'foo.bar', }) ).toBeNull(); }); @@ -157,7 +157,7 @@ describe('modules/datasource/galaxy-collection/index', () => { .reply(200, communityKubernetesDetails0111); const res = await getPkgReleases({ datasource, - depName: 'community.kubernetes', + packageName: 'community.kubernetes', }); expect(res).toMatchSnapshot(); expect(res).not.toBeNull(); diff --git a/lib/modules/datasource/galaxy/index.spec.ts b/lib/modules/datasource/galaxy/index.spec.ts index 80ca4b8ca298a4..7654329befef6c 100644 --- a/lib/modules/datasource/galaxy/index.spec.ts +++ b/lib/modules/datasource/galaxy/index.spec.ts @@ -16,7 +16,7 @@ describe('modules/datasource/galaxy/index', () => { expect( await getPkgReleases({ datasource: GalaxyDatasource.id, - depName: 'non_existent_crate', + packageName: 'non_existent_crate', }) ).toBeNull(); }); @@ -29,7 +29,7 @@ describe('modules/datasource/galaxy/index', () => { expect( await getPkgReleases({ datasource: GalaxyDatasource.id, - depName: 'non_existent_crate', + packageName: 'non_existent_crate', }) ).toBeNull(); }); @@ -42,7 +42,7 @@ describe('modules/datasource/galaxy/index', () => { expect( await getPkgReleases({ datasource: GalaxyDatasource.id, - depName: 'non_existent_crate', + packageName: 'non_existent_crate', }) ).toBeNull(); }); @@ -55,7 +55,7 @@ describe('modules/datasource/galaxy/index', () => { expect( await getPkgReleases({ datasource: GalaxyDatasource.id, - depName: 'some_crate', + packageName: 'some_crate', }) ).toBeNull(); }); @@ -68,7 +68,7 @@ describe('modules/datasource/galaxy/index', () => { expect( await getPkgReleases({ datasource: GalaxyDatasource.id, - depName: 'some_crate', + packageName: 'some_crate', }) ).toBeNull(); }); @@ -80,7 +80,7 @@ describe('modules/datasource/galaxy/index', () => { .reply(200, Fixtures.get('timezone')); const res = await getPkgReleases({ datasource: GalaxyDatasource.id, - depName: 'yatesr.timezone', + packageName: 'yatesr.timezone', }); expect(res).toMatchSnapshot(); expect(res).not.toBeNull(); @@ -94,7 +94,7 @@ describe('modules/datasource/galaxy/index', () => { .reply(200, Fixtures.get('empty')); const res = await getPkgReleases({ datasource: GalaxyDatasource.id, - depName: 'foo.bar', + packageName: 'foo.bar', }); expect(res).toBeNull(); }); @@ -107,7 +107,7 @@ describe('modules/datasource/galaxy/index', () => { await expect( getPkgReleases({ datasource: GalaxyDatasource.id, - depName: 'some_crate', + packageName: 'some_crate', }) ).rejects.toThrow(EXTERNAL_HOST_ERROR); }); @@ -119,7 +119,7 @@ describe('modules/datasource/galaxy/index', () => { .reply(404); const res = await getPkgReleases({ datasource: GalaxyDatasource.id, - depName: 'foo.bar', + packageName: 'foo.bar', }); expect(res).toBeNull(); }); diff --git a/lib/modules/datasource/git-refs/index.spec.ts b/lib/modules/datasource/git-refs/index.spec.ts index 5c1f47ae5913f3..75405d464710de 100644 --- a/lib/modules/datasource/git-refs/index.spec.ts +++ b/lib/modules/datasource/git-refs/index.spec.ts @@ -6,7 +6,7 @@ import { GitRefsDatasource } from '.'; jest.mock('simple-git'); const simpleGit: jest.Mock> = _simpleGit as never; -const depName = 'https://github.com/example/example.git'; +const packageName = 'https://github.com/example/example.git'; const lsRemote1 = Fixtures.get('ls-remote-1.txt'); @@ -22,7 +22,7 @@ describe('modules/datasource/git-refs/index', () => { }); const versions = await getPkgReleases({ datasource, - depName, + packageName, }); expect(versions).toBeNull(); }); @@ -35,7 +35,7 @@ describe('modules/datasource/git-refs/index', () => { }); const { releases } = (await getPkgReleases({ datasource, - depName, + packageName, }))!; expect(releases).toBeEmpty(); }); @@ -48,7 +48,7 @@ describe('modules/datasource/git-refs/index', () => { }); const versions = await getPkgReleases({ datasource, - depName, + packageName, }); expect(versions).toBeNull(); }); @@ -62,7 +62,7 @@ describe('modules/datasource/git-refs/index', () => { const versions = await getPkgReleases({ datasource, - depName, + packageName, }); expect(versions).toMatchSnapshot(); const result = versions?.releases.map((x) => x.version).sort(); diff --git a/lib/modules/datasource/git-refs/readme.md b/lib/modules/datasource/git-refs/readme.md index b0a9b2d27a8402..86d27e39bb9e8d 100644 --- a/lib/modules/datasource/git-refs/readme.md +++ b/lib/modules/datasource/git-refs/readme.md @@ -1,7 +1,7 @@ This datasource can be used in combination with [regex managers](https://docs.renovatebot.com/modules/manager/regex/) to keep dependencies up-to-date which are not specifically supported by Renovate. This datasource returns a reference from a Git repository. -The `depName` (or `packageName` if in use) must be a fully qualified domain name. +The `packageName` must be a fully qualified domain name. To fetch the latest digest of a reference instead of the named reference, specify the reference as the `currentValue` and match on the `currentDigest`. **Usage example** diff --git a/lib/modules/datasource/git-tags/index.spec.ts b/lib/modules/datasource/git-tags/index.spec.ts index d47c6b12e9ed5a..a14744c6f7d6af 100644 --- a/lib/modules/datasource/git-tags/index.spec.ts +++ b/lib/modules/datasource/git-tags/index.spec.ts @@ -6,7 +6,7 @@ import { GitTagsDatasource } from '.'; jest.mock('simple-git'); const simpleGit: jest.Mock> = _simpleGit as never; -const depName = 'https://github.com/example/example.git'; +const packageName = 'https://github.com/example/example.git'; const lsRemote1 = Fixtures.get('ls-remote-1.txt', '../git-refs'); @@ -21,7 +21,7 @@ describe('modules/datasource/git-tags/index', () => { return Promise.resolve('') as Response; }, }); - const versions = await getPkgReleases({ datasource, depName }); + const versions = await getPkgReleases({ datasource, packageName }); expect(versions).toBeNull(); }); @@ -31,7 +31,7 @@ describe('modules/datasource/git-tags/index', () => { throw new Error(); }, }); - const versions = await getPkgReleases({ datasource, depName }); + const versions = await getPkgReleases({ datasource, packageName }); expect(versions).toBeNull(); }); @@ -44,7 +44,7 @@ describe('modules/datasource/git-tags/index', () => { const versions = await getPkgReleases({ datasource, - depName, + packageName, }); expect(versions).toMatchSnapshot(); }); diff --git a/lib/modules/datasource/github-releases/index.spec.ts b/lib/modules/datasource/github-releases/index.spec.ts index 2491c1a71f64c1..f90efc018f4bfa 100644 --- a/lib/modules/datasource/github-releases/index.spec.ts +++ b/lib/modules/datasource/github-releases/index.spec.ts @@ -66,7 +66,7 @@ describe('modules/datasource/github-releases/index', () => { const res = await getPkgReleases({ datasource: GithubReleasesDatasource.id, - depName: 'some/dep', + packageName: 'some/dep', }); expect(res).toMatchObject({ @@ -86,15 +86,15 @@ describe('modules/datasource/github-releases/index', () => { }); describe('getDigest', () => { - const depName = 'some/dep'; + const packageName = 'some/dep'; const currentValue = 'v1.0.0'; const currentDigest = 'v1.0.0-digest'; - const releaseMock = new GitHubReleaseMocker(githubApiHost, depName); + const releaseMock = new GitHubReleaseMocker(githubApiHost, packageName); it('requires currentDigest', async () => { const digest = await getDigest( - { datasource: GithubReleasesDatasource.id, depName }, + { datasource: GithubReleasesDatasource.id, packageName }, currentValue ); expect(digest).toBeNull(); @@ -104,7 +104,7 @@ describe('modules/datasource/github-releases/index', () => { const digest = await getDigest( { datasource: GithubReleasesDatasource.id, - depName, + packageName, currentDigest, }, currentValue @@ -123,7 +123,7 @@ describe('modules/datasource/github-releases/index', () => { const digest = await getDigest( { datasource: GithubReleasesDatasource.id, - depName, + packageName, currentValue, currentDigest, }, @@ -139,7 +139,7 @@ describe('modules/datasource/github-releases/index', () => { const digest = await getDigest( { datasource: GithubReleasesDatasource.id, - depName, + packageName, currentValue, currentDigest, }, diff --git a/lib/modules/datasource/github-tags/index.spec.ts b/lib/modules/datasource/github-tags/index.spec.ts index 948a81857263aa..72ae3f11f2421b 100644 --- a/lib/modules/datasource/github-tags/index.spec.ts +++ b/lib/modules/datasource/github-tags/index.spec.ts @@ -114,7 +114,7 @@ describe('modules/datasource/github-tags/index', () => { }); describe('getReleases', () => { - const depName = 'some/dep2'; + const packageName = 'some/dep2'; it('returns tags', async () => { jest.spyOn(githubGraphql, 'queryTags').mockResolvedValueOnce([ @@ -152,7 +152,7 @@ describe('modules/datasource/github-tags/index', () => { }, ]); - const res = await getPkgReleases({ datasource: github.id, depName }); + const res = await getPkgReleases({ datasource: github.id, packageName }); expect(res).toEqual({ registryUrl: 'https://github.com', diff --git a/lib/modules/datasource/gitlab-packages/index.spec.ts b/lib/modules/datasource/gitlab-packages/index.spec.ts index 697c2123c74ee3..366fd9a7cc51c7 100644 --- a/lib/modules/datasource/gitlab-packages/index.spec.ts +++ b/lib/modules/datasource/gitlab-packages/index.spec.ts @@ -39,7 +39,7 @@ describe('modules/datasource/gitlab-packages/index', () => { const res = await getPkgReleases({ datasource, registryUrls: ['https://gitlab.com'], - depName: 'user/project1:mypkg', + packageName: 'user/project1:mypkg', }); expect(res).toMatchSnapshot(); expect(res?.releases).toHaveLength(3); @@ -58,7 +58,7 @@ describe('modules/datasource/gitlab-packages/index', () => { await getPkgReleases({ datasource, registryUrls: ['https://gitlab.com'], - depName: 'user/project1:mypkg', + packageName: 'user/project1:mypkg', }) ).toBeNull(); }); @@ -76,7 +76,7 @@ describe('modules/datasource/gitlab-packages/index', () => { await getPkgReleases({ datasource, registryUrls: ['https://gitlab.com'], - depName: 'user/project1:mypkg', + packageName: 'user/project1:mypkg', }) ).toBeNull(); }); @@ -94,7 +94,7 @@ describe('modules/datasource/gitlab-packages/index', () => { getPkgReleases({ datasource, registryUrls: ['https://gitlab.com'], - depName: 'user/project1:mypkg', + packageName: 'user/project1:mypkg', }) ).rejects.toThrow(EXTERNAL_HOST_ERROR); }); diff --git a/lib/modules/datasource/gitlab-packages/readme.md b/lib/modules/datasource/gitlab-packages/readme.md index e5fc0636d09a5e..54388f498c83ce 100644 --- a/lib/modules/datasource/gitlab-packages/readme.md +++ b/lib/modules/datasource/gitlab-packages/readme.md @@ -1,6 +1,6 @@ [GitLab Packages API](https://docs.gitlab.com/ee/api/packages.html) supports looking up package versions from [all types of packages registry supported by GitLab](https://docs.gitlab.com/ee/user/packages/package_registry/index.html) and can be used in combination with [regex managers](https://docs.renovatebot.com/modules/manager/regex/) to keep dependencies up-to-date which are not specifically supported by Renovate. -To specify which specific repository should be queried when looking up a package, the `depName` should be formed with the project path first, then a `:` and finally the package name. +To specify which specific repository should be queried when looking up a package, the `packageName` should be formed with the project path first, then a `:` and finally the package name. As an example, `gitlab-org/ci-cd/package-stage/feature-testing/new-packages-list:@gitlab-org/nk-js` would look for the`@gitlab-org/nk-js` packages in the generic packages repository of the `gitlab-org/ci-cd/package-stage/feature-testing/new-packages-list` project. diff --git a/lib/modules/datasource/gitlab-releases/index.spec.ts b/lib/modules/datasource/gitlab-releases/index.spec.ts index e0480cd0c7f5d2..2a1d498aa9c3b9 100644 --- a/lib/modules/datasource/gitlab-releases/index.spec.ts +++ b/lib/modules/datasource/gitlab-releases/index.spec.ts @@ -23,7 +23,7 @@ describe('modules/datasource/gitlab-releases/index', () => { const res = await getPkgReleases({ datasource: GitlabReleasesDatasource.id, registryUrls: ['https://gitlab.company.com'], - depName: 'some/dep2', + packageName: 'some/dep2', }); expect(res).toMatchSnapshot(); expect(res?.releases).toHaveLength(2); @@ -36,7 +36,7 @@ describe('modules/datasource/gitlab-releases/index', () => { .reply(200, body); const res = await getPkgReleases({ datasource: GitlabReleasesDatasource.id, - depName: 'some/dep2', + packageName: 'some/dep2', }); expect(res).toMatchSnapshot(); expect(res?.releases).toHaveLength(2); @@ -50,7 +50,7 @@ describe('modules/datasource/gitlab-releases/index', () => { expect( await getPkgReleases({ datasource: GitlabReleasesDatasource.id, - depName: 'some/dep2', + packageName: 'some/dep2', }) ).toBeNull(); }); diff --git a/lib/modules/datasource/gitlab-releases/readme.md b/lib/modules/datasource/gitlab-releases/readme.md index ae31ae31a00776..6b5ffbaa77cebb 100644 --- a/lib/modules/datasource/gitlab-releases/readme.md +++ b/lib/modules/datasource/gitlab-releases/readme.md @@ -1,6 +1,6 @@ [GitLab Releases API](https://docs.gitlab.com/ee/api/releases/) supports looking up [releases supported by GitLab](https://docs.gitlab.com/ee/user/project/releases/) and can be used in combination with [regex managers](https://docs.renovatebot.com/modules/manager/regex/) to keep dependencies up-to-date which are not specifically supported by Renovate. -To specify which specific repository should be queried when looking up a package, the `depName` should be set to the project path. +To specify which specific repository should be queried when looking up a package, the `packageName` should be set to the project path. As an example, `gitlab-org/ci-cd/package-stage/feature-testing/new-packages-list` would look for releases in the `gitlab-org/ci-cd/package-stage/feature-testing/new-packages-list` project. diff --git a/lib/modules/datasource/gitlab-tags/index.spec.ts b/lib/modules/datasource/gitlab-tags/index.spec.ts index 49467bd9b4263c..f9b333fe7e4587 100644 --- a/lib/modules/datasource/gitlab-tags/index.spec.ts +++ b/lib/modules/datasource/gitlab-tags/index.spec.ts @@ -29,7 +29,7 @@ describe('modules/datasource/gitlab-tags/index', () => { const res = await getPkgReleases({ datasource, registryUrls: ['https://gitlab.company.com/api/v4/'], - depName: 'some/dep2', + packageName: 'some/dep2', }); expect(res).toMatchSnapshot(); expect(res?.releases).toHaveLength(3); @@ -58,7 +58,7 @@ describe('modules/datasource/gitlab-tags/index', () => { const res = await getPkgReleases({ datasource, registryUrls: ['https://my.company.com/gitlab'], - depName: 'some/dep2', + packageName: 'some/dep2', }); expect(res).toMatchSnapshot(); expect(res?.releases).toHaveLength(3); @@ -72,7 +72,7 @@ describe('modules/datasource/gitlab-tags/index', () => { .reply(200, body); const res = await getPkgReleases({ datasource, - depName: 'some/dep2', + packageName: 'some/dep2', }); expect(res).toMatchSnapshot(); expect(res?.releases).toHaveLength(2); @@ -94,7 +94,7 @@ describe('modules/datasource/gitlab-tags/index', () => { const res = await getDigest({ datasource, registryUrls: ['https://gitlab.company.com/api/v4/'], - depName: 'some/dep2', + packageName: 'some/dep2', }); expect(res).toBe(digest); }); @@ -112,7 +112,7 @@ describe('modules/datasource/gitlab-tags/index', () => { { datasource, registryUrls: ['https://gitlab.company.com/api/v4/'], - depName: 'some/dep2', + packageName: 'some/dep2', }, 'branch' ); @@ -127,7 +127,7 @@ describe('modules/datasource/gitlab-tags/index', () => { const res = await getDigest({ datasource, registryUrls: ['https://gitlab.company.com/api/v4/'], - depName: 'some/dep2', + packageName: 'some/dep2', }); expect(res).toBeNull(); }); @@ -141,7 +141,7 @@ describe('modules/datasource/gitlab-tags/index', () => { { datasource, registryUrls: ['https://gitlab.company.com/api/v4/'], - depName: 'some/dep2', + packageName: 'some/dep2', }, 'unknown-branch' ); diff --git a/lib/modules/datasource/gitlab-tags/readme.md b/lib/modules/datasource/gitlab-tags/readme.md index 881a9ebda937a3..5f153fddcf46c0 100644 --- a/lib/modules/datasource/gitlab-tags/readme.md +++ b/lib/modules/datasource/gitlab-tags/readme.md @@ -1,6 +1,6 @@ [GitLab Tags API](https://docs.gitlab.com/ee/api/tags.html) supports looking up [Git tags](https://docs.gitlab.com/ee/topics/git/tags.html#tags) and can be used in combination with [regex managers](https://docs.renovatebot.com/modules/manager/regex/) to keep dependencies up-to-date which are not specifically supported by Renovate. -To specify which specific repository should be queried when looking up a package, the `depName` should be set to the project path. +To specify which specific repository should be queried when looking up a package, the `packageName` should be set to the project path. As an example, `gitlab-org/ci-cd/package-stage/feature-testing/new-packages-list` would look for releases in the `gitlab-org/ci-cd/package-stage/feature-testing/new-packages-list` project. diff --git a/lib/modules/datasource/golang-version/index.spec.ts b/lib/modules/datasource/golang-version/index.spec.ts index 03e876758e0f7a..092600d22f5719 100644 --- a/lib/modules/datasource/golang-version/index.spec.ts +++ b/lib/modules/datasource/golang-version/index.spec.ts @@ -23,7 +23,7 @@ describe('modules/datasource/golang-version/index', () => { .reply(200, golangReleasesContent); const res = await getPkgReleases({ datasource, - depName: 'golang', + packageName: 'golang', }); expect(res?.releases).toHaveLength(132); expect(res?.releases[0]).toEqual({ @@ -44,7 +44,7 @@ describe('modules/datasource/golang-version/index', () => { const res = await getPkgReleases({ ...config, datasource, - depName: 'golang', + packageName: 'golang', }); expect(res?.releases).toHaveLength(132); expect(res?.releases[0]).toEqual({ @@ -61,7 +61,7 @@ describe('modules/datasource/golang-version/index', () => { await expect( getPkgReleases({ datasource, - depName: 'golang', + packageName: 'golang', }) ).rejects.toThrow(ExternalHostError); }); @@ -74,7 +74,7 @@ describe('modules/datasource/golang-version/index', () => { await expect( getPkgReleases({ datasource, - depName: 'golang', + packageName: 'golang', }) ).rejects.toThrow(ExternalHostError); }); @@ -85,7 +85,7 @@ describe('modules/datasource/golang-version/index', () => { .get('/golang/website/HEAD/internal/history/release.go') .reply(200, {}); await expect( - getPkgReleases({ datasource, depName: 'golang' }) + getPkgReleases({ datasource, packageName: 'golang' }) ).rejects.toThrow(ExternalHostError); }); @@ -95,7 +95,7 @@ describe('modules/datasource/golang-version/index', () => { .get('/golang/website/HEAD/internal/history/release.go') .reply(200, golangReleasesInvalidContent3); await expect( - getPkgReleases({ datasource, depName: 'golang' }) + getPkgReleases({ datasource, packageName: 'golang' }) ).rejects.toThrow(ExternalHostError); }); @@ -105,7 +105,7 @@ describe('modules/datasource/golang-version/index', () => { .get('/golang/website/HEAD/internal/history/release.go') .reply(200, golangReleasesInvalidContent4); await expect( - getPkgReleases({ datasource, depName: 'golang' }) + getPkgReleases({ datasource, packageName: 'golang' }) ).rejects.toThrow(ExternalHostError); }); @@ -115,7 +115,7 @@ describe('modules/datasource/golang-version/index', () => { .get('/golang/website/HEAD/internal/history/release.go') .reply(404); expect( - await getPkgReleases({ datasource, depName: 'golang' }) + await getPkgReleases({ datasource, packageName: 'golang' }) ).toBeNull(); }); @@ -125,7 +125,7 @@ describe('modules/datasource/golang-version/index', () => { .get('/golang/website/HEAD/internal/history/release.go') .reply(200, golangReleasesInvalidContent5); await expect( - getPkgReleases({ datasource, depName: 'golang' }) + getPkgReleases({ datasource, packageName: 'golang' }) ).rejects.toThrow(ExternalHostError); }); @@ -135,7 +135,7 @@ describe('modules/datasource/golang-version/index', () => { .get('/golang/website/HEAD/internal/history/release.go') .reply(200, golangReleasesInvalidContent6); await expect( - getPkgReleases({ datasource, depName: 'golang' }) + getPkgReleases({ datasource, packageName: 'golang' }) ).rejects.toThrow(ExternalHostError); }); }); diff --git a/lib/modules/datasource/gradle-version/index.spec.ts b/lib/modules/datasource/gradle-version/index.spec.ts index 37afff51b6317b..6bcd65dec8ad99 100644 --- a/lib/modules/datasource/gradle-version/index.spec.ts +++ b/lib/modules/datasource/gradle-version/index.spec.ts @@ -18,7 +18,7 @@ describe('modules/datasource/gradle-version/index', () => { config = { datasource, versioning, - depName: 'abc', + packageName: 'abc', }; }); diff --git a/lib/modules/datasource/helm/index.spec.ts b/lib/modules/datasource/helm/index.spec.ts index 3b75c57e6b82aa..c4dc79ae968b82 100644 --- a/lib/modules/datasource/helm/index.spec.ts +++ b/lib/modules/datasource/helm/index.spec.ts @@ -17,7 +17,7 @@ describe('modules/datasource/helm/index', () => { expect( await getPkgReleases({ datasource: HelmDatasource.id, - depName: undefined as never, // #7154 + packageName: undefined as never, // #7154 registryUrls: ['https://example-repository.com'], }) ).toBeNull(); @@ -32,7 +32,7 @@ describe('modules/datasource/helm/index', () => { expect( await getPkgReleases({ datasource: HelmDatasource.id, - depName: 'some_chart', + packageName: 'some_chart', registryUrls: [], }) ).toBeNull(); @@ -46,7 +46,7 @@ describe('modules/datasource/helm/index', () => { expect( await getPkgReleases({ datasource: HelmDatasource.id, - depName: 'non_existent_chart', + packageName: 'non_existent_chart', registryUrls: ['https://example-repository.com'], }) ).toBeNull(); @@ -60,7 +60,7 @@ describe('modules/datasource/helm/index', () => { expect( await getPkgReleases({ datasource: HelmDatasource.id, - depName: 'non_existent_chart', + packageName: 'non_existent_chart', registryUrls: ['https://example-repository.com'], }) ).toBeNull(); @@ -74,7 +74,7 @@ describe('modules/datasource/helm/index', () => { expect( await getPkgReleases({ datasource: HelmDatasource.id, - depName: 'some_chart', + packageName: 'some_chart', registryUrls: ['https://example-repository.com'], }) ).toBeNull(); @@ -88,7 +88,7 @@ describe('modules/datasource/helm/index', () => { await expect( getPkgReleases({ datasource: HelmDatasource.id, - depName: 'some_chart', + packageName: 'some_chart', registryUrls: ['https://example-repository.com'], }) ).rejects.toThrow(EXTERNAL_HOST_ERROR); @@ -102,7 +102,7 @@ describe('modules/datasource/helm/index', () => { expect( await getPkgReleases({ datasource: HelmDatasource.id, - depName: 'some_chart', + packageName: 'some_chart', registryUrls: ['https://example-repository.com'], }) ).toBeNull(); @@ -115,7 +115,7 @@ describe('modules/datasource/helm/index', () => { .reply(200, '# A comment'); const releases = await getPkgReleases({ datasource: HelmDatasource.id, - depName: 'non_existent_chart', + packageName: 'non_existent_chart', registryUrls: ['https://example-repository.com'], }); expect(releases).toBeNull(); @@ -134,7 +134,7 @@ describe('modules/datasource/helm/index', () => { .reply(200, res); const releases = await getPkgReleases({ datasource: HelmDatasource.id, - depName: 'non_existent_chart', + packageName: 'non_existent_chart', registryUrls: ['https://example-repository.com'], }); expect(releases).toBeNull(); @@ -147,7 +147,7 @@ describe('modules/datasource/helm/index', () => { .reply(200, indexYaml); const releases = await getPkgReleases({ datasource: HelmDatasource.id, - depName: 'non_existent_chart', + packageName: 'non_existent_chart', registryUrls: ['https://example-repository.com'], }); expect(releases).toBeNull(); @@ -160,7 +160,7 @@ describe('modules/datasource/helm/index', () => { .reply(200, indexYaml); const releases = await getPkgReleases({ datasource: HelmDatasource.id, - depName: 'ambassador', + packageName: 'ambassador', registryUrls: ['https://example-repository.com'], }); expect(releases).not.toBeNull(); @@ -174,7 +174,7 @@ describe('modules/datasource/helm/index', () => { .reply(200, indexYaml); const res = await getPkgReleases({ datasource: HelmDatasource.id, - depName: 'ambassador', + packageName: 'ambassador', registryUrls: ['https://example-repository.com/subdir'], }); diff --git a/lib/modules/datasource/hex/index.spec.ts b/lib/modules/datasource/hex/index.spec.ts index 1e8401d8cfa0c7..609220fc7a5055 100644 --- a/lib/modules/datasource/hex/index.spec.ts +++ b/lib/modules/datasource/hex/index.spec.ts @@ -29,7 +29,7 @@ describe('modules/datasource/hex/index', () => { expect( await getPkgReleases({ datasource, - depName: 'non_existent_package', + packageName: 'non_existent_package', }) ).toBeNull(); }); @@ -42,7 +42,7 @@ describe('modules/datasource/hex/index', () => { expect( await getPkgReleases({ datasource, - depName: 'non_existent_package', + packageName: 'non_existent_package', }) ).toBeNull(); }); @@ -50,35 +50,35 @@ describe('modules/datasource/hex/index', () => { it('returns null for 404', async () => { httpMock.scope(baseUrl).get('/packages/some_package').reply(404); expect( - await getPkgReleases({ datasource, depName: 'some_package' }) + await getPkgReleases({ datasource, packageName: 'some_package' }) ).toBeNull(); }); it('returns null for 401', async () => { httpMock.scope(baseUrl).get('/packages/some_package').reply(401); expect( - await getPkgReleases({ datasource, depName: 'some_package' }) + await getPkgReleases({ datasource, packageName: 'some_package' }) ).toBeNull(); }); it('throws for 429', async () => { httpMock.scope(baseUrl).get('/packages/some_crate').reply(429); await expect( - getPkgReleases({ datasource, depName: 'some_crate' }) + getPkgReleases({ datasource, packageName: 'some_crate' }) ).rejects.toThrow(EXTERNAL_HOST_ERROR); }); it('throws for 5xx', async () => { httpMock.scope(baseUrl).get('/packages/some_crate').reply(502); await expect( - getPkgReleases({ datasource, depName: 'some_crate' }) + getPkgReleases({ datasource, packageName: 'some_crate' }) ).rejects.toThrow(EXTERNAL_HOST_ERROR); }); it('returns null for unknown error', async () => { httpMock.scope(baseUrl).get('/packages/some_package').replyWithError(''); expect( - await getPkgReleases({ datasource, depName: 'some_package' }) + await getPkgReleases({ datasource, packageName: 'some_package' }) ).toBeNull(); }); @@ -99,7 +99,7 @@ describe('modules/datasource/hex/index', () => { const res = await getPkgReleases({ datasource, - depName: 'certifi', + packageName: 'certifi', }); expect(res).toBeNull(); @@ -112,7 +112,7 @@ describe('modules/datasource/hex/index', () => { .reply(200, certifiResponse); const res = await getPkgReleases({ datasource, - depName: 'certifi', + packageName: 'certifi', }); expect(res).toMatchSnapshot(); expect(res).not.toBeNull(); @@ -127,7 +127,7 @@ describe('modules/datasource/hex/index', () => { hostRules.find.mockReturnValueOnce({}); const res = await getPkgReleases({ datasource, - depName: 'certifi', + packageName: 'certifi', }); expect(res).toMatchSnapshot(); expect(res).not.toBeNull(); @@ -151,7 +151,7 @@ describe('modules/datasource/hex/index', () => { const result = await getPkgReleases({ datasource, - depName: 'private_package:renovate_test', + packageName: 'private_package:renovate_test', }); expect(result).toMatchSnapshot(); diff --git a/lib/modules/datasource/hexpm-bob/index.spec.ts b/lib/modules/datasource/hexpm-bob/index.spec.ts index 79b8e6f922e655..25969936b410fa 100644 --- a/lib/modules/datasource/hexpm-bob/index.spec.ts +++ b/lib/modules/datasource/hexpm-bob/index.spec.ts @@ -14,7 +14,7 @@ describe('modules/datasource/hexpm-bob/index', () => { await expect( getPkgReleases({ datasource, - depName: 'elixir', + packageName: 'elixir', }) ).rejects.toThrow(EXTERNAL_HOST_ERROR); }); @@ -27,7 +27,7 @@ describe('modules/datasource/hexpm-bob/index', () => { expect( await getPkgReleases({ datasource, - depName: 'elixir', + packageName: 'elixir', }) ).toBeNull(); }); @@ -40,7 +40,7 @@ describe('modules/datasource/hexpm-bob/index', () => { expect( await getPkgReleases({ datasource, - depName: 'elixir', + packageName: 'elixir', }) ).toBeNull(); }); @@ -53,7 +53,7 @@ describe('modules/datasource/hexpm-bob/index', () => { expect( await getPkgReleases({ datasource, - depName: 'elixir', + packageName: 'elixir', }) ).toBeNull(); }); @@ -66,7 +66,7 @@ describe('modules/datasource/hexpm-bob/index', () => { await expect( getPkgReleases({ datasource, - depName: 'elixir', + packageName: 'elixir', }) ).rejects.toThrow(EXTERNAL_HOST_ERROR); }); @@ -78,7 +78,7 @@ describe('modules/datasource/hexpm-bob/index', () => { .reply(200, Fixtures.get('elixir/builds.txt')); const res = await getPkgReleases({ datasource, - depName: 'elixir', + packageName: 'elixir', }); expect(res).toEqual({ homepage: 'https://elixir-lang.org/', @@ -126,7 +126,7 @@ describe('modules/datasource/hexpm-bob/index', () => { .reply(200, Fixtures.get('otp/ubuntu-20.04/builds.txt')); const res = await getPkgReleases({ datasource, - depName: 'otp/ubuntu-20.04', + packageName: 'otp/ubuntu-20.04', versioning: 'regex:^(?\\d+?)\\.(?\\d+?)(\\.(?\\d+))?$', }); @@ -162,7 +162,7 @@ describe('modules/datasource/hexpm-bob/index', () => { const res = await getPkgReleases({ datasource, - depName: 'otp/ubuntu-20.04', + packageName: 'otp/ubuntu-20.04', registryUrls: [registryUrl], }); @@ -173,7 +173,7 @@ describe('modules/datasource/hexpm-bob/index', () => { expect( await getPkgReleases({ datasource, - depName: 'invalid', + packageName: 'invalid', }) ).toBeNull(); }); diff --git a/lib/modules/datasource/index.spec.ts b/lib/modules/datasource/index.spec.ts index 06fb982bada3ad..cb2bd428db396b 100644 --- a/lib/modules/datasource/index.spec.ts +++ b/lib/modules/datasource/index.spec.ts @@ -24,7 +24,7 @@ import { } from '.'; const datasource = 'dummy'; -const depName = 'package'; +const packageName = 'package'; type RegistriesMock = Record< string, @@ -171,17 +171,17 @@ describe('modules/datasource/index', () => { expect( await getPkgReleases({ datasource: null as never, // #7154 - depName: 'some/dep', + packageName: 'some/dep', }) ).toBeNull(); }); - it('returns null for no depName', async () => { + it('returns null for no packageName', async () => { datasources.set(datasource, new DummyDatasource()); expect( await getPkgReleases({ datasource, - depName: null as never, // #7154 + packageName: null as never, // #7154 }) ).toBeNull(); }); @@ -190,7 +190,7 @@ describe('modules/datasource/index', () => { expect( await getPkgReleases({ datasource: 'some-unknown-datasource', - depName: 'some/dep', + packageName: 'some/dep', }) ).toBeNull(); }); @@ -202,7 +202,11 @@ describe('modules/datasource/index', () => { datasources.set(datasource, new TestDatasource()); const registryUrls = ['https://foo.bar']; - const res = await getPkgReleases({ datasource, depName, registryUrls }); + const res = await getPkgReleases({ + datasource, + packageName, + registryUrls, + }); expect(logger.logger.warn).toHaveBeenCalledWith( { datasource: 'dummy', registryUrls, defaultRegistryUrls: undefined }, @@ -227,7 +231,7 @@ describe('modules/datasource/index', () => { datasources.set(datasource, new TestDatasource()); expect(supportsDigests(datasource)).toBeTrue(); - expect(await getDigest({ datasource, depName })).toBe('123'); + expect(await getDigest({ datasource, packageName })).toBe('123'); }); it('returns replacementName if defined', async () => { @@ -245,7 +249,6 @@ describe('modules/datasource/index', () => { await getDigest({ datasource, packageName: 'pkgName', - depName, replacementName: 'replacement', }) ).toBe('replacement'); @@ -258,13 +261,13 @@ describe('modules/datasource/index', () => { }); it('adds changelogUrl', async () => { - expect(await getPkgReleases({ datasource, depName })).toMatchObject({ + expect(await getPkgReleases({ datasource, packageName })).toMatchObject({ changelogUrl: 'https://foo.bar/package/CHANGELOG.md', }); }); it('adds sourceUrl', async () => { - expect(await getPkgReleases({ datasource, depName })).toMatchObject({ + expect(await getPkgReleases({ datasource, packageName })).toMatchObject({ sourceUrl: 'https://foo.bar/package', }); }); @@ -279,7 +282,7 @@ describe('modules/datasource/index', () => { const res = await getPkgReleases({ datasource, - depName, + packageName, defaultRegistryUrls: ['https://foo.bar'], }); expect(res).toMatchObject({ releases: [{ version: '0.0.1' }] }); @@ -289,7 +292,7 @@ describe('modules/datasource/index', () => { datasources.set(datasource, new DummyDatasource2()); const res = await getPkgReleases({ datasource, - depName, + packageName, }); expect(res).toMatchObject({ releases: [{ version: '1.2.3' }], @@ -301,7 +304,7 @@ describe('modules/datasource/index', () => { datasources.set(datasource, new DummyDatasource3()); const res = await getPkgReleases({ datasource, - depName, + packageName, }); expect(res).toMatchObject({ releases: [{ version: '1.2.3' }], @@ -319,7 +322,7 @@ describe('modules/datasource/index', () => { const res = await getPkgReleases({ datasource, - depName, + packageName, extractVersion: '^(?v\\d+\\.\\d+)', versioning: 'loose', }); @@ -338,7 +341,7 @@ describe('modules/datasource/index', () => { ); const res = await getPkgReleases({ datasource, - depName: 'foobar', + packageName: 'foobar', }); expect(res).toMatchObject({ sourceUrl: 'https://abc.com' }); }); @@ -355,7 +358,7 @@ describe('modules/datasource/index', () => { ); const res = await getPkgReleases({ datasource, - depName: 'foobar', + packageName: 'foobar', }); expect(res).toMatchObject({ sourceUrl: 'https://github.com/Jasig/cas' }); }); @@ -364,7 +367,7 @@ describe('modules/datasource/index', () => { datasources.set(datasource, new DummyDatasource()); const res = await getPkgReleases({ datasource, - depName, + packageName, replacementName: 'def', replacementVersion: '2.0.0', }); @@ -385,7 +388,7 @@ describe('modules/datasource/index', () => { const res = await getPkgReleases({ datasource, - depName, + packageName, registryUrls: ['https://reg1.com'], }); @@ -407,7 +410,7 @@ describe('modules/datasource/index', () => { const res = await getPkgReleases({ datasource, - depName, + packageName, registryUrls, }); @@ -418,7 +421,7 @@ describe('modules/datasource/index', () => { expect(logger.logger.warn).toHaveBeenCalledWith( { datasource: 'dummy', - depName: 'package', + packageName: 'package', registryUrls, }, 'Excess registryUrls found for datasource lookup - using first configured only' @@ -435,13 +438,13 @@ describe('modules/datasource/index', () => { const res = await getPkgReleases({ datasource, - depName, + packageName, registryUrls, }); expect(res).toBeNull(); expect(logger.logger.warn).toHaveBeenCalledWith( - { datasource, depName, registryUrls }, + { datasource, packageName, registryUrls }, 'Excess registryUrls found for datasource lookup - using first configured only' ); }); @@ -478,7 +481,7 @@ describe('modules/datasource/index', () => { }); it('merges custom defaultRegistryUrls and returns success', async () => { - const res = await getPkgReleases({ datasource, depName }); + const res = await getPkgReleases({ datasource, packageName }); expect(res).toMatchObject({ releases: [ @@ -491,7 +494,7 @@ describe('modules/datasource/index', () => { it('ignores custom defaultRegistryUrls if registrUrls are set', async () => { const res = await getPkgReleases({ datasource, - depName, + packageName, defaultRegistryUrls: ['https://reg3.com'], registryUrls: ['https://reg1.com', 'https://reg2.com'], }); @@ -507,7 +510,7 @@ describe('modules/datasource/index', () => { it('merges registries and returns success', async () => { const res = await getPkgReleases({ datasource, - depName, + packageName, registryUrls: ['https://reg1.com', 'https://reg2.com'], }); expect(res).toMatchObject({ @@ -522,7 +525,7 @@ describe('modules/datasource/index', () => { await expect( getPkgReleases({ datasource, - depName, + packageName, registryUrls: [ 'https://reg1.com', 'https://reg2.com', @@ -536,7 +539,7 @@ describe('modules/datasource/index', () => { expect( await getPkgReleases({ datasource, - depName, + packageName, registryUrls: ['https://reg4.com', 'https://reg5.com'], }) ).toBeNull(); @@ -563,7 +566,7 @@ describe('modules/datasource/index', () => { const res = await getPkgReleases({ datasource, - depName, + packageName, registryUrls, }); @@ -585,7 +588,7 @@ describe('modules/datasource/index', () => { const res = await getPkgReleases({ datasource, - depName, + packageName, registryUrls, }); @@ -603,7 +606,7 @@ describe('modules/datasource/index', () => { datasources.set(datasource, new HuntRegistriyDatasource(registries)); await expect( - getPkgReleases({ datasource, depName, registryUrls }) + getPkgReleases({ datasource, packageName, registryUrls }) ).rejects.toThrow(EXTERNAL_HOST_ERROR); }); @@ -621,7 +624,7 @@ describe('modules/datasource/index', () => { const res = await getPkgReleases({ datasource, - depName, + packageName, registryUrls, }); @@ -649,7 +652,7 @@ describe('modules/datasource/index', () => { datasources.set(datasource, new DummyDatasource(registries)); const res = await getPkgReleases({ datasource, - depName, + packageName, defaultRegistryUrls: ['https://foo.bar'], }); expect(res).toMatchObject({ @@ -676,7 +679,7 @@ describe('modules/datasource/index', () => { datasources.set(datasource, new DummyDatasource(registries)); const res = await getPkgReleases({ datasource, - depName, + packageName, defaultRegistryUrls: ['https://foo.bar'], constraints: { python: '2.7.0', @@ -709,7 +712,7 @@ describe('modules/datasource/index', () => { datasources.set(datasource, new DummyDatasource(registries)); const res = await getPkgReleases({ datasource, - depName, + packageName, defaultRegistryUrls: ['https://foo.bar'], constraints: { python: '2.7.0' }, constraintsFiltering: 'strict', diff --git a/lib/modules/datasource/index.ts b/lib/modules/datasource/index.ts index 21caf1a79444c6..0452ae6c54838f 100644 --- a/lib/modules/datasource/index.ts +++ b/lib/modules/datasource/index.ts @@ -90,7 +90,11 @@ function firstRegistry( ): Promise { if (registryUrls.length > 1) { logger.warn( - { datasource: datasource.id, depName: config.depName, registryUrls }, + { + datasource: datasource.id, + packageName: config.packageName, + registryUrls, + }, 'Excess registryUrls found for datasource lookup - using first configured only' ); } @@ -342,7 +346,7 @@ export async function getPkgReleases( logger.warn('No datasource found'); return null; } - const packageName = config.packageName ?? config.depName; + const packageName = config.packageName; if (!packageName) { logger.error({ config }, 'Datasource getReleases without packageName'); return null; @@ -436,8 +440,7 @@ function getDigestConfig( config: GetDigestInputConfig ): DigestConfig { const { currentValue, currentDigest } = config; - const packageName = - config.replacementName ?? config.packageName ?? config.depName; + const packageName = config.replacementName ?? config.packageName; const [registryUrl] = resolveRegistryUrls( datasource, config.defaultRegistryUrls, diff --git a/lib/modules/datasource/java-version/index.spec.ts b/lib/modules/datasource/java-version/index.spec.ts index d660e43a8fb297..a383933bde5187 100644 --- a/lib/modules/datasource/java-version/index.spec.ts +++ b/lib/modules/datasource/java-version/index.spec.ts @@ -9,7 +9,7 @@ function getPath(page: number, imageType = 'jdk'): string { return `/v3/info/release_versions?page_size=${pageSize}&image_type=${imageType}&project=jdk&release_type=ga&sort_method=DATE&sort_order=DESC&page=${page}`; } -const depName = 'java'; +const packageName = 'java'; describe('modules/datasource/java-version/index', () => { describe('getReleases', () => { @@ -21,7 +21,7 @@ describe('modules/datasource/java-version/index', () => { await expect( getPkgReleases({ datasource, - depName, + packageName, }) ).rejects.toThrow(EXTERNAL_HOST_ERROR); }); @@ -31,7 +31,7 @@ describe('modules/datasource/java-version/index', () => { expect( await getPkgReleases({ datasource, - depName, + packageName, }) ).toBeNull(); }); @@ -41,7 +41,7 @@ describe('modules/datasource/java-version/index', () => { expect( await getPkgReleases({ datasource, - depName, + packageName, }) ).toBeNull(); }); @@ -54,7 +54,7 @@ describe('modules/datasource/java-version/index', () => { expect( await getPkgReleases({ datasource, - depName, + packageName, }) ).toBeNull(); }); @@ -64,7 +64,7 @@ describe('modules/datasource/java-version/index', () => { await expect( getPkgReleases({ datasource, - depName, + packageName, }) ).rejects.toThrow(EXTERNAL_HOST_ERROR); }); @@ -76,7 +76,7 @@ describe('modules/datasource/java-version/index', () => { .reply(200, Fixtures.get('page.json')); const res = await getPkgReleases({ datasource, - depName, + packageName, }); expect(res).toMatchSnapshot(); expect(res?.releases).toHaveLength(3); @@ -89,7 +89,7 @@ describe('modules/datasource/java-version/index', () => { .reply(200, Fixtures.get('jre.json')); const res = await getPkgReleases({ datasource, - depName: 'java-jre', + packageName: 'java-jre', }); expect(res).toMatchSnapshot(); expect(res?.releases).toHaveLength(2); @@ -107,7 +107,7 @@ describe('modules/datasource/java-version/index', () => { .reply(404); const res = await getPkgReleases({ datasource, - depName, + packageName, }); expect(res).toMatchSnapshot(); expect(res?.releases).toHaveLength(50); diff --git a/lib/modules/datasource/jenkins-plugins/index.spec.ts b/lib/modules/datasource/jenkins-plugins/index.spec.ts index 00a0681a19eaca..19b5af60ceeef7 100644 --- a/lib/modules/datasource/jenkins-plugins/index.spec.ts +++ b/lib/modules/datasource/jenkins-plugins/index.spec.ts @@ -12,7 +12,7 @@ describe('modules/datasource/jenkins-plugins/index', () => { const params = { versioning: versioning.id, datasource: JenkinsPluginsDatasource.id, - depName: 'email-ext', + packageName: 'email-ext', registryUrls: ['https://updates.jenkins.io/'], }; @@ -24,7 +24,7 @@ describe('modules/datasource/jenkins-plugins/index', () => { it('returns null for a package miss', async () => { const newparams = { ...params }; - newparams.depName = 'non-existing'; + newparams.packageName = 'non-existing'; httpMock .scope('https://updates.jenkins.io') diff --git a/lib/modules/datasource/kubernetes-api/index.spec.ts b/lib/modules/datasource/kubernetes-api/index.spec.ts index 73542d86e26d4b..d4b2a954e4ca93 100644 --- a/lib/modules/datasource/kubernetes-api/index.spec.ts +++ b/lib/modules/datasource/kubernetes-api/index.spec.ts @@ -6,14 +6,14 @@ const datasource = KubernetesApiDatasource.id; describe('modules/datasource/kubernetes-api/index', () => { describe('getReleases', () => { it('returns null for an unknown Kubernetes API type', async () => { - const res = await getPkgReleases({ datasource, depName: 'Unknown' }); + const res = await getPkgReleases({ datasource, packageName: 'Unknown' }); expect(res).toBeNull(); }); it('returns for a known Kubernetes API type', async () => { const res = await getPkgReleases({ datasource, - depName: 'CSIStorageCapacity', + packageName: 'CSIStorageCapacity', }); expect(res).not.toBeNull(); expect(res).toStrictEqual({ @@ -27,7 +27,7 @@ describe('modules/datasource/kubernetes-api/index', () => { it('is case sensitive', async () => { const res = await getPkgReleases({ datasource, - depName: 'csistoragecapacity', + packageName: 'csistoragecapacity', }); expect(res).toBeNull(); }); diff --git a/lib/modules/datasource/maven/index.spec.ts b/lib/modules/datasource/maven/index.spec.ts index 78cb193587e1d6..0366e8b408d331 100644 --- a/lib/modules/datasource/maven/index.spec.ts +++ b/lib/modules/datasource/maven/index.spec.ts @@ -162,10 +162,10 @@ function mockGenericPackage(opts: MockOpts = {}) { } function get( - depName = 'org.example:package', + packageName = 'org.example:package', ...registryUrls: string[] ): Promise { - const conf = { versioning, datasource, depName }; + const conf = { versioning, datasource, packageName }; return getPkgReleases(registryUrls ? { ...conf, registryUrls } : conf); } diff --git a/lib/modules/datasource/maven/s3.spec.ts b/lib/modules/datasource/maven/s3.spec.ts index 6fa44058decc22..0952dad7488645 100644 --- a/lib/modules/datasource/maven/s3.spec.ts +++ b/lib/modules/datasource/maven/s3.spec.ts @@ -18,10 +18,10 @@ const datasource = MavenDatasource.id; const baseUrlS3 = 's3://repobucket'; function get( - depName = 'org.example:package', + packageName = 'org.example:package', ...registryUrls: string[] ): Promise { - const conf = { versioning, datasource, depName }; + const conf = { versioning, datasource, packageName }; return getPkgReleases(registryUrls ? { ...conf, registryUrls } : conf); } diff --git a/lib/modules/datasource/node/index.spec.ts b/lib/modules/datasource/node/index.spec.ts index 234b60e39a8db0..1a68ce8a7506e4 100644 --- a/lib/modules/datasource/node/index.spec.ts +++ b/lib/modules/datasource/node/index.spec.ts @@ -11,7 +11,7 @@ describe('modules/datasource/node/index', () => { await expect( getPkgReleases({ datasource, - depName: 'node', + packageName: 'node', }) ).rejects.toThrow(EXTERNAL_HOST_ERROR); }); @@ -24,7 +24,7 @@ describe('modules/datasource/node/index', () => { expect( await getPkgReleases({ datasource, - depName: 'node', + packageName: 'node', }) ).toBeNull(); }); @@ -34,7 +34,7 @@ describe('modules/datasource/node/index', () => { expect( await getPkgReleases({ datasource, - depName: 'node', + packageName: 'node', }) ).toBeNull(); }); @@ -46,7 +46,7 @@ describe('modules/datasource/node/index', () => { .reply(200, Fixtures.get('index.json')); const res = await getPkgReleases({ datasource, - depName: 'node', + packageName: 'node', }); expect(res).toMatchSnapshot(); expect(res?.releases).toHaveLength(64); diff --git a/lib/modules/datasource/npm/index.spec.ts b/lib/modules/datasource/npm/index.spec.ts index c40aff8a397f05..51727b1f4b58e5 100644 --- a/lib/modules/datasource/npm/index.spec.ts +++ b/lib/modules/datasource/npm/index.spec.ts @@ -56,7 +56,7 @@ describe('modules/datasource/npm/index', () => { .scope('https://registry.npmjs.org') .get('/foobar') .reply(200, missingVersions); - const res = await getPkgReleases({ datasource, depName: 'foobar' }); + const res = await getPkgReleases({ datasource, packageName: 'foobar' }); expect(res).toBeNull(); }); @@ -65,7 +65,7 @@ describe('modules/datasource/npm/index', () => { .scope('https://registry.npmjs.org') .get('/foobar') .reply(200, npmResponse); - const res = await getPkgReleases({ datasource, depName: 'foobar' }); + const res = await getPkgReleases({ datasource, packageName: 'foobar' }); expect(res).toMatchSnapshot(); }); @@ -89,7 +89,7 @@ describe('modules/datasource/npm/index', () => { }, }; httpMock.scope('https://registry.npmjs.org').get('/foobar').reply(200, pkg); - const res = await getPkgReleases({ datasource, depName: 'foobar' }); + const res = await getPkgReleases({ datasource, packageName: 'foobar' }); expect(res).toMatchSnapshot(); expect(res?.sourceUrl).toBeDefined(); }); @@ -110,7 +110,7 @@ describe('modules/datasource/npm/index', () => { }, }; httpMock.scope('https://registry.npmjs.org').get('/foobar').reply(200, pkg); - const res = await getPkgReleases({ datasource, depName: 'foobar' }); + const res = await getPkgReleases({ datasource, packageName: 'foobar' }); expect(res).toMatchSnapshot(); expect(res?.sourceUrl).toBeDefined(); }); @@ -143,7 +143,7 @@ describe('modules/datasource/npm/index', () => { .scope('https://registry.npmjs.org') .get('/foobar') .reply(200, deprecatedPackage); - const res = await getPkgReleases({ datasource, depName: 'foobar' }); + const res = await getPkgReleases({ datasource, packageName: 'foobar' }); expect(res).toMatchSnapshot(); expect(res?.deprecationMessage).toMatchSnapshot(); }); @@ -153,7 +153,7 @@ describe('modules/datasource/npm/index', () => { .scope('https://registry.npmjs.org') .get('/foobar') .reply(200, npmResponse); - const res = await getPkgReleases({ datasource, depName: 'foobar' }); + const res = await getPkgReleases({ datasource, packageName: 'foobar' }); expect(res).toMatchSnapshot(); }); @@ -163,19 +163,19 @@ describe('modules/datasource/npm/index', () => { .scope('https://registry.npmjs.org') .get('/foobar') .reply(200, npmResponse); - const res = await getPkgReleases({ datasource, depName: 'foobar' }); + const res = await getPkgReleases({ datasource, packageName: 'foobar' }); expect(res).toMatchSnapshot(); }); it('should return null if lookup fails 401', async () => { httpMock.scope('https://registry.npmjs.org').get('/foobar').reply(401); - const res = await getPkgReleases({ datasource, depName: 'foobar' }); + const res = await getPkgReleases({ datasource, packageName: 'foobar' }); expect(res).toBeNull(); }); it('should return null if lookup fails', async () => { httpMock.scope('https://registry.npmjs.org').get('/foobar').reply(404); - const res = await getPkgReleases({ datasource, depName: 'foobar' }); + const res = await getPkgReleases({ datasource, packageName: 'foobar' }); expect(res).toBeNull(); }); @@ -185,35 +185,35 @@ describe('modules/datasource/npm/index', () => { .get('/foobar') .reply(200, 'oops'); await expect( - getPkgReleases({ datasource, depName: 'foobar' }) + getPkgReleases({ datasource, packageName: 'foobar' }) ).rejects.toThrow(); }); it('should throw error for 429', async () => { httpMock.scope('https://registry.npmjs.org').get('/foobar').reply(429); await expect( - getPkgReleases({ datasource, depName: 'foobar' }) + getPkgReleases({ datasource, packageName: 'foobar' }) ).rejects.toThrow(); }); it('should throw error for 5xx', async () => { httpMock.scope('https://registry.npmjs.org').get('/foobar').reply(503); await expect( - getPkgReleases({ datasource, depName: 'foobar' }) + getPkgReleases({ datasource, packageName: 'foobar' }) ).rejects.toThrow(EXTERNAL_HOST_ERROR); }); it('should throw error for 408', async () => { httpMock.scope('https://registry.npmjs.org').get('/foobar').reply(408); await expect( - getPkgReleases({ datasource, depName: 'foobar' }) + getPkgReleases({ datasource, packageName: 'foobar' }) ).rejects.toThrow(EXTERNAL_HOST_ERROR); }); it('should throw error for others', async () => { httpMock.scope('https://registry.npmjs.org').get('/foobar').reply(451); await expect( - getPkgReleases({ datasource, depName: 'foobar' }) + getPkgReleases({ datasource, packageName: 'foobar' }) ).rejects.toThrow(); }); @@ -224,7 +224,7 @@ describe('modules/datasource/npm/index', () => { }) .get('/foobar') .reply(200, npmResponse); - const res = await getPkgReleases({ datasource, depName: 'foobar' }); + const res = await getPkgReleases({ datasource, packageName: 'foobar' }); expect(res).toMatchSnapshot(); }); @@ -237,7 +237,7 @@ describe('modules/datasource/npm/index', () => { .reply(200, { ...npmResponse, name: '@foobar/core' }); const res = await getPkgReleases({ datasource, - depName: '@foobar/core', + packageName: '@foobar/core', npmrc: '_auth = 1234', }); expect(res).toMatchSnapshot(); @@ -256,7 +256,11 @@ describe('modules/datasource/npm/index', () => { .get('/foobar') .reply(200, npmResponse); const npmrc = 'registry=https://npm.mycustomregistry.com/'; - const res = await getPkgReleases({ datasource, depName: 'foobar', npmrc }); + const res = await getPkgReleases({ + datasource, + packageName: 'foobar', + npmrc, + }); expect(res).toMatchSnapshot(); }); @@ -278,7 +282,11 @@ describe('modules/datasource/npm/index', () => { .reply(200, npmResponse); const npmrc = 'registry=https://npm.mycustomregistry.com/_packaging/mycustomregistry/npm/registry/'; - const res = await getPkgReleases({ datasource, depName: 'foobar', npmrc }); + const res = await getPkgReleases({ + datasource, + packageName: 'foobar', + npmrc, + }); expect(res).toMatchSnapshot(); }); @@ -295,7 +303,11 @@ describe('modules/datasource/npm/index', () => { .get('/foobar') .reply(200, npmResponse); const npmrc = 'foo=bar'; - const res = await getPkgReleases({ datasource, depName: 'foobar', npmrc }); + const res = await getPkgReleases({ + datasource, + packageName: 'foobar', + npmrc, + }); expect(res).toMatchSnapshot(); }); @@ -305,7 +317,11 @@ describe('modules/datasource/npm/index', () => { .get('/foobar') .reply(200, npmResponse); const npmrc = `registry=https://npm.mycustomregistry.com/`; - const res = await getPkgReleases({ datasource, depName: 'foobar', npmrc }); + const res = await getPkgReleases({ + datasource, + packageName: 'foobar', + npmrc, + }); expect(res).toMatchSnapshot(); }); @@ -319,7 +335,11 @@ describe('modules/datasource/npm/index', () => { GlobalConfig.set({ exposeAllEnv: true }); const npmrc = 'registry=${REGISTRY}'; - const res = await getPkgReleases({ datasource, depName: 'foobar', npmrc }); + const res = await getPkgReleases({ + datasource, + packageName: 'foobar', + npmrc, + }); expect(res).toMatchSnapshot(); }); diff --git a/lib/modules/datasource/nuget/index.spec.ts b/lib/modules/datasource/nuget/index.spec.ts index bdc2c914a72734..43e38f25ee56a8 100644 --- a/lib/modules/datasource/nuget/index.spec.ts +++ b/lib/modules/datasource/nuget/index.spec.ts @@ -55,7 +55,7 @@ const nlogMocks = [ const configV3V2 = { datasource, versioning, - depName: 'nunit', + packageName: 'nunit', registryUrls: [ 'https://api.nuget.org/v3/index.json', 'https://www.nuget.org/api/v2/', @@ -65,28 +65,28 @@ const configV3V2 = { const configV2 = { datasource, versioning, - depName: 'nunit', + packageName: 'nunit', registryUrls: ['https://www.nuget.org/api/v2/'], }; const configV3 = { datasource, versioning, - depName: 'nunit', + packageName: 'nunit', registryUrls: ['https://api.nuget.org/v3/index.json'], }; const configV3NotNugetOrg = { datasource, versioning, - depName: 'nunit', + packageName: 'nunit', registryUrls: ['https://myprivatefeed/index.json'], }; const configV3Multiple = { datasource, versioning, - depName: 'nunit', + packageName: 'nunit', registryUrls: [ 'https://api.nuget.org/v3/index.json', 'https://myprivatefeed/index.json', @@ -139,7 +139,7 @@ describe('modules/datasource/nuget/index', () => { const config = { datasource, versioning, - depName: 'nunit', + packageName: 'nunit', registryUrls: ['#$#api.nuget.org/v3/index.xml'], }; @@ -155,7 +155,7 @@ describe('modules/datasource/nuget/index', () => { const config = { datasource, versioning, - depName: 'nunit', + packageName: 'nunit', registryUrls: ['https://my-registry#protocolVersion=3'], }; expect( @@ -389,7 +389,7 @@ describe('modules/datasource/nuget/index', () => { }); const res = await getPkgReleases({ ...configV3, - depName: 'nlog', + packageName: 'nlog', }); expect(res).not.toBeNull(); expect(res).toMatchSnapshot(); diff --git a/lib/modules/datasource/orb/index.spec.ts b/lib/modules/datasource/orb/index.spec.ts index be25548915af2c..2e66d028740b4c 100644 --- a/lib/modules/datasource/orb/index.spec.ts +++ b/lib/modules/datasource/orb/index.spec.ts @@ -34,7 +34,7 @@ describe('modules/datasource/orb/index', () => { expect( await getPkgReleases({ datasource, - depName: 'hyper-expanse/library-release-workflows', + packageName: 'hyper-expanse/library-release-workflows', }) ).toBeNull(); }); @@ -47,7 +47,7 @@ describe('modules/datasource/orb/index', () => { expect( await getPkgReleases({ datasource, - depName: 'hyper-expanse/library-release-wonkflows', + packageName: 'hyper-expanse/library-release-wonkflows', }) ).toBeNull(); }); @@ -57,7 +57,7 @@ describe('modules/datasource/orb/index', () => { expect( await getPkgReleases({ datasource, - depName: 'hyper-expanse/library-release-workflows', + packageName: 'hyper-expanse/library-release-workflows', }) ).toBeNull(); }); @@ -67,7 +67,7 @@ describe('modules/datasource/orb/index', () => { expect( await getPkgReleases({ datasource, - depName: 'hyper-expanse/library-release-workflows', + packageName: 'hyper-expanse/library-release-workflows', }) ).toBeNull(); }); @@ -76,7 +76,7 @@ describe('modules/datasource/orb/index', () => { httpMock.scope(baseUrl).post('/graphql-unstable').reply(200, orbData); const res = await getPkgReleases({ datasource, - depName: 'hyper-expanse/library-release-workflows', + packageName: 'hyper-expanse/library-release-workflows', }); expect(res).toMatchSnapshot(); expect(res).not.toBeNull(); @@ -87,7 +87,7 @@ describe('modules/datasource/orb/index', () => { httpMock.scope(baseUrl).post('/graphql-unstable').reply(200, orbData); const res = await getPkgReleases({ datasource, - depName: 'hyper-expanse/library-release-workflows', + packageName: 'hyper-expanse/library-release-workflows', }); expect(res).toMatchSnapshot(); expect(res?.homepage).toBe('https://google.com'); diff --git a/lib/modules/datasource/packagist/index.spec.ts b/lib/modules/datasource/packagist/index.spec.ts index 88d6775fe1c46d..e9f0984404ce77 100644 --- a/lib/modules/datasource/packagist/index.spec.ts +++ b/lib/modules/datasource/packagist/index.spec.ts @@ -48,7 +48,7 @@ describe('modules/datasource/packagist/index', () => { ...config, datasource, versioning, - depName: 'something/one', + packageName: 'something/one', }); expect(res).toBeNull(); }); @@ -72,7 +72,7 @@ describe('modules/datasource/packagist/index', () => { ...config, datasource, versioning, - depName: 'vendor/package-name', + packageName: 'vendor/package-name', }); expect(res).toMatchSnapshot(); }); @@ -92,7 +92,7 @@ describe('modules/datasource/packagist/index', () => { ...config, datasource, versioning, - depName: 'vendor/package-name2', + packageName: 'vendor/package-name2', }); expect(res).toBeNull(); }); @@ -112,7 +112,7 @@ describe('modules/datasource/packagist/index', () => { ...config, datasource, versioning, - depName: 'vendor/package-name', + packageName: 'vendor/package-name', }); expect(res).toBeNull(); }); @@ -132,7 +132,7 @@ describe('modules/datasource/packagist/index', () => { ...config, datasource, versioning, - depName: 'drewm/mailchimp-api', + packageName: 'drewm/mailchimp-api', }); expect(res).toBeNull(); }); @@ -160,7 +160,7 @@ describe('modules/datasource/packagist/index', () => { ...config, datasource, versioning, - depName: 'guzzlehttp/guzzle', + packageName: 'guzzlehttp/guzzle', }); expect(res).toMatchSnapshot(); expect(res).not.toBeNull(); @@ -199,7 +199,7 @@ describe('modules/datasource/packagist/index', () => { ...config, datasource, versioning, - depName: 'guzzlehttp/guzzle', + packageName: 'guzzlehttp/guzzle', }); expect(res).toMatchSnapshot(); expect(res).not.toBeNull(); @@ -244,7 +244,7 @@ describe('modules/datasource/packagist/index', () => { ...config, datasource, versioning, - depName: 'wpackagist-plugin/1beyt', + packageName: 'wpackagist-plugin/1beyt', }); expect(res).toMatchSnapshot(); expect(res).not.toBeNull(); @@ -291,7 +291,7 @@ describe('modules/datasource/packagist/index', () => { ...config, datasource, versioning, - depName: 'some/other', + packageName: 'some/other', }); expect(res).toBeNull(); }); @@ -323,7 +323,7 @@ describe('modules/datasource/packagist/index', () => { ...config, datasource, versioning, - depName: 'wpackagist-plugin/1beyt', + packageName: 'wpackagist-plugin/1beyt', }); expect(res).toMatchSnapshot(); expect(res).not.toBeNull(); @@ -352,7 +352,7 @@ describe('modules/datasource/packagist/index', () => { ...config, datasource, versioning, - depName: 'wpackagist-plugin/1beyt', + packageName: 'wpackagist-plugin/1beyt', }); expect(res).toMatchSnapshot(); expect(res).not.toBeNull(); @@ -387,7 +387,7 @@ describe('modules/datasource/packagist/index', () => { ...config, datasource, versioning, - depName: 'some/other', + packageName: 'some/other', }); expect(res).toBeNull(); }); @@ -407,7 +407,7 @@ describe('modules/datasource/packagist/index', () => { ...config, datasource, versioning, - depName: 'drewm/mailchimp-api', + packageName: 'drewm/mailchimp-api', }) ).toMatchSnapshot(); }); @@ -427,7 +427,7 @@ describe('modules/datasource/packagist/index', () => { ...config, datasource, versioning, - depName: 'drewm/mailchimp-api', + packageName: 'drewm/mailchimp-api', }) ).toMatchSnapshot(); }); diff --git a/lib/modules/datasource/pod/index.spec.ts b/lib/modules/datasource/pod/index.spec.ts index 96d71bdf59871e..3f90ac87f0dd11 100644 --- a/lib/modules/datasource/pod/index.spec.ts +++ b/lib/modules/datasource/pod/index.spec.ts @@ -7,7 +7,7 @@ import { PodDatasource } from '.'; const config = { versioning: rubyVersioning.id, datasource: PodDatasource.id, - depName: 'foo', + packageName: 'foo', registryUrls: [], }; @@ -31,7 +31,7 @@ describe('modules/datasource/pod/index', () => { expect( await getPkgReleases({ datasource: PodDatasource.id, - depName: 'foobar', + packageName: 'foobar', registryUrls: [], }) ).toBeNull(); diff --git a/lib/modules/datasource/puppet-forge/index.spec.ts b/lib/modules/datasource/puppet-forge/index.spec.ts index c9bf5bdb481e4f..d4430baeb972d0 100644 --- a/lib/modules/datasource/puppet-forge/index.spec.ts +++ b/lib/modules/datasource/puppet-forge/index.spec.ts @@ -18,7 +18,6 @@ describe('modules/datasource/puppet-forge/index', () => { const res = await getPkgReleases({ datasource, - depName: 'puppetlabs/apache', packageName: 'puppetlabs/apache', }); expect(res).toMatchObject({ @@ -41,7 +40,6 @@ describe('modules/datasource/puppet-forge/index', () => { const res = await getPkgReleases({ datasource, - depName: 'puppetlabs/apache', packageName: 'puppetlabs/apache', registryUrls: ['https://forgeapi.puppet.com'], }); @@ -87,7 +85,6 @@ describe('modules/datasource/puppet-forge/index', () => { const res = await getPkgReleases({ datasource, - depName: 'puppetlabs/apache', packageName: 'puppetlabs/apache', }); expect(res).toEqual({ @@ -116,7 +113,7 @@ describe('modules/datasource/puppet-forge/index', () => { const res = await getPkgReleases({ datasource, - depName: 'foobar', + packageName: 'foobar', registryUrls: ['https://forgeapi.puppet.com'], }); expect(res).toBeNull(); @@ -131,7 +128,7 @@ describe('modules/datasource/puppet-forge/index', () => { .reply(404); const res = await getPkgReleases({ datasource, - depName: 'foobar', + packageName: 'foobar', registryUrls: ['https://forgeapi.puppet.com'], }); expect(res).toBeNull(); @@ -146,7 +143,7 @@ describe('modules/datasource/puppet-forge/index', () => { const registryUrls = ['https://puppet.mycustomregistry.com']; const res = await getPkgReleases({ datasource, - depName: 'foobar', + packageName: 'foobar', registryUrls, }); @@ -191,7 +188,7 @@ describe('modules/datasource/puppet-forge/index', () => { const res = await getPkgReleases({ datasource, - depName: 'foobar', + packageName: 'foobar', }); expect(res).toEqual({ @@ -217,7 +214,7 @@ describe('modules/datasource/puppet-forge/index', () => { const res = await getPkgReleases({ datasource, - depName: 'foobar', + packageName: 'foobar', }); expect(res).toBeNull(); diff --git a/lib/modules/datasource/pypi/index.spec.ts b/lib/modules/datasource/pypi/index.spec.ts index 6f7123a3d53d74..7e2df584b795c9 100644 --- a/lib/modules/datasource/pypi/index.spec.ts +++ b/lib/modules/datasource/pypi/index.spec.ts @@ -38,7 +38,7 @@ describe('modules/datasource/pypi/index', () => { expect( await getPkgReleases({ datasource, - depName: 'something', + packageName: 'something', }) ).toBeNull(); }); @@ -49,7 +49,7 @@ describe('modules/datasource/pypi/index', () => { expect( await getPkgReleases({ datasource, - depName: 'something', + packageName: 'something', }) ).toBeNull(); }); @@ -59,7 +59,7 @@ describe('modules/datasource/pypi/index', () => { expect( await getPkgReleases({ datasource, - depName: 'azure-cli-monitor', + packageName: 'azure-cli-monitor', }) ).toMatchSnapshot(); }); @@ -76,7 +76,7 @@ describe('modules/datasource/pypi/index', () => { await getPkgReleases({ ...config, datasource, - depName: 'azure-cli-monitor', + packageName: 'azure-cli-monitor', }) ).toMatchObject({ registryUrl: 'https://custom.pypi.net/foo', @@ -97,7 +97,7 @@ describe('modules/datasource/pypi/index', () => { const res = await getPkgReleases({ ...config, datasource, - depName: 'azure-cli-monitor', + packageName: 'azure-cli-monitor', }); expect(res?.isPrivate).toBeTrue(); }); @@ -125,7 +125,7 @@ describe('modules/datasource/pypi/index', () => { const res = await getPkgReleases({ ...config, datasource, - depName: 'azure-cli-monitor', + packageName: 'azure-cli-monitor', }); expect(res?.releases.pop()).toMatchObject({ version: '0.2.15', @@ -148,7 +148,7 @@ describe('modules/datasource/pypi/index', () => { ( await getPkgReleases({ datasource, - depName: 'something', + packageName: 'something', }) )?.homepage ).toBe('https://microsoft.com'); @@ -172,7 +172,7 @@ describe('modules/datasource/pypi/index', () => { .reply(200, { ...JSON.parse(res1), info }); const result = await getPkgReleases({ datasource, - depName: 'flexget', + packageName: 'flexget', }); expect(result?.sourceUrl).toBe(info.project_urls.Repository); expect(result?.changelogUrl).toBe(info.project_urls.changelog); @@ -192,7 +192,7 @@ describe('modules/datasource/pypi/index', () => { .reply(200, { ...JSON.parse(res1), info }); const result = await getPkgReleases({ datasource, - depName: 'flexget', + packageName: 'flexget', }); expect(result?.sourceUrl).toBeUndefined(); }); @@ -206,7 +206,7 @@ describe('modules/datasource/pypi/index', () => { await getPkgReleases({ datasource, registryUrls: [baseUrl], - depName: 'not_normalized.Package', + packageName: 'not_normalized.Package', }); expect(expectedHttpCall.isDone()).toBeTrue(); @@ -225,7 +225,7 @@ describe('modules/datasource/pypi/index', () => { await getPkgReleases({ datasource, registryUrls: [baseUrl], - depName: 'not_normalized.Package', + packageName: 'not_normalized.Package', }); expect(expectedFallbackHttpCall.isDone()).toBeTrue(); @@ -241,7 +241,7 @@ describe('modules/datasource/pypi/index', () => { await getPkgReleases({ datasource, registryUrls: [simpleRegistryUrl], - depName: 'not_normalized.Package', + packageName: 'not_normalized.Package', }); expect(expectedHttpCall.isDone()).toBeTrue(); @@ -270,7 +270,7 @@ describe('modules/datasource/pypi/index', () => { await getPkgReleases({ datasource, constraints: { python: '2.7' }, - depName: 'doit', + packageName: 'doit', constraintsFiltering: 'strict', }) ).toMatchSnapshot(); @@ -289,7 +289,7 @@ describe('modules/datasource/pypi/index', () => { datasource, ...config, constraints: { python: '2.7' }, - depName: 'dj-database-url', + packageName: 'dj-database-url', }) ).toMatchSnapshot(); }); @@ -307,7 +307,7 @@ describe('modules/datasource/pypi/index', () => { datasource, ...config, constraints: { python: '2.7' }, - depName: 'dj-database-url', + packageName: 'dj-database-url', }) ).toMatchSnapshot(); }); @@ -328,7 +328,7 @@ describe('modules/datasource/pypi/index', () => { datasource, ...config, constraints: { python: '2.7' }, - depName: 'dj-database-url', + packageName: 'dj-database-url', }); expect(res?.isPrivate).toBeTrue(); }); @@ -344,7 +344,7 @@ describe('modules/datasource/pypi/index', () => { const res = await getPkgReleases({ datasource, ...config, - depName: 'package--with-hyphens', + packageName: 'package--with-hyphens', }); expect(res?.releases).toMatchObject([ { version: '2.0.0' }, @@ -366,7 +366,7 @@ describe('modules/datasource/pypi/index', () => { datasource, ...config, constraints: { python: '2.7' }, - depName: 'image-collector', + packageName: 'image-collector', }) ).toMatchSnapshot(); }); @@ -382,7 +382,7 @@ describe('modules/datasource/pypi/index', () => { const res = await getPkgReleases({ datasource, ...config, - depName: 'PackageWithMixedCase', + packageName: 'PackageWithMixedCase', }); expect(res?.releases).toMatchObject([ { version: '2.0.0' }, @@ -402,7 +402,7 @@ describe('modules/datasource/pypi/index', () => { const res = await getPkgReleases({ datasource, ...config, - depName: 'packagewithmixedcase', + packageName: 'packagewithmixedcase', }); expect(res?.releases).toMatchObject([ { version: '2.0.0' }, @@ -422,7 +422,7 @@ describe('modules/datasource/pypi/index', () => { const res = await getPkgReleases({ datasource, ...config, - depName: 'package.with.periods', + packageName: 'package.with.periods', }); expect(res?.releases).toMatchObject([ { version: '2.0.0' }, @@ -444,7 +444,7 @@ describe('modules/datasource/pypi/index', () => { datasource, ...config, constraints: { python: '2.7' }, - depName: 'dj-database-url', + packageName: 'dj-database-url', }) ).toBeNull(); }); @@ -462,7 +462,7 @@ describe('modules/datasource/pypi/index', () => { datasource, ...config, constraints: { python: '2.7' }, - depName: 'dj-database-url', + packageName: 'dj-database-url', }) ).toBeNull(); }); @@ -480,7 +480,7 @@ describe('modules/datasource/pypi/index', () => { datasource, ...config, constraints: { python: '2.7' }, - depName: 'dj-database-url', + packageName: 'dj-database-url', }) ).toBeNull(); }); @@ -500,7 +500,7 @@ describe('modules/datasource/pypi/index', () => { const result = await getPkgReleases({ datasource, ...config, - depName: 'dj-database-url', + packageName: 'dj-database-url', }); expect(result).toMatchSnapshot(); }); @@ -518,7 +518,7 @@ describe('modules/datasource/pypi/index', () => { datasource, constraints: { python: '2.7' }, ...config, - depName: 'dj-database-url', + packageName: 'dj-database-url', constraintsFiltering: 'strict', }) ).toMatchSnapshot(); @@ -535,7 +535,7 @@ describe('modules/datasource/pypi/index', () => { datasource, ...config, constraints: { python: '2.7' }, - depName: 'azure-cli-monitor', + packageName: 'azure-cli-monitor', }) ).toMatchSnapshot(); }); diff --git a/lib/modules/datasource/repology/index.spec.ts b/lib/modules/datasource/repology/index.spec.ts index aabb1b9e800be1..7e7df992af3e08 100644 --- a/lib/modules/datasource/repology/index.spec.ts +++ b/lib/modules/datasource/repology/index.spec.ts @@ -71,7 +71,7 @@ describe('modules/datasource/repology/index', () => { await getPkgReleases({ datasource, versioning, - depName: 'debian_stable/nginx', + packageName: 'debian_stable/nginx', }) ).toBeNull(); }); @@ -88,7 +88,7 @@ describe('modules/datasource/repology/index', () => { await getPkgReleases({ datasource, versioning, - depName: 'this_should/never-exist', + packageName: 'this_should/never-exist', }) ).toBeNull(); }); @@ -107,7 +107,7 @@ describe('modules/datasource/repology/index', () => { getPkgReleases({ datasource, versioning, - depName: 'debian_stable/nginx', + packageName: 'debian_stable/nginx', }) ).rejects.toThrow(EXTERNAL_HOST_ERROR); }); @@ -121,7 +121,7 @@ describe('modules/datasource/repology/index', () => { getPkgReleases({ datasource, versioning, - depName: 'debian_stable/nginx', + packageName: 'debian_stable/nginx', }) ).rejects.toThrow(EXTERNAL_HOST_ERROR); }); @@ -139,7 +139,7 @@ describe('modules/datasource/repology/index', () => { getPkgReleases({ datasource, versioning, - depName: 'debian_stable/nginx', + packageName: 'debian_stable/nginx', }) ).rejects.toThrow(EXTERNAL_HOST_ERROR); }); @@ -158,7 +158,7 @@ describe('modules/datasource/repology/index', () => { getPkgReleases({ datasource, versioning, - depName: 'debian_stable/nginx', + packageName: 'debian_stable/nginx', }) ).rejects.toThrow(EXTERNAL_HOST_ERROR); }); @@ -172,7 +172,7 @@ describe('modules/datasource/repology/index', () => { getPkgReleases({ datasource, versioning, - depName: 'debian_stable/nginx', + packageName: 'debian_stable/nginx', }) ).rejects.toThrow(EXTERNAL_HOST_ERROR); }); @@ -187,7 +187,7 @@ describe('modules/datasource/repology/index', () => { await getPkgReleases({ datasource, versioning, - depName: 'ubuntu_20_04/git', + packageName: 'ubuntu_20_04/git', }) ).toBeNull(); }); @@ -197,7 +197,7 @@ describe('modules/datasource/repology/index', () => { getPkgReleases({ datasource, versioning, - depName: 'invalid-lookup-name', + packageName: 'invalid-lookup-name', }) ).rejects.toThrow(EXTERNAL_HOST_ERROR); }); @@ -211,7 +211,7 @@ describe('modules/datasource/repology/index', () => { const res = await getPkgReleases({ datasource, versioning, - depName: 'debian_stable/nginx', + packageName: 'debian_stable/nginx', }); expect(res).toMatchSnapshot(); expect(res?.releases).toHaveLength(1); @@ -230,7 +230,7 @@ describe('modules/datasource/repology/index', () => { const res = await getPkgReleases({ datasource, versioning, - depName: 'debian_stable/gcc-defaults', + packageName: 'debian_stable/gcc-defaults', }); expect(res).toMatchSnapshot(); expect(res?.releases).toHaveLength(1); @@ -246,7 +246,7 @@ describe('modules/datasource/repology/index', () => { const res = await getPkgReleases({ datasource, versioning, - depName: 'debian_stable/gcc-defaults', + packageName: 'debian_stable/gcc-defaults', }); expect(res).toMatchSnapshot(); expect(res?.releases).toHaveLength(1); @@ -262,7 +262,7 @@ describe('modules/datasource/repology/index', () => { const res = await getPkgReleases({ datasource, versioning, - depName: 'alpine_3_12/gcc', + packageName: 'alpine_3_12/gcc', }); expect(res).toMatchSnapshot(); expect(res?.releases).toHaveLength(1); @@ -278,7 +278,7 @@ describe('modules/datasource/repology/index', () => { const res = await getPkgReleases({ datasource, versioning, - depName: 'debian_stable/pulseaudio-utils', + packageName: 'debian_stable/pulseaudio-utils', }); expect(res).toMatchSnapshot(); expect(res?.releases).toHaveLength(1); @@ -297,7 +297,7 @@ describe('modules/datasource/repology/index', () => { const res = await getPkgReleases({ datasource, versioning, - depName: 'centos_8/java-11-openjdk', + packageName: 'centos_8/java-11-openjdk', }); expect(res).toMatchSnapshot(); expect(res?.releases).toHaveLength(6); @@ -325,7 +325,7 @@ describe('modules/datasource/repology/index', () => { const release = await getPkgReleases({ datasource, versioning, - depName: 'dummy/example', + packageName: 'dummy/example', }); expect(release).toBeNull(); @@ -407,7 +407,7 @@ describe('modules/datasource/repology/index', () => { const res = await getPkgReleases({ datasource, versioning, - depName: 'some_repo/some-package', + packageName: 'some_repo/some-package', }); expect(res).toEqual({ registryUrl: 'https://repology.org', @@ -434,7 +434,7 @@ describe('modules/datasource/repology/index', () => { const res = await getPkgReleases({ datasource, versioning, - depName: 'ubuntu_20_04/python3.8', + packageName: 'ubuntu_20_04/python3.8', }); expect(res).toEqual({ registryUrl: 'https://repology.org', diff --git a/lib/modules/datasource/ruby-version/index.spec.ts b/lib/modules/datasource/ruby-version/index.spec.ts index 25f55333144bd9..5b082be7e54a45 100644 --- a/lib/modules/datasource/ruby-version/index.spec.ts +++ b/lib/modules/datasource/ruby-version/index.spec.ts @@ -14,7 +14,7 @@ describe('modules/datasource/ruby-version/index', () => { .reply(200, Fixtures.get('releases.html')); const res = await getPkgReleases({ datasource, - depName: 'ruby', + packageName: 'ruby', }); expect(res).toMatchSnapshot(); }); @@ -25,7 +25,7 @@ describe('modules/datasource/ruby-version/index', () => { .get('/en/downloads/releases/') .reply(200, {}); await expect( - getPkgReleases({ datasource, depName: 'ruby' }) + getPkgReleases({ datasource, packageName: 'ruby' }) ).rejects.toThrow(); }); @@ -35,7 +35,7 @@ describe('modules/datasource/ruby-version/index', () => { .get('/en/downloads/releases/') .reply(404); await expect( - getPkgReleases({ datasource, depName: 'ruby' }) + getPkgReleases({ datasource, packageName: 'ruby' }) ).rejects.toThrow(); }); }); diff --git a/lib/modules/datasource/rubygems/index.spec.ts b/lib/modules/datasource/rubygems/index.spec.ts index 77839741bfccd7..aeb874b5af0028 100644 --- a/lib/modules/datasource/rubygems/index.spec.ts +++ b/lib/modules/datasource/rubygems/index.spec.ts @@ -18,7 +18,7 @@ describe('modules/datasource/rubygems/index', () => { const params = { versioning: rubyVersioning.id, datasource: RubyGemsDatasource.id, - depName: 'rails', + packageName: 'rails', registryUrls: [ 'https://thirdparty.com', 'https://firstparty.com/basepath/', diff --git a/lib/modules/datasource/sbt-package/index.spec.ts b/lib/modules/datasource/sbt-package/index.spec.ts index 55f65dae6960a3..b1335ced6e2565 100644 --- a/lib/modules/datasource/sbt-package/index.spec.ts +++ b/lib/modules/datasource/sbt-package/index.spec.ts @@ -39,7 +39,7 @@ describe('modules/datasource/sbt-package/index', () => { const res = await getPkgReleases({ versioning: mavenVersioning.id, datasource: SbtPackageDatasource.id, - depName: 'org.scalatest:scalatest', + packageName: 'org.scalatest:scalatest', registryUrls: ['https://failed_repo/maven'], }); @@ -63,7 +63,7 @@ describe('modules/datasource/sbt-package/index', () => { const res = await getPkgReleases({ versioning: mavenVersioning.id, datasource: SbtPackageDatasource.id, - depName: 'com.example:empty', + packageName: 'com.example:empty', registryUrls: [], }); @@ -98,7 +98,7 @@ describe('modules/datasource/sbt-package/index', () => { const res = await getPkgReleases({ versioning: mavenVersioning.id, datasource: SbtPackageDatasource.id, - depName: 'org.example:example', + packageName: 'org.example:example', registryUrls: [MAVEN_REPO], }); @@ -127,7 +127,7 @@ describe('modules/datasource/sbt-package/index', () => { const res = await getPkgReleases({ versioning: mavenVersioning.id, datasource: SbtPackageDatasource.id, - depName: 'org.example:example_2.12', + packageName: 'org.example:example_2.12', registryUrls: [], }); @@ -168,7 +168,7 @@ describe('modules/datasource/sbt-package/index', () => { const res = await getPkgReleases({ versioning: mavenVersioning.id, datasource: SbtPackageDatasource.id, - depName: 'io.confluent:kafka-avro-serializer', + packageName: 'io.confluent:kafka-avro-serializer', registryUrls: ['https://packages.confluent.io/maven'], }); expect(res).toEqual({ @@ -201,7 +201,7 @@ describe('modules/datasource/sbt-package/index', () => { const res = await getPkgReleases({ versioning: mavenVersioning.id, datasource: SbtPackageDatasource.id, - depName: 'org.example:example', + packageName: 'org.example:example', registryUrls: [MAVEN_REPO], }); @@ -245,7 +245,7 @@ describe('modules/datasource/sbt-package/index', () => { const res = await getPkgReleases({ versioning: mavenVersioning.id, datasource: SbtPackageDatasource.id, - depName: 'org.example:example_2.13', + packageName: 'org.example:example_2.13', registryUrls: [ 'https://gitlab.com/api/v4/projects/123/packages/maven/', ], diff --git a/lib/modules/datasource/sbt-plugin/index.spec.ts b/lib/modules/datasource/sbt-plugin/index.spec.ts index 99a0eda1c59b89..4a8c99d76bfa30 100644 --- a/lib/modules/datasource/sbt-plugin/index.spec.ts +++ b/lib/modules/datasource/sbt-plugin/index.spec.ts @@ -145,7 +145,7 @@ describe('modules/datasource/sbt-plugin/index', () => { await getPkgReleases({ versioning: mavenVersioning.id, datasource: SbtPluginDatasource.id, - depName: 'org.scalatest:scalatest', + packageName: 'org.scalatest:scalatest', registryUrls: ['https://failed_repo/maven'], }) ).toBeNull(); @@ -153,7 +153,7 @@ describe('modules/datasource/sbt-plugin/index', () => { await getPkgReleases({ versioning: mavenVersioning.id, datasource: SbtPluginDatasource.id, - depName: 'org.scalatest:scalaz', + packageName: 'org.scalatest:scalaz', registryUrls: [], }) ).toBeNull(); @@ -164,7 +164,7 @@ describe('modules/datasource/sbt-plugin/index', () => { await getPkgReleases({ versioning: mavenVersioning.id, datasource: SbtPluginDatasource.id, - depName: 'org.foundweekends:sbt-bintray', + packageName: 'org.foundweekends:sbt-bintray', registryUrls: [], }) ).toEqual({ @@ -180,7 +180,7 @@ describe('modules/datasource/sbt-plugin/index', () => { await getPkgReleases({ versioning: mavenVersioning.id, datasource: SbtPluginDatasource.id, - depName: 'org.foundweekends:sbt-bintray_2.12', + packageName: 'org.foundweekends:sbt-bintray_2.12', registryUrls: [], }) ).toEqual({ @@ -196,7 +196,7 @@ describe('modules/datasource/sbt-plugin/index', () => { await getPkgReleases({ versioning: mavenVersioning.id, datasource: SbtPluginDatasource.id, - depName: 'io.get-coursier:sbt-coursier', + packageName: 'io.get-coursier:sbt-coursier', registryUrls: [MAVEN_REPO], }) ).toEqual({ diff --git a/lib/modules/datasource/terraform-module/index.spec.ts b/lib/modules/datasource/terraform-module/index.spec.ts index 04c0e6a9ed7219..de102a2324b298 100644 --- a/lib/modules/datasource/terraform-module/index.spec.ts +++ b/lib/modules/datasource/terraform-module/index.spec.ts @@ -26,7 +26,7 @@ describe('modules/datasource/terraform-module/index', () => { expect( await getPkgReleases({ datasource, - depName: 'hashicorp/consul/aws', + packageName: 'hashicorp/consul/aws', }) ).toBeNull(); }); @@ -41,7 +41,7 @@ describe('modules/datasource/terraform-module/index', () => { expect( await getPkgReleases({ datasource, - depName: 'hashicorp/consul/aws', + packageName: 'hashicorp/consul/aws', }) ).toBeNull(); }); @@ -56,7 +56,7 @@ describe('modules/datasource/terraform-module/index', () => { expect( await getPkgReleases({ datasource, - depName: 'hashicorp/consul/aws', + packageName: 'hashicorp/consul/aws', }) ).toBeNull(); }); @@ -70,7 +70,7 @@ describe('modules/datasource/terraform-module/index', () => { .reply(200, serviceDiscoveryResult); const res = await getPkgReleases({ datasource, - depName: 'hashicorp/consul/aws', + packageName: 'hashicorp/consul/aws', }); expect(res).toEqual({ homepage: 'https://registry.terraform.io/modules/hashicorp/consul/aws', @@ -104,7 +104,7 @@ describe('modules/datasource/terraform-module/index', () => { expect( await getPkgReleases({ datasource, - depName: 'hashicorp/consul/aws', + packageName: 'hashicorp/consul/aws', registryUrls: ['https://terraform.company.com'], }) ).toBeNull(); @@ -120,7 +120,7 @@ describe('modules/datasource/terraform-module/index', () => { expect( await getPkgReleases({ datasource, - depName: 'hashicorp/consul/aws', + packageName: 'hashicorp/consul/aws', registryUrls: ['https://terraform.company.com'], }) ).toBeNull(); @@ -136,7 +136,7 @@ describe('modules/datasource/terraform-module/index', () => { expect( await getPkgReleases({ datasource, - depName: 'hashicorp/consul/aws', + packageName: 'hashicorp/consul/aws', registryUrls: ['https://terraform.company.com'], }) ).toBeNull(); @@ -151,7 +151,7 @@ describe('modules/datasource/terraform-module/index', () => { .reply(200, serviceDiscoveryResult); const res = await getPkgReleases({ datasource, - depName: 'hashicorp/consul/aws', + packageName: 'hashicorp/consul/aws', registryUrls: ['https://terraform.company.com'], }); expect(res).toEqual({ @@ -185,7 +185,7 @@ describe('modules/datasource/terraform-module/index', () => { .reply(200, serviceDiscoveryResult); const res = await getPkgReleases({ datasource, - depName: 'registry.terraform.io/hashicorp/consul/aws', + packageName: 'registry.terraform.io/hashicorp/consul/aws', }); expect(res).toEqual({ homepage: 'https://registry.terraform.io/modules/hashicorp/consul/aws', @@ -220,7 +220,7 @@ describe('modules/datasource/terraform-module/index', () => { .reply(200, serviceDiscoveryResult); const res = await getPkgReleases({ datasource, - depName: 'consul/foo', + packageName: 'consul/foo', registryUrls: ['https://terraform.company.com'], }); expect(res).toBeNull(); @@ -237,7 +237,7 @@ describe('modules/datasource/terraform-module/index', () => { .reply(200, serviceDiscoveryResult); const res = await getPkgReleases({ datasource, - depName: 'consul/foo', + packageName: 'consul/foo', registryUrls: ['https://terraform.company.com'], }); expect(res).toBeNull(); @@ -250,7 +250,7 @@ describe('modules/datasource/terraform-module/index', () => { .reply(404); const res = await getPkgReleases({ datasource, - depName: 'consul/foo', + packageName: 'consul/foo', registryUrls: ['https://terraform.company.com'], }); expect(res).toBeNull(); @@ -266,7 +266,7 @@ describe('modules/datasource/terraform-module/index', () => { const res = await getPkgReleases({ datasource, registryUrls: ['https://terraform.foo.bar'], - depName: 'hashicorp/consul/aws', + packageName: 'hashicorp/consul/aws', }); expect(res).toEqual({ diff --git a/lib/modules/datasource/terraform-provider/index.spec.ts b/lib/modules/datasource/terraform-provider/index.spec.ts index 7fa3d732643f2a..1869bb9041046e 100644 --- a/lib/modules/datasource/terraform-provider/index.spec.ts +++ b/lib/modules/datasource/terraform-provider/index.spec.ts @@ -33,7 +33,7 @@ describe('modules/datasource/terraform-provider/index', () => { expect( await getPkgReleases({ datasource: TerraformProviderDatasource.id, - depName: 'azurerm', + packageName: 'azurerm', }) ).toBeNull(); }); @@ -52,7 +52,7 @@ describe('modules/datasource/terraform-provider/index', () => { expect( await getPkgReleases({ datasource: TerraformProviderDatasource.id, - depName: 'azurerm', + packageName: 'azurerm', }) ).toBeNull(); }); @@ -71,7 +71,7 @@ describe('modules/datasource/terraform-provider/index', () => { expect( await getPkgReleases({ datasource: TerraformProviderDatasource.id, - depName: 'azurerm', + packageName: 'azurerm', }) ).toBeNull(); }); @@ -85,7 +85,7 @@ describe('modules/datasource/terraform-provider/index', () => { .reply(200, serviceDiscoveryResult); const res = await getPkgReleases({ datasource: TerraformProviderDatasource.id, - depName: 'azurerm', + packageName: 'azurerm', }); expect(res).toEqual({ homepage: 'https://registry.terraform.io/providers/hashicorp/azurerm', @@ -114,7 +114,7 @@ describe('modules/datasource/terraform-provider/index', () => { expect( await getPkgReleases({ datasource: TerraformProviderDatasource.id, - depName: 'azurerm', + packageName: 'azurerm', registryUrls: ['https://registry.company.com'], }) ).toBeNull(); @@ -130,7 +130,7 @@ describe('modules/datasource/terraform-provider/index', () => { expect( await getPkgReleases({ datasource: TerraformProviderDatasource.id, - depName: 'azurerm', + packageName: 'azurerm', registryUrls: ['https://registry.company.com'], }) ).toBeNull(); @@ -146,7 +146,7 @@ describe('modules/datasource/terraform-provider/index', () => { expect( await getPkgReleases({ datasource: TerraformProviderDatasource.id, - depName: 'azurerm', + packageName: 'azurerm', registryUrls: ['https://registry.company.com'], }) ).toBeNull(); @@ -161,7 +161,6 @@ describe('modules/datasource/terraform-provider/index', () => { .reply(200, serviceDiscoveryResult); const res = await getPkgReleases({ datasource: TerraformProviderDatasource.id, - depName: 'azure', packageName: 'hashicorp/azurerm', registryUrls: ['https://registry.company.com'], }); @@ -197,7 +196,7 @@ describe('modules/datasource/terraform-provider/index', () => { const res = await getPkgReleases({ datasource: TerraformProviderDatasource.id, - depName: 'google-beta', + packageName: 'google-beta', }); expect(res).toEqual({ registryUrl: 'https://releases.hashicorp.com', @@ -233,7 +232,7 @@ describe('modules/datasource/terraform-provider/index', () => { const res = await getPkgReleases({ datasource: TerraformProviderDatasource.id, - depName: 'datadog', + packageName: 'datadog', }); expect(res).toBeNull(); }); @@ -247,7 +246,7 @@ describe('modules/datasource/terraform-provider/index', () => { expect( await getPkgReleases({ datasource: TerraformProviderDatasource.id, - depName: 'azurerm', + packageName: 'azurerm', }) ).toBeNull(); }); diff --git a/lib/modules/datasource/types.ts b/lib/modules/datasource/types.ts index b95f1395529026..a112d5fd5eec5a 100644 --- a/lib/modules/datasource/types.ts +++ b/lib/modules/datasource/types.ts @@ -3,8 +3,7 @@ import type { ModuleApi } from '../../types'; export interface GetDigestInputConfig { datasource: string; - packageName?: string; - depName: string; + packageName: string; defaultRegistryUrls?: string[]; registryUrls?: string[] | null; additionalRegistryUrls?: string[]; @@ -31,8 +30,7 @@ export interface GetPkgReleasesConfig { registryUrls?: string[] | null; additionalRegistryUrls?: string[]; datasource: string; - depName: string; - packageName?: string; + packageName: string; versioning?: string; extractVersion?: string; constraints?: Record; diff --git a/lib/modules/manager/npm/update/locked-dependency/common/parent-version.ts b/lib/modules/manager/npm/update/locked-dependency/common/parent-version.ts index 3aab1c2583470e..5c0a95316fce20 100644 --- a/lib/modules/manager/npm/update/locked-dependency/common/parent-version.ts +++ b/lib/modules/manager/npm/update/locked-dependency/common/parent-version.ts @@ -8,15 +8,17 @@ import { api as semver } from '../../../../../versioning/npm'; const pkgCache = new Map>(); -function getPkgReleasesCached(depName: string): Promise { - let cachedResult = pkgCache.get(depName); +function getPkgReleasesCached( + packageName: string +): Promise { + let cachedResult = pkgCache.get(packageName); if (!cachedResult) { const lookupConfig: GetPkgReleasesConfig = { datasource: 'npm', - depName, + packageName, }; cachedResult = getPkgReleases(lookupConfig); - pkgCache.set(depName, cachedResult); + pkgCache.set(packageName, cachedResult); } return cachedResult; } diff --git a/lib/modules/manager/terraform/lockfile/index.ts b/lib/modules/manager/terraform/lockfile/index.ts index 69d7968d1ac5e6..d4421c3d41310a 100644 --- a/lib/modules/manager/terraform/lockfile/index.ts +++ b/lib/modules/manager/terraform/lockfile/index.ts @@ -25,7 +25,7 @@ async function updateAllLocks( const updateConfig: GetPkgReleasesConfig = { versioning: 'hashicorp', datasource: 'terraform-provider', - depName: lock.packageName, + packageName: lock.packageName, }; const { releases } = (await getPkgReleases(updateConfig)) ?? {}; // istanbul ignore if: needs test diff --git a/lib/util/exec/containerbase.ts b/lib/util/exec/containerbase.ts index 3d7571f160da16..3c3f5c1909e306 100644 --- a/lib/util/exec/containerbase.ts +++ b/lib/util/exec/containerbase.ts @@ -17,138 +17,138 @@ import type { Opt, ToolConfig, ToolConstraint } from './types'; const allToolConfig: Record = { bundler: { datasource: 'rubygems', - depName: 'bundler', + packageName: 'bundler', versioning: rubyVersioningId, }, cocoapods: { datasource: 'rubygems', - depName: 'cocoapods', + packageName: 'cocoapods', versioning: rubyVersioningId, }, composer: { datasource: 'github-releases', - depName: 'composer/composer', + packageName: 'composer/composer', versioning: composerVersioningId, }, corepack: { datasource: 'npm', - depName: 'corepack', + packageName: 'corepack', versioning: npmVersioningId, }, dotnet: { datasource: 'dotnet-version', - depName: 'dotnet-sdk', + packageName: 'dotnet-sdk', versioning: semverVersioningId, }, erlang: { datasource: 'github-releases', - depName: 'containerbase/erlang-prebuild', + packageName: 'containerbase/erlang-prebuild', versioning: semverCoercedVersioningId, }, elixir: { datasource: 'github-releases', - depName: 'elixir-lang/elixir', + packageName: 'elixir-lang/elixir', versioning: semverVersioningId, }, flux: { datasource: 'github-releases', - depName: 'fluxcd/flux2', + packageName: 'fluxcd/flux2', versioning: semverVersioningId, }, golang: { datasource: 'golang-version', - depName: 'golang', + packageName: 'golang', versioning: npmVersioningId, }, helm: { datasource: 'github-releases', - depName: 'helm/helm', + packageName: 'helm/helm', versioning: semverVersioningId, }, helmfile: { datasource: 'github-releases', - depName: 'helmfile/helmfile', + packageName: 'helmfile/helmfile', versioning: semverVersioningId, }, java: { datasource: 'java-version', - depName: 'java', + packageName: 'java', versioning: npmVersioningId, }, jb: { datasource: 'github-releases', - depName: 'jsonnet-bundler/jsonnet-bundler', + packageName: 'jsonnet-bundler/jsonnet-bundler', versioning: semverVersioningId, }, lerna: { datasource: 'npm', - depName: 'lerna', + packageName: 'lerna', versioning: npmVersioningId, }, nix: { datasource: 'github-tags', - depName: 'NixOS/nix', + packageName: 'NixOS/nix', versioning: semverVersioningId, }, node: { datasource: 'node', - depName: 'node', + packageName: 'node', versioning: nodeVersioningId, }, npm: { datasource: 'npm', - depName: 'npm', + packageName: 'npm', hash: true, versioning: npmVersioningId, }, php: { datasource: 'github-releases', - depName: 'containerbase/php-prebuild', + packageName: 'containerbase/php-prebuild', versioning: composerVersioningId, }, pnpm: { datasource: 'npm', - depName: 'pnpm', + packageName: 'pnpm', versioning: npmVersioningId, }, poetry: { datasource: 'pypi', - depName: 'poetry', + packageName: 'poetry', versioning: pep440VersioningId, }, python: { datasource: 'github-releases', - depName: 'containerbase/python-prebuild', + packageName: 'containerbase/python-prebuild', versioning: pythonVersioningId, }, ruby: { datasource: 'github-releases', - depName: 'containerbase/ruby-prebuild', + packageName: 'containerbase/ruby-prebuild', versioning: rubyVersioningId, }, rust: { datasource: 'docker', - depName: 'rust', + packageName: 'rust', versioning: semverVersioningId, }, yarn: { datasource: 'npm', - depName: 'yarn', + packageName: 'yarn', versioning: npmVersioningId, }, 'yarn-slim': { datasource: 'npm', - depName: 'yarn', + packageName: 'yarn', versioning: npmVersioningId, }, dart: { datasource: 'dart-version', - depName: 'dart', + packageName: 'dart', versioning: semverVersioningId, }, flutter: { datasource: 'flutter-version', - depName: 'flutter', + packageName: 'flutter', versioning: semverVersioningId, }, }; diff --git a/lib/util/exec/docker/index.ts b/lib/util/exec/docker/index.ts index 291a97523a9a90..9d192db5908359 100644 --- a/lib/util/exec/docker/index.ts +++ b/lib/util/exec/docker/index.ts @@ -81,7 +81,7 @@ function prepareCommands(commands: Opt[]): string[] { } export async function getDockerTag( - depName: string, + packageName: string, constraint: string, scheme: string ): Promise { @@ -96,12 +96,12 @@ export async function getDockerTag( } logger.debug( - { depName, scheme, constraint }, + { packageName, scheme, constraint }, `Found version constraint - checking for a compatible image to use` ); const imageReleases = await getPkgReleases({ datasource: 'docker', - depName, + packageName, versioning: scheme, }); if (imageReleases?.releases) { @@ -117,17 +117,17 @@ export async function getDockerTag( const version = versions.sort(ver.sortVersions.bind(ver)).pop(); if (version) { logger.debug( - { depName, scheme, constraint, version }, + { packageName, scheme, constraint, version }, `Found compatible image version` ); return version; } } else { - logger.error(`No ${depName} releases found`); + logger.error(`No ${packageName} releases found`); return 'latest'; } logger.warn( - { depName, constraint, scheme }, + { packageName, constraint, scheme }, 'Failed to find a tag satisfying constraint, using "latest" tag instead' ); return 'latest'; diff --git a/lib/util/exec/types.ts b/lib/util/exec/types.ts index 14f7d78d5c678f..ffe794991044b2 100644 --- a/lib/util/exec/types.ts +++ b/lib/util/exec/types.ts @@ -7,7 +7,7 @@ export interface ToolConstraint { export interface ToolConfig { datasource: string; - depName: string; + packageName: string; hash?: boolean; versioning: string; } diff --git a/lib/workers/repository/process/__snapshots__/fetch.spec.ts.snap b/lib/workers/repository/process/__snapshots__/fetch.spec.ts.snap index 0342ca9a090742..50e2e373af26d3 100644 --- a/lib/workers/repository/process/__snapshots__/fetch.spec.ts.snap +++ b/lib/workers/repository/process/__snapshots__/fetch.spec.ts.snap @@ -11,6 +11,7 @@ exports[`workers/repository/process/fetch fetchUpdates() fetches updates 1`] = ` { "datasource": "maven", "depName": "bbb", + "packageName": "bbb", "updates": [ "a", "b", @@ -30,16 +31,19 @@ exports[`workers/repository/process/fetch fetchUpdates() handles ignored, skippe "deps": [ { "depName": "abcd", + "packageName": "abcd", "skipReason": "ignored", "updates": [], }, { "depName": "foo", + "packageName": "foo", "skipReason": "disabled", "updates": [], }, { "depName": "skipped", + "packageName": "skipped", "skipReason": "some-reason", "updates": [], }, diff --git a/lib/workers/repository/process/fetch.ts b/lib/workers/repository/process/fetch.ts index 6d46cb4402ee98..075fc423efaff5 100644 --- a/lib/workers/repository/process/fetch.ts +++ b/lib/workers/repository/process/fetch.ts @@ -28,7 +28,8 @@ async function fetchDepUpdates( if (is.string(dep.depName)) { dep.depName = dep.depName.trim(); } - if (!is.nonEmptyString(dep.depName)) { + dep.packageName ??= dep.depName; + if (!is.nonEmptyString(dep.packageName)) { dep.skipReason = 'invalid-name'; } if (dep.isInternal && !packageFileConfig.updateInternalDeps) { diff --git a/lib/workers/repository/process/lookup/index.spec.ts b/lib/workers/repository/process/lookup/index.spec.ts index a9ed162fc30eee..555954cd670580 100644 --- a/lib/workers/repository/process/lookup/index.spec.ts +++ b/lib/workers/repository/process/lookup/index.spec.ts @@ -66,14 +66,14 @@ describe('workers/repository/process/lookup/index', () => { describe('.lookupUpdates()', () => { it('returns null if unknown datasource', async () => { - config.depName = 'some-dep'; + config.packageName = 'some-dep'; config.datasource = 'does not exist'; expect((await lookup.lookupUpdates(config)).updates).toEqual([]); }); it('returns rollback for pinned version', async () => { config.currentValue = '0.9.99'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; config.rollbackPrs = true; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); @@ -85,7 +85,7 @@ describe('workers/repository/process/lookup/index', () => { it('returns rollback for ranged version', async () => { config.currentValue = '^0.9.99'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; config.rollbackPrs = true; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); @@ -97,7 +97,7 @@ describe('workers/repository/process/lookup/index', () => { it('supports minor and major upgrades for tilde ranges', async () => { config.currentValue = '^0.4.0'; config.rangeStrategy = 'pin'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); expect((await lookup.lookupUpdates(config)).updates).toMatchObject([ @@ -110,7 +110,7 @@ describe('workers/repository/process/lookup/index', () => { it('supports lock file updates mixed with regular updates', async () => { config.currentValue = '^0.4.0'; config.rangeStrategy = 'update-lockfile'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; config.separateMinorPatch = true; config.lockedVersion = '0.4.0'; @@ -126,7 +126,7 @@ describe('workers/repository/process/lookup/index', () => { config.groupName = 'somegroup'; config.currentValue = '0.4.0'; config.rangeStrategy = 'pin'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); const res = await lookup.lookupUpdates(config); @@ -138,7 +138,7 @@ describe('workers/repository/process/lookup/index', () => { config.groupName = 'somegroup'; config.currentValue = '0.4.0'; config.rangeStrategy = 'pin'; - config.depName = 'q'; + config.packageName = 'q'; config.separateMinorPatch = true; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); @@ -152,7 +152,7 @@ describe('workers/repository/process/lookup/index', () => { config.currentValue = '0.4.0'; config.rangeStrategy = 'pin'; config.separateMajorMinor = false; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); const res = await lookup.lookupUpdates(config); @@ -164,7 +164,7 @@ describe('workers/repository/process/lookup/index', () => { config.minor = { automerge: true }; config.currentValue = '^0.4.0'; config.rangeStrategy = 'pin'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); expect((await lookup.lookupUpdates(config)).updates).toMatchObject([ @@ -177,7 +177,7 @@ describe('workers/repository/process/lookup/index', () => { it('enforces allowedVersions', async () => { config.currentValue = '0.4.0'; config.allowedVersions = '<1'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); expect((await lookup.lookupUpdates(config)).updates).toHaveLength(1); @@ -186,7 +186,7 @@ describe('workers/repository/process/lookup/index', () => { it('enforces allowedVersions with regex', async () => { config.currentValue = '0.4.0'; config.allowedVersions = '/^0/'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); expect((await lookup.lookupUpdates(config)).updates).toHaveLength(1); @@ -195,7 +195,7 @@ describe('workers/repository/process/lookup/index', () => { it('enforces allowedVersions with negative regex', async () => { config.currentValue = '0.4.0'; config.allowedVersions = '!/^1/'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); expect((await lookup.lookupUpdates(config)).updates).toHaveLength(1); @@ -204,7 +204,7 @@ describe('workers/repository/process/lookup/index', () => { it('falls back to semver syntax allowedVersions', async () => { config.currentValue = '0.4.0'; config.allowedVersions = '<1'; - config.depName = 'q'; + config.packageName = 'q'; config.versioning = dockerVersioningId; // this doesn't make sense but works for this test config.datasource = NpmDatasource.id; // this doesn't make sense but works for this test httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); @@ -214,7 +214,7 @@ describe('workers/repository/process/lookup/index', () => { it('falls back to pep440 syntax allowedVersions', async () => { config.currentValue = '0.4.0'; config.allowedVersions = '==0.9.4'; - config.depName = 'q'; + config.packageName = 'q'; config.versioning = poetryVersioningId; // this doesn't make sense but works for this test config.datasource = NpmDatasource.id; // this doesn't make sense but works for this test httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); @@ -224,7 +224,7 @@ describe('workers/repository/process/lookup/index', () => { it('skips invalid allowedVersions', async () => { config.currentValue = '0.4.0'; config.allowedVersions = 'less than 1'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); await expect(lookup.lookupUpdates(config)).rejects.toThrow( @@ -235,7 +235,7 @@ describe('workers/repository/process/lookup/index', () => { it('returns patch update even if separate patches not configured', async () => { config.currentValue = '0.9.0'; config.rangeStrategy = 'pin'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); const res = await lookup.lookupUpdates(config); @@ -254,7 +254,7 @@ describe('workers/repository/process/lookup/index', () => { }; config.currentValue = '0.9.0'; config.rangeStrategy = 'pin'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); const res = await lookup.lookupUpdates(config); @@ -266,7 +266,7 @@ describe('workers/repository/process/lookup/index', () => { config.separateMinorPatch = true; config.currentValue = '0.9.0'; config.rangeStrategy = 'pin'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); expect((await lookup.lookupUpdates(config)).updates).toMatchObject([ @@ -279,7 +279,7 @@ describe('workers/repository/process/lookup/index', () => { config.separateMinorPatch = true; config.currentValue = '0.8.0'; config.rangeStrategy = 'pin'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); const res = await lookup.lookupUpdates(config); @@ -291,7 +291,7 @@ describe('workers/repository/process/lookup/index', () => { config.separateMajorMinor = false; config.currentValue = '^0.4.0'; config.rangeStrategy = 'pin'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); expect((await lookup.lookupUpdates(config)).updates).toMatchObject([ @@ -304,7 +304,7 @@ describe('workers/repository/process/lookup/index', () => { config.separateMajorMinor = false; config.currentValue = '1.0.0'; config.rangeStrategy = 'pin'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); expect((await lookup.lookupUpdates(config)).updates).toMatchObject([ @@ -315,7 +315,7 @@ describe('workers/repository/process/lookup/index', () => { it('uses minimum version for vulnerabilityAlerts', async () => { config.currentValue = '1.0.0'; config.isVulnerabilityAlert = true; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); const res = (await lookup.lookupUpdates(config)).updates; @@ -326,7 +326,7 @@ describe('workers/repository/process/lookup/index', () => { it('supports minor and major upgrades for ranged versions', async () => { config.currentValue = '~0.4.0'; config.rangeStrategy = 'pin'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); expect((await lookup.lookupUpdates(config)).updates).toMatchObject([ @@ -345,7 +345,7 @@ describe('workers/repository/process/lookup/index', () => { config.currentValue = '*'; config.rangeStrategy = strategy; config.lockedVersion = '0.4.0'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock .scope('https://registry.npmjs.org') @@ -366,7 +366,7 @@ describe('workers/repository/process/lookup/index', () => { config.currentValue = 'x'; config.rangeStrategy = strategy; config.lockedVersion = '0.4.0'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock .scope('https://registry.npmjs.org') @@ -379,7 +379,7 @@ describe('workers/repository/process/lookup/index', () => { it('supports pinning for x-range-all (no lockfile)', async () => { config.currentValue = '*'; config.rangeStrategy = 'pin'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); expect(await lookup.lookupUpdates(config)).toMatchObject({ @@ -390,7 +390,7 @@ describe('workers/repository/process/lookup/index', () => { it('covers pinning an unsupported x-range-all value', async () => { config.currentValue = ''; config.rangeStrategy = 'pin'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); expect((await lookup.lookupUpdates(config)).updates).toEqual([]); @@ -407,7 +407,7 @@ describe('workers/repository/process/lookup/index', () => { async ({ strategy }) => { config.currentValue = 'X'; config.rangeStrategy = strategy; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock .scope('https://registry.npmjs.org') @@ -420,7 +420,7 @@ describe('workers/repository/process/lookup/index', () => { it('ignores pinning for ranges when other upgrade exists', async () => { config.currentValue = '~0.9.0'; config.rangeStrategy = 'pin'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); expect((await lookup.lookupUpdates(config)).updates).toMatchObject([ @@ -432,7 +432,7 @@ describe('workers/repository/process/lookup/index', () => { it('upgrades minor ranged versions', async () => { config.currentValue = '~1.0.0'; config.rangeStrategy = 'pin'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); expect((await lookup.lookupUpdates(config)).updates).toMatchObject([ @@ -445,7 +445,7 @@ describe('workers/repository/process/lookup/index', () => { config.currentValue = '^1.2.1'; config.lockedVersion = '1.2.1'; config.rangeStrategy = 'update-lockfile'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); const res = await lookup.lookupUpdates(config); @@ -457,7 +457,7 @@ describe('workers/repository/process/lookup/index', () => { config.currentValue = '^1.2.1'; config.lockedVersion = '1.2.1'; config.rangeStrategy = 'in-range-only'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); const res = await lookup.lookupUpdates(config); @@ -469,7 +469,7 @@ describe('workers/repository/process/lookup/index', () => { config.currentValue = '~1.2.0'; config.lockedVersion = '1.2.0'; config.rangeStrategy = 'in-range-only'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); const res = await lookup.lookupUpdates(config); @@ -491,7 +491,7 @@ describe('workers/repository/process/lookup/index', () => { it('handles unconstrainedValue values', async () => { config.lockedVersion = '1.2.1'; config.rangeStrategy = 'update-lockfile'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); const res = await lookup.lookupUpdates(config); @@ -517,7 +517,7 @@ describe('workers/repository/process/lookup/index', () => { it('widens minor ranged versions if configured', async () => { config.currentValue = '~1.3.0'; config.rangeStrategy = 'widen'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); expect((await lookup.lookupUpdates(config)).updates).toMatchObject([ @@ -528,7 +528,7 @@ describe('workers/repository/process/lookup/index', () => { it('replaces minor complex ranged versions if configured', async () => { config.currentValue = '~1.2.0 || ~1.3.0'; config.rangeStrategy = 'replace'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); expect((await lookup.lookupUpdates(config)).updates).toMatchObject([ @@ -539,7 +539,7 @@ describe('workers/repository/process/lookup/index', () => { it('widens major ranged versions if configured', async () => { config.currentValue = '^2.0.0'; config.rangeStrategy = 'widen'; - config.depName = 'webpack'; + config.packageName = 'webpack'; config.datasource = NpmDatasource.id; httpMock .scope('https://registry.npmjs.org') @@ -553,7 +553,7 @@ describe('workers/repository/process/lookup/index', () => { it('replaces major complex ranged versions if configured', async () => { config.currentValue = '^1.0.0 || ^2.0.0'; config.rangeStrategy = 'replace'; - config.depName = 'webpack'; + config.packageName = 'webpack'; config.datasource = NpmDatasource.id; httpMock .scope('https://registry.npmjs.org') @@ -567,7 +567,7 @@ describe('workers/repository/process/lookup/index', () => { it('pins minor ranged versions', async () => { config.currentValue = '^1.0.0'; config.rangeStrategy = 'pin'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); expect((await lookup.lookupUpdates(config)).updates).toMatchObject([ @@ -579,7 +579,7 @@ describe('workers/repository/process/lookup/index', () => { config.currentValue = '^1.0.0'; config.lockedVersion = '1.0.0'; config.rangeStrategy = 'pin'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); expect((await lookup.lookupUpdates(config)).updates).toMatchObject([ @@ -590,7 +590,7 @@ describe('workers/repository/process/lookup/index', () => { it('ignores minor ranged versions when not pinning', async () => { config.rangeStrategy = 'replace'; config.currentValue = '^1.0.0'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); expect((await lookup.lookupUpdates(config)).updates).toHaveLength(0); @@ -600,7 +600,7 @@ describe('workers/repository/process/lookup/index', () => { config.rangeStrategy = 'replace'; config.currentValue = '^1.0.0'; config.lockedVersion = '1.1.0'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); expect((await lookup.lookupUpdates(config)).updates).toHaveLength(0); @@ -609,7 +609,7 @@ describe('workers/repository/process/lookup/index', () => { it('upgrades tilde ranges', async () => { config.rangeStrategy = 'pin'; config.currentValue = '~1.3.0'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); expect((await lookup.lookupUpdates(config)).updates).toMatchObject([ @@ -621,7 +621,7 @@ describe('workers/repository/process/lookup/index', () => { it('upgrades .x minor ranges', async () => { config.currentValue = '1.3.x'; config.rangeStrategy = 'pin'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); expect((await lookup.lookupUpdates(config)).updates).toMatchObject([ @@ -633,7 +633,7 @@ describe('workers/repository/process/lookup/index', () => { it('upgrades tilde ranges without pinning', async () => { config.rangeStrategy = 'replace'; config.currentValue = '~1.3.0'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); expect((await lookup.lookupUpdates(config)).updates).toMatchObject([ @@ -644,7 +644,7 @@ describe('workers/repository/process/lookup/index', () => { it('upgrades .x major ranges without pinning', async () => { config.rangeStrategy = 'replace'; config.currentValue = '0.x'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); expect((await lookup.lookupUpdates(config)).updates).toMatchObject([ @@ -655,7 +655,7 @@ describe('workers/repository/process/lookup/index', () => { it('upgrades .x minor ranges without pinning', async () => { config.rangeStrategy = 'replace'; config.currentValue = '1.3.x'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); expect((await lookup.lookupUpdates(config)).updates).toMatchObject([ @@ -666,7 +666,7 @@ describe('workers/repository/process/lookup/index', () => { it('upgrades .x complex minor ranges without pinning', async () => { config.rangeStrategy = 'widen'; config.currentValue = '1.2.x - 1.3.x'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); expect((await lookup.lookupUpdates(config)).updates).toMatchObject([ @@ -677,7 +677,7 @@ describe('workers/repository/process/lookup/index', () => { it('upgrades shorthand major ranges without pinning', async () => { config.rangeStrategy = 'replace'; config.currentValue = '0'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); expect((await lookup.lookupUpdates(config)).updates).toMatchObject([ @@ -688,7 +688,7 @@ describe('workers/repository/process/lookup/index', () => { it('upgrades shorthand minor ranges without pinning', async () => { config.rangeStrategy = 'replace'; config.currentValue = '1.3'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); expect((await lookup.lookupUpdates(config)).updates).toMatchObject([ @@ -699,7 +699,7 @@ describe('workers/repository/process/lookup/index', () => { it('upgrades multiple tilde ranges without pinning', async () => { config.rangeStrategy = 'replace'; config.currentValue = '~0.7.0'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); expect((await lookup.lookupUpdates(config)).updates).toMatchObject([ @@ -711,7 +711,7 @@ describe('workers/repository/process/lookup/index', () => { it('upgrades multiple caret ranges without pinning', async () => { config.rangeStrategy = 'replace'; config.currentValue = '^0.7.0'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); expect((await lookup.lookupUpdates(config)).updates).toMatchObject([ @@ -723,7 +723,7 @@ describe('workers/repository/process/lookup/index', () => { it('supports complex ranges', async () => { config.rangeStrategy = 'widen'; config.currentValue = '^0.7.0 || ^0.8.0'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); const res = await lookup.lookupUpdates(config); @@ -737,7 +737,7 @@ describe('workers/repository/process/lookup/index', () => { it('supports complex major ranges', async () => { config.rangeStrategy = 'widen'; config.currentValue = '^1.0.0 || ^2.0.0'; - config.depName = 'webpack'; + config.packageName = 'webpack'; config.datasource = NpmDatasource.id; httpMock .scope('https://registry.npmjs.org') @@ -754,7 +754,7 @@ describe('workers/repository/process/lookup/index', () => { it('supports complex major hyphen ranges', async () => { config.rangeStrategy = 'widen'; config.currentValue = '1.x - 2.x'; - config.depName = 'webpack'; + config.packageName = 'webpack'; config.datasource = NpmDatasource.id; httpMock .scope('https://registry.npmjs.org') @@ -768,7 +768,7 @@ describe('workers/repository/process/lookup/index', () => { it('widens .x OR ranges', async () => { config.rangeStrategy = 'widen'; config.currentValue = '1.x || 2.x'; - config.depName = 'webpack'; + config.packageName = 'webpack'; config.datasource = NpmDatasource.id; httpMock .scope('https://registry.npmjs.org') @@ -782,7 +782,7 @@ describe('workers/repository/process/lookup/index', () => { it('widens stanndalone major OR ranges', async () => { config.rangeStrategy = 'widen'; config.currentValue = '1 || 2'; - config.depName = 'webpack'; + config.packageName = 'webpack'; config.datasource = NpmDatasource.id; httpMock .scope('https://registry.npmjs.org') @@ -796,7 +796,7 @@ describe('workers/repository/process/lookup/index', () => { it('supports complex tilde ranges', async () => { config.rangeStrategy = 'widen'; config.currentValue = '~1.2.0 || ~1.3.0'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); expect((await lookup.lookupUpdates(config)).updates).toMatchObject([ @@ -807,7 +807,7 @@ describe('workers/repository/process/lookup/index', () => { it('returns nothing for greater than ranges', async () => { config.rangeStrategy = 'replace'; config.currentValue = '>= 0.7.0'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); expect((await lookup.lookupUpdates(config)).updates).toHaveLength(0); @@ -816,7 +816,7 @@ describe('workers/repository/process/lookup/index', () => { it('upgrades less than equal ranges without pinning', async () => { config.rangeStrategy = 'replace'; config.currentValue = '<= 0.7.2'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); expect((await lookup.lookupUpdates(config)).updates).toMatchObject([ @@ -828,7 +828,7 @@ describe('workers/repository/process/lookup/index', () => { it('upgrades less than ranges without pinning', async () => { config.rangeStrategy = 'replace'; config.currentValue = '< 0.7.2'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); expect((await lookup.lookupUpdates(config)).updates).toMatchObject([ @@ -840,7 +840,7 @@ describe('workers/repository/process/lookup/index', () => { it('upgrades less than major ranges', async () => { config.rangeStrategy = 'replace'; config.currentValue = '< 1'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); expect((await lookup.lookupUpdates(config)).updates).toMatchObject([ @@ -851,7 +851,7 @@ describe('workers/repository/process/lookup/index', () => { it('upgrades less than equal minor ranges', async () => { config.rangeStrategy = 'replace'; config.currentValue = '<= 1.3'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); expect((await lookup.lookupUpdates(config)).updates).toMatchObject([ @@ -862,7 +862,7 @@ describe('workers/repository/process/lookup/index', () => { it('upgrades equal minor ranges', async () => { config.rangeStrategy = 'replace'; config.currentValue = '=1.3.1'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); expect((await lookup.lookupUpdates(config)).updates).toMatchObject([ @@ -874,7 +874,7 @@ describe('workers/repository/process/lookup/index', () => { config.rangeStrategy = 'replace'; config.respectLatest = false; config.currentValue = '<= 1'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); expect((await lookup.lookupUpdates(config)).updates).toMatchObject([ @@ -885,7 +885,7 @@ describe('workers/repository/process/lookup/index', () => { it('upgrades major less than equal ranges', async () => { config.rangeStrategy = 'replace'; config.currentValue = '<= 1.0.0'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); const res = await lookup.lookupUpdates(config); @@ -896,7 +896,7 @@ describe('workers/repository/process/lookup/index', () => { it('upgrades major less than ranges without pinning', async () => { config.rangeStrategy = 'replace'; config.currentValue = '< 1.0.0'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); const res = await lookup.lookupUpdates(config); @@ -907,7 +907,7 @@ describe('workers/repository/process/lookup/index', () => { it('upgrades major greater than less than ranges without pinning', async () => { config.rangeStrategy = 'widen'; config.currentValue = '>= 0.5.0 < 1.0.0'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); const res = await lookup.lookupUpdates(config); @@ -918,7 +918,7 @@ describe('workers/repository/process/lookup/index', () => { it('upgrades minor greater than less than ranges without pinning', async () => { config.rangeStrategy = 'widen'; config.currentValue = '>= 0.5.0 <0.8'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); const res = await lookup.lookupUpdates(config); @@ -930,7 +930,7 @@ describe('workers/repository/process/lookup/index', () => { it('upgrades minor greater than less than equals ranges without pinning', async () => { config.rangeStrategy = 'widen'; config.currentValue = '>= 0.5.0 <= 0.8.0'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); const res = await lookup.lookupUpdates(config); @@ -942,7 +942,7 @@ describe('workers/repository/process/lookup/index', () => { it('rejects reverse ordered less than greater than', async () => { config.rangeStrategy = 'widen'; config.currentValue = '<= 0.8.0 >= 0.5.0'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); const res = await lookup.lookupUpdates(config); @@ -952,7 +952,7 @@ describe('workers/repository/process/lookup/index', () => { it('supports > latest versions if configured', async () => { config.respectLatest = false; config.currentValue = '1.4.1'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); expect((await lookup.lookupUpdates(config)).updates).toMatchObject([ @@ -962,7 +962,7 @@ describe('workers/repository/process/lookup/index', () => { it('should ignore unstable versions if the current version is stable', async () => { config.currentValue = '2.5.16'; - config.depName = 'vue'; + config.packageName = 'vue'; config.datasource = NpmDatasource.id; httpMock .scope('https://registry.npmjs.org') @@ -973,7 +973,7 @@ describe('workers/repository/process/lookup/index', () => { it('should ignore unstable versions from datasource', async () => { config.currentValue = '1.4.4'; - config.depName = 'some/action'; + config.packageName = 'some/action'; config.datasource = GithubReleasesDatasource.id; getGithubReleases.mockResolvedValueOnce({ releases: [ @@ -989,7 +989,7 @@ describe('workers/repository/process/lookup/index', () => { it('should return pendingChecks', async () => { config.currentValue = '1.4.4'; - config.depName = 'some/action'; + config.packageName = 'some/action'; config.datasource = GithubReleasesDatasource.id; config.stabilityDays = 14; config.internalChecksFilter = 'strict'; @@ -1012,7 +1012,7 @@ describe('workers/repository/process/lookup/index', () => { it('should return pendingVersions', async () => { config.currentValue = '1.4.4'; - config.depName = 'some/action'; + config.packageName = 'some/action'; config.datasource = GithubReleasesDatasource.id; config.stabilityDays = 3; config.internalChecksFilter = 'strict'; @@ -1037,7 +1037,7 @@ describe('workers/repository/process/lookup/index', () => { config.currentValue = '2.5.16'; config.ignoreUnstable = false; config.respectLatest = false; - config.depName = 'vue'; + config.packageName = 'vue'; config.datasource = NpmDatasource.id; httpMock .scope('https://registry.npmjs.org') @@ -1051,7 +1051,7 @@ describe('workers/repository/process/lookup/index', () => { it('should allow unstable versions if the current version is unstable', async () => { config.currentValue = '3.1.0-dev.20180731'; - config.depName = 'typescript'; + config.packageName = 'typescript'; config.datasource = NpmDatasource.id; httpMock .scope('https://registry.npmjs.org') @@ -1065,7 +1065,7 @@ describe('workers/repository/process/lookup/index', () => { it('should not jump unstable versions', async () => { config.currentValue = '3.0.1-insiders.20180726'; - config.depName = 'typescript'; + config.packageName = 'typescript'; config.datasource = NpmDatasource.id; httpMock .scope('https://registry.npmjs.org') @@ -1080,7 +1080,7 @@ describe('workers/repository/process/lookup/index', () => { it('should update pinned versions if updatePinnedDependencies=true', async () => { config.currentValue = '0.0.34'; config.updatePinnedDependencies = true; - config.depName = '@types/helmet'; + config.packageName = '@types/helmet'; config.datasource = NpmDatasource.id; httpMock .scope('https://registry.npmjs.org') @@ -1095,7 +1095,7 @@ describe('workers/repository/process/lookup/index', () => { it('should not update pinned versions if updatePinnedDependencies=false', async () => { config.currentValue = '0.0.34'; config.updatePinnedDependencies = false; - config.depName = '@types/helmet'; + config.packageName = '@types/helmet'; config.datasource = NpmDatasource.id; httpMock .scope('https://registry.npmjs.org') @@ -1107,7 +1107,7 @@ describe('workers/repository/process/lookup/index', () => { it('should follow dist-tag even if newer version exists', async () => { config.currentValue = '3.0.1-insiders.20180713'; - config.depName = 'typescript'; + config.packageName = 'typescript'; config.datasource = NpmDatasource.id; config.followTag = 'insiders'; httpMock @@ -1122,7 +1122,7 @@ describe('workers/repository/process/lookup/index', () => { it('should roll back to dist-tag if current version is higher', async () => { config.currentValue = '3.1.0-dev.20180813'; - config.depName = 'typescript'; + config.packageName = 'typescript'; config.datasource = NpmDatasource.id; config.followTag = 'insiders'; config.rollbackPrs = true; @@ -1138,7 +1138,7 @@ describe('workers/repository/process/lookup/index', () => { it('should jump unstable versions if followTag', async () => { config.currentValue = '3.0.0-insiders.20180706'; - config.depName = 'typescript'; + config.packageName = 'typescript'; config.datasource = NpmDatasource.id; config.followTag = 'insiders'; httpMock @@ -1153,7 +1153,7 @@ describe('workers/repository/process/lookup/index', () => { it('should update nothing if current version is dist-tag', async () => { config.currentValue = '3.0.1-insiders.20180726'; - config.depName = 'typescript'; + config.packageName = 'typescript'; config.datasource = NpmDatasource.id; config.followTag = 'insiders'; httpMock @@ -1166,7 +1166,7 @@ describe('workers/repository/process/lookup/index', () => { it('should warn if no version matches dist-tag', async () => { config.currentValue = '3.0.1-dev.20180726'; - config.depName = 'typescript'; + config.packageName = 'typescript'; config.datasource = NpmDatasource.id; config.followTag = 'foo'; httpMock @@ -1186,7 +1186,7 @@ describe('workers/repository/process/lookup/index', () => { config.currentValue = 'v1.0.0'; config.currentDigest = 'bla'; config.digestOneAndOnly = true; - config.depName = 'angular/angular'; + config.packageName = 'angular/angular'; config.datasource = GithubTagsDatasource.id; // Only mock calls once so that the second invocation results in @@ -1215,7 +1215,7 @@ describe('workers/repository/process/lookup/index', () => { it('should not warn if no new digest could be found', async () => { config.currentValue = 'v1.0.0'; config.digestOneAndOnly = true; - config.depName = 'angular/angular'; + config.packageName = 'angular/angular'; config.pinDigests = true; config.datasource = GithubTagsDatasource.id; @@ -1240,7 +1240,7 @@ describe('workers/repository/process/lookup/index', () => { it('should treat zero zero tilde ranges as 0.0.x', async () => { config.rangeStrategy = 'replace'; config.currentValue = '~0.0.34'; - config.depName = '@types/helmet'; + config.packageName = '@types/helmet'; config.datasource = NpmDatasource.id; httpMock .scope('https://registry.npmjs.org') @@ -1252,7 +1252,7 @@ describe('workers/repository/process/lookup/index', () => { it('should treat zero zero caret ranges as pinned', async () => { config.rangeStrategy = 'replace'; config.currentValue = '^0.0.34'; - config.depName = '@types/helmet'; + config.packageName = '@types/helmet'; config.datasource = NpmDatasource.id; httpMock .scope('https://registry.npmjs.org') @@ -1265,7 +1265,7 @@ describe('workers/repository/process/lookup/index', () => { it('should downgrade from missing versions', async () => { config.currentValue = '1.16.1'; - config.depName = 'coffeelint'; + config.packageName = 'coffeelint'; config.datasource = NpmDatasource.id; config.rollbackPrs = true; httpMock @@ -1279,7 +1279,7 @@ describe('workers/repository/process/lookup/index', () => { it('should upgrade to only one major', async () => { config.currentValue = '1.0.0'; - config.depName = 'webpack'; + config.packageName = 'webpack'; config.datasource = NpmDatasource.id; httpMock .scope('https://registry.npmjs.org') @@ -1292,7 +1292,7 @@ describe('workers/repository/process/lookup/index', () => { it('should upgrade to two majors', async () => { config.currentValue = '1.0.0'; config.separateMultipleMajor = true; - config.depName = 'webpack'; + config.packageName = 'webpack'; config.datasource = NpmDatasource.id; httpMock .scope('https://registry.npmjs.org') @@ -1305,7 +1305,7 @@ describe('workers/repository/process/lookup/index', () => { it('does not jump major unstable', async () => { config.currentValue = '^4.4.0-canary.3'; config.rangeStrategy = 'replace'; - config.depName = 'next'; + config.packageName = 'next'; config.datasource = NpmDatasource.id; httpMock .scope('https://registry.npmjs.org') @@ -1318,7 +1318,7 @@ describe('workers/repository/process/lookup/index', () => { it('supports in-range caret updates', async () => { config.rangeStrategy = 'bump'; config.currentValue = '^1.0.0'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); expect((await lookup.lookupUpdates(config)).updates).toMatchObject([ @@ -1329,7 +1329,7 @@ describe('workers/repository/process/lookup/index', () => { it('supports in-range tilde updates', async () => { config.rangeStrategy = 'bump'; config.currentValue = '~1.0.0'; - config.depName = 'q'; + config.packageName = 'q'; config.separateMinorPatch = true; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); @@ -1342,7 +1342,7 @@ describe('workers/repository/process/lookup/index', () => { it('supports in-range tilde patch updates', async () => { config.rangeStrategy = 'bump'; config.currentValue = '~1.0.0'; - config.depName = 'q'; + config.packageName = 'q'; config.separateMinorPatch = true; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); @@ -1355,7 +1355,7 @@ describe('workers/repository/process/lookup/index', () => { it('supports in-range gte updates', async () => { config.rangeStrategy = 'bump'; config.currentValue = '>=1.0.0'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); expect((await lookup.lookupUpdates(config)).updates).toMatchObject([ @@ -1366,7 +1366,7 @@ describe('workers/repository/process/lookup/index', () => { it('supports majorgte updates', async () => { config.rangeStrategy = 'bump'; config.currentValue = '>=0.9.0'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; config.separateMajorMinor = false; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); @@ -1378,7 +1378,7 @@ describe('workers/repository/process/lookup/index', () => { it('rejects in-range unsupported operator', async () => { config.rangeStrategy = 'bump'; config.currentValue = '>1.0.0'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); expect((await lookup.lookupUpdates(config)).updates).toMatchObject([]); @@ -1387,7 +1387,7 @@ describe('workers/repository/process/lookup/index', () => { it('rejects non-fully specified in-range updates', async () => { config.rangeStrategy = 'bump'; config.currentValue = '1.x'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); expect((await lookup.lookupUpdates(config)).updates).toMatchObject([]); @@ -1396,14 +1396,14 @@ describe('workers/repository/process/lookup/index', () => { it('rejects complex range in-range updates', async () => { config.rangeStrategy = 'bump'; config.currentValue = '^0.9.0 || ^1.0.0'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); expect((await lookup.lookupUpdates(config)).updates).toMatchObject([]); }); it('replaces non-range in-range updates', async () => { - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; config.packageFile = 'package.json'; config.rangeStrategy = 'bump'; @@ -1415,7 +1415,7 @@ describe('workers/repository/process/lookup/index', () => { }); it('handles github 404', async () => { - config.depName = 'foo'; + config.packageName = 'foo'; config.datasource = GithubTagsDatasource.id; config.packageFile = 'package.json'; config.currentValue = '1.0.0'; @@ -1424,7 +1424,7 @@ describe('workers/repository/process/lookup/index', () => { }); it('handles pypi 404', async () => { - config.depName = 'foo'; + config.packageName = 'foo'; config.datasource = PypiDatasource.id; config.packageFile = 'requirements.txt'; config.currentValue = '1.0.0'; @@ -1436,7 +1436,7 @@ describe('workers/repository/process/lookup/index', () => { }); it('handles packagist', async () => { - config.depName = 'foo/bar'; + config.packageName = 'foo/bar'; config.datasource = PackagistDatasource.id; config.packageFile = 'composer.json'; config.currentValue = '1.0.0'; @@ -1449,7 +1449,7 @@ describe('workers/repository/process/lookup/index', () => { }); it('handles unknown datasource', async () => { - config.depName = 'foo'; + config.packageName = 'foo'; config.datasource = 'typo'; config.packageFile = 'package.json'; config.currentValue = '1.0.0'; @@ -1464,7 +1464,7 @@ describe('workers/repository/process/lookup/index', () => { config.rangeStrategy = 'pin'; config.lockedVersion = '0.9.4'; config.currentValue = '~=0.9'; - config.depName = 'q'; + config.packageName = 'q'; // TODO: we are using npm as source to test pep440 (#9721) config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); @@ -1477,7 +1477,7 @@ describe('workers/repository/process/lookup/index', () => { it('returns complex object', async () => { config.currentValue = '1.3.0'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; httpMock.scope('https://registry.npmjs.org').get('/q').reply(200, qJson); const res = await lookup.lookupUpdates(config); @@ -1487,7 +1487,7 @@ describe('workers/repository/process/lookup/index', () => { it('ignores deprecated', async () => { config.currentValue = '1.3.0'; - config.depName = 'q2'; + config.packageName = 'q2'; config.datasource = NpmDatasource.id; const returnJson = JSON.parse(JSON.stringify(qJson)); returnJson.name = 'q2'; @@ -1503,7 +1503,7 @@ describe('workers/repository/process/lookup/index', () => { it('is deprecated', async () => { config.currentValue = '1.3.0'; - config.depName = 'q3'; + config.packageName = 'q3'; config.datasource = NpmDatasource.id; const returnJson = { ...JSON.parse(JSON.stringify(qJson)), @@ -1523,14 +1523,14 @@ describe('workers/repository/process/lookup/index', () => { it('skips unsupported values', async () => { config.currentValue = 'alpine'; - config.depName = 'node'; + config.packageName = 'node'; config.datasource = DockerDatasource.id; const res = await lookup.lookupUpdates(config); expect(res).toMatchSnapshot({ skipReason: 'invalid-value' }); }); it('skips undefined values', async () => { - config.depName = 'node'; + config.packageName = 'node'; config.datasource = DockerDatasource.id; const res = await lookup.lookupUpdates(config); expect(res).toMatchSnapshot({ skipReason: 'invalid-value' }); @@ -1538,7 +1538,7 @@ describe('workers/repository/process/lookup/index', () => { it('handles digest pin', async () => { config.currentValue = '8.0.0'; - config.depName = 'node'; + config.packageName = 'node'; config.datasource = DockerDatasource.id; config.pinDigests = true; docker.getReleases.mockResolvedValueOnce({ @@ -1575,7 +1575,7 @@ describe('workers/repository/process/lookup/index', () => { it('skips uncompatible versions for 8.1.0', async () => { config.currentValue = '8.1.0'; - config.depName = 'node'; + config.packageName = 'node'; config.versioning = dockerVersioningId; config.datasource = DockerDatasource.id; docker.getReleases.mockResolvedValueOnce({ @@ -1599,7 +1599,7 @@ describe('workers/repository/process/lookup/index', () => { it('skips uncompatible versions for 8.1', async () => { config.currentValue = '8.1'; - config.depName = 'node'; + config.packageName = 'node'; config.versioning = dockerVersioningId; config.datasource = DockerDatasource.id; docker.getReleases.mockResolvedValueOnce({ @@ -1632,7 +1632,7 @@ describe('workers/repository/process/lookup/index', () => { it('skips uncompatible versions for 8', async () => { config.currentValue = '8'; - config.depName = 'node'; + config.packageName = 'node'; config.versioning = dockerVersioningId; config.datasource = DockerDatasource.id; docker.getReleases.mockResolvedValueOnce({ @@ -1656,7 +1656,7 @@ describe('workers/repository/process/lookup/index', () => { it('handles digest pin for up to date version', async () => { config.currentValue = '8.1.0'; - config.depName = 'node'; + config.packageName = 'node'; config.datasource = DockerDatasource.id; config.pinDigests = true; docker.getReleases.mockResolvedValueOnce({ @@ -1685,7 +1685,7 @@ describe('workers/repository/process/lookup/index', () => { it('handles digest pin for non-version', async () => { config.currentValue = 'alpine'; - config.depName = 'node'; + config.packageName = 'node'; config.datasource = DockerDatasource.id; config.pinDigests = true; docker.getReleases.mockResolvedValueOnce({ @@ -1717,7 +1717,7 @@ describe('workers/repository/process/lookup/index', () => { it('handles digest lookup failure', async () => { config.currentValue = 'alpine'; - config.depName = 'node'; + config.packageName = 'node'; config.datasource = DockerDatasource.id; config.pinDigests = true; docker.getReleases.mockResolvedValueOnce({ @@ -1740,7 +1740,7 @@ describe('workers/repository/process/lookup/index', () => { it('handles digest update', async () => { config.currentValue = '8.0.0'; - config.depName = 'node'; + config.packageName = 'node'; config.datasource = DockerDatasource.id; config.currentDigest = 'sha256:zzzzzzzzzzzzzzz'; config.pinDigests = true; @@ -1775,7 +1775,7 @@ describe('workers/repository/process/lookup/index', () => { it('handles digest update for non-version', async () => { config.currentValue = 'alpine'; - config.depName = 'node'; + config.packageName = 'node'; config.datasource = DockerDatasource.id; config.currentDigest = 'sha256:zzzzzzzzzzzzzzz'; config.pinDigests = true; @@ -1806,7 +1806,7 @@ describe('workers/repository/process/lookup/index', () => { }); it('handles git submodule update', async () => { - config.depName = 'some-path'; + config.packageName = 'some-path'; config.versioning = gitVersioningId; config.datasource = GitRefsDatasource.id; config.currentDigest = 'some-digest'; @@ -1825,7 +1825,7 @@ describe('workers/repository/process/lookup/index', () => { it('handles sourceUrl packageRules with version restrictions', async () => { config.currentValue = '0.9.99'; - config.depName = 'q'; + config.packageName = 'q'; config.datasource = NpmDatasource.id; config.packageRules = [ { @@ -1843,7 +1843,7 @@ describe('workers/repository/process/lookup/index', () => { it('handles replacements', async () => { config.currentValue = '1.4.1'; - config.depName = 'q'; + config.packageName = 'q'; // This config is normally set when packageRules are applied config.replacementName = 'r'; config.replacementVersion = '2.0.0'; @@ -1855,7 +1855,7 @@ describe('workers/repository/process/lookup/index', () => { it('rollback for invalid version to last stable version', async () => { config.currentValue = '2.5.17'; - config.depName = 'vue'; + config.packageName = 'vue'; config.datasource = NpmDatasource.id; config.rollbackPrs = true; config.ignoreUnstable = true; diff --git a/lib/workers/repository/process/lookup/index.ts b/lib/workers/repository/process/lookup/index.ts index 72039cbd938cd9..57c8ed1ccf5d99 100644 --- a/lib/workers/repository/process/lookup/index.ts +++ b/lib/workers/repository/process/lookup/index.ts @@ -35,11 +35,11 @@ export async function lookupUpdates( currentDigest, currentValue, datasource, - depName, digestOneAndOnly, followTag, lockedVersion, packageFile, + packageName, pinDigests, rollbackPrs, isVulnerabilityAlert, @@ -52,7 +52,7 @@ export async function lookupUpdates( warnings: [], } as any; try { - logger.trace({ dependency: depName, currentValue }, 'lookupUpdates'); + logger.trace({ dependency: packageName, currentValue }, 'lookupUpdates'); // Use the datasource's default versioning if none is configured config.versioning ??= getDefaultVersioning(datasource); const versioning = allVersioning.get(config.versioning); @@ -80,16 +80,16 @@ export async function lookupUpdates( if (!dependency) { // If dependency lookup fails then warn and return const warning: ValidationMessage = { - topic: depName, - message: `Failed to look up ${datasource} dependency ${depName}`, + topic: packageName, + message: `Failed to look up ${datasource} dependency ${packageName}`, }; - logger.debug({ dependency: depName, packageFile }, warning.message); + logger.debug({ dependency: packageName, packageFile }, warning.message); // TODO: return warnings in own field res.warnings.push(warning); return res; } if (dependency.deprecationMessage) { - logger.debug(`Found deprecationMessage for dependency ${depName}`); + logger.debug(`Found deprecationMessage for dependency ${packageName}`); res.deprecationMessage = dependency.deprecationMessage; } @@ -111,7 +111,7 @@ export async function lookupUpdates( // istanbul ignore if if (allVersions.length === 0) { const message = `Found no results from datasource that look like a version`; - logger.debug({ dependency: depName, result: dependency }, message); + logger.debug({ dependency: packageName, result: dependency }, message); if (!currentDigest) { return res; } @@ -122,8 +122,8 @@ export async function lookupUpdates( const taggedVersion = dependency.tags?.[followTag]; if (!taggedVersion) { res.warnings.push({ - topic: depName, - message: `Can't find version with tag ${followTag} for ${depName}`, + topic: packageName, + message: `Can't find version with tag ${followTag} for ${packageName}`, }); return res; } @@ -145,9 +145,9 @@ export async function lookupUpdates( // istanbul ignore if if (!rollback) { res.warnings.push({ - topic: depName, + topic: packageName, // TODO: types (#7154) - message: `Can't find version matching ${currentValue!} for ${depName}`, + message: `Can't find version matching ${currentValue!} for ${packageName}`, }); return res; } @@ -311,7 +311,7 @@ export async function lookupUpdates( // istanbul ignore if if (rangeStrategy === 'bump') { logger.trace( - { depName, currentValue, lockedVersion, newVersion }, + { packageName, currentValue, lockedVersion, newVersion }, 'Skipping bump because newValue is the same' ); continue; @@ -326,7 +326,7 @@ export async function lookupUpdates( } } else if (currentValue) { logger.debug( - `Dependency ${depName} has unsupported value ${currentValue}` + `Dependency ${packageName} has unsupported value ${currentValue}` ); if (!pinDigests && !currentDigest) { res.skipReason = 'invalid-value'; @@ -387,7 +387,7 @@ export async function lookupUpdates( if (update.newDigest === null) { logger.debug( { - depName, + packageName, currentValue, datasource, newValue: update.newValue, @@ -401,7 +401,7 @@ export async function lookupUpdates( if (currentDigest) { res.warnings.push({ message: `Could not determine new digest for update (datasource: ${datasource})`, - topic: depName, + topic: packageName, }); } } @@ -451,7 +451,7 @@ export async function lookupUpdates( currentDigest, currentValue, datasource, - depName, + packageName, digestOneAndOnly, followTag, lockedVersion, diff --git a/lib/workers/repository/process/lookup/types.ts b/lib/workers/repository/process/lookup/types.ts index 5d0a85f5971ef8..92e489c6dc790e 100644 --- a/lib/workers/repository/process/lookup/types.ts +++ b/lib/workers/repository/process/lookup/types.ts @@ -42,7 +42,7 @@ export interface LookupUpdateConfig separateMajorMinor?: boolean; separateMultipleMajor?: boolean; datasource: string; - depName: string; + packageName: string; minimumConfidence?: string; replacementName?: string; replacementVersion?: string; diff --git a/lib/workers/repository/update/pr/changelog/releases.spec.ts b/lib/workers/repository/update/pr/changelog/releases.spec.ts index 70fbddf173969e..5e4c7958950ab4 100644 --- a/lib/workers/repository/update/pr/changelog/releases.spec.ts +++ b/lib/workers/repository/update/pr/changelog/releases.spec.ts @@ -41,7 +41,7 @@ describe('workers/repository/update/pr/changelog/releases', () => { it('should contain only stable', async () => { const config = partial({ datasource: 'some-datasource', - depName: 'some-depname', + packageName: 'some-depname', versioning: npmVersioning.id, currentVersion: '1.0.0', newVersion: '1.1.0', @@ -54,7 +54,7 @@ describe('workers/repository/update/pr/changelog/releases', () => { it('should contain currentVersion unstable', async () => { const config = partial({ datasource: 'some-datasource', - depName: 'some-depname', + packageName: 'some-depname', versioning: npmVersioning.id, currentVersion: '1.0.1-rc0', newVersion: '1.1.0', @@ -67,7 +67,7 @@ describe('workers/repository/update/pr/changelog/releases', () => { it('should contain newVersion unstable', async () => { const config = partial({ datasource: 'some-datasource', - depName: 'some-depname', + packageName: 'some-depname', versioning: npmVersioning.id, currentVersion: '1.0.1', newVersion: '1.2.0-rc1', @@ -80,7 +80,7 @@ describe('workers/repository/update/pr/changelog/releases', () => { it('should contain both currentVersion newVersion unstable', async () => { const config = partial({ datasource: 'some-datasource', - depName: 'some-depname', + packageName: 'some-depname', versioning: npmVersioning.id, currentVersion: '1.0.1-rc0', newVersion: '1.2.0-rc1', @@ -93,7 +93,7 @@ describe('workers/repository/update/pr/changelog/releases', () => { it('should valueToVersion', async () => { const config = partial({ datasource: 'some-datasource', - depName: 'some-depname', + packageName: 'some-depname', versioning: dockerVersioning.id, currentVersion: '1.0.1-rc0', newVersion: '1.2.0-rc0', From fd279f078093ff8fcd68420d9229a0d49eff107c Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Wed, 22 Feb 2023 12:24:02 +0100 Subject: [PATCH 12/16] feat!: update `github-releases` datasource digest computation to use git tag, and preserve existing digest semantics as separate datasource (#20178) Co-authored-by: RahulGautamSingh Co-authored-by: Rhys Arkins Co-authored-by: Michael Kriese Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com> --- lib/modules/datasource/api.ts | 5 + .../digest.spec.ts | 30 +-- .../github-release-attachments/index.spec.ts | 154 +++++++++++ .../github-release-attachments/index.ts | 250 ++++++++++++++++++ .../test/index.ts | 2 +- .../datasource/github-releases/index.spec.ts | 70 ++--- .../datasource/github-releases/index.ts | 194 +------------- lib/modules/datasource/github-tags/index.ts | 39 +-- lib/util/github/tags.spec.ts | 78 ++++++ lib/util/github/tags.ts | 39 +++ 10 files changed, 593 insertions(+), 268 deletions(-) rename lib/modules/datasource/{github-releases => github-release-attachments}/digest.spec.ts (80%) create mode 100644 lib/modules/datasource/github-release-attachments/index.spec.ts create mode 100644 lib/modules/datasource/github-release-attachments/index.ts rename lib/modules/datasource/{github-releases => github-release-attachments}/test/index.ts (97%) create mode 100644 lib/util/github/tags.spec.ts create mode 100644 lib/util/github/tags.ts diff --git a/lib/modules/datasource/api.ts b/lib/modules/datasource/api.ts index c61d696bfa18ff..8bb45960253cb1 100644 --- a/lib/modules/datasource/api.ts +++ b/lib/modules/datasource/api.ts @@ -19,6 +19,7 @@ import { GalaxyDatasource } from './galaxy'; import { GalaxyCollectionDatasource } from './galaxy-collection'; import { GitRefsDatasource } from './git-refs'; import { GitTagsDatasource } from './git-tags'; +import { GithubReleaseAttachmentsDatasource } from './github-release-attachments'; import { GithubReleasesDatasource } from './github-releases'; import { GithubTagsDatasource } from './github-tags'; import { GitlabPackagesDatasource } from './gitlab-packages'; @@ -76,6 +77,10 @@ api.set(GalaxyDatasource.id, new GalaxyDatasource()); api.set(GalaxyCollectionDatasource.id, new GalaxyCollectionDatasource()); api.set(GitRefsDatasource.id, new GitRefsDatasource()); api.set(GitTagsDatasource.id, new GitTagsDatasource()); +api.set( + GithubReleaseAttachmentsDatasource.id, + new GithubReleaseAttachmentsDatasource() +); api.set(GithubReleasesDatasource.id, new GithubReleasesDatasource()); api.set(GithubTagsDatasource.id, new GithubTagsDatasource()); api.set(GitlabPackagesDatasource.id, new GitlabPackagesDatasource()); diff --git a/lib/modules/datasource/github-releases/digest.spec.ts b/lib/modules/datasource/github-release-attachments/digest.spec.ts similarity index 80% rename from lib/modules/datasource/github-releases/digest.spec.ts rename to lib/modules/datasource/github-release-attachments/digest.spec.ts index 35fff7e25297ff..19264bc096da19 100644 --- a/lib/modules/datasource/github-releases/digest.spec.ts +++ b/lib/modules/datasource/github-release-attachments/digest.spec.ts @@ -1,17 +1,17 @@ import hasha from 'hasha'; import * as httpMock from '../../../../test/http-mock'; import type { GithubDigestFile } from '../../../util/github/types'; -import { GitHubReleaseMocker } from './test'; +import { GitHubReleaseAttachmentMocker } from './test'; -import { GithubReleasesDatasource } from '.'; +import { GithubReleaseAttachmentsDatasource } from '.'; -describe('modules/datasource/github-releases/digest', () => { +describe('modules/datasource/github-release-attachments/digest', () => { const packageName = 'some/dep'; - const releaseMock = new GitHubReleaseMocker( + const releaseMock = new GitHubReleaseAttachmentMocker( 'https://api.github.com', packageName ); - const githubReleases = new GithubReleasesDatasource(); + const githubReleaseAttachments = new GithubReleaseAttachmentsDatasource(); describe('findDigestAsset', () => { it('finds SHASUMS.txt file containing digest', async () => { @@ -21,7 +21,7 @@ describe('modules/datasource/github-releases/digest', () => { 'another-digest linux-arm64.tar.gz' ); - const digestAsset = await githubReleases.findDigestAsset( + const digestAsset = await githubReleaseAttachments.findDigestAsset( release, 'test-digest' ); @@ -40,7 +40,7 @@ describe('modules/datasource/github-releases/digest', () => { .get(`/repos/${packageName}/releases/download/v1.0.0/SHASUMS.txt`) .reply(200, ''); - const digestAsset = await githubReleases.findDigestAsset( + const digestAsset = await githubReleaseAttachments.findDigestAsset( release, 'test-digest' ); @@ -57,7 +57,7 @@ describe('modules/datasource/github-releases/digest', () => { }); const contentDigest = await hasha.async(content, { algorithm: 'sha256' }); - const digestAsset = await githubReleases.findDigestAsset( + const digestAsset = await githubReleaseAttachments.findDigestAsset( release, contentDigest ); @@ -67,7 +67,7 @@ describe('modules/datasource/github-releases/digest', () => { it('returns null when no assets available', async () => { const release = releaseMock.release('v1.0.0'); - const digestAsset = await githubReleases.findDigestAsset( + const digestAsset = await githubReleaseAttachments.findDigestAsset( release, 'test-digest' ); @@ -89,7 +89,7 @@ describe('modules/datasource/github-releases/digest', () => { 'v1.0.1', 'updated-digest asset.zip' ); - const digest = await githubReleases.mapDigestAssetToRelease( + const digest = await githubReleaseAttachments.mapDigestAssetToRelease( digestAsset, release ); @@ -106,7 +106,7 @@ describe('modules/datasource/github-releases/digest', () => { 'v1.0.1', 'updated-digest asset-1.0.1.zip' ); - const digest = await githubReleases.mapDigestAssetToRelease( + const digest = await githubReleaseAttachments.mapDigestAssetToRelease( digestAssetWithVersion, release ); @@ -118,7 +118,7 @@ describe('modules/datasource/github-releases/digest', () => { 'v1.0.1', 'moot-digest asset.tar.gz' ); - const digest = await githubReleases.mapDigestAssetToRelease( + const digest = await githubReleaseAttachments.mapDigestAssetToRelease( digestAsset, release ); @@ -127,7 +127,7 @@ describe('modules/datasource/github-releases/digest', () => { it('returns null when digest file not found', async () => { const release = releaseMock.release('v1.0.1'); - const digest = await githubReleases.mapDigestAssetToRelease( + const digest = await githubReleaseAttachments.mapDigestAssetToRelease( digestAsset, release ); @@ -151,7 +151,7 @@ describe('modules/datasource/github-releases/digest', () => { algorithm: 'sha256', }); - const digest = await githubReleases.mapDigestAssetToRelease( + const digest = await githubReleaseAttachments.mapDigestAssetToRelease( digestAsset, release ); @@ -160,7 +160,7 @@ describe('modules/datasource/github-releases/digest', () => { it('returns null when not found', async () => { const release = releaseMock.release('v1.0.1'); - const digest = await githubReleases.mapDigestAssetToRelease( + const digest = await githubReleaseAttachments.mapDigestAssetToRelease( digestAsset, release ); diff --git a/lib/modules/datasource/github-release-attachments/index.spec.ts b/lib/modules/datasource/github-release-attachments/index.spec.ts new file mode 100644 index 00000000000000..576bf7a004ff79 --- /dev/null +++ b/lib/modules/datasource/github-release-attachments/index.spec.ts @@ -0,0 +1,154 @@ +import { getDigest, getPkgReleases } from '..'; +import { mocked } from '../../../../test/util'; +import * as githubGraphql from '../../../util/github/graphql'; +import * as _hostRules from '../../../util/host-rules'; +import { GitHubReleaseAttachmentMocker } from './test'; +import { GithubReleaseAttachmentsDatasource } from '.'; + +jest.mock('../../../util/host-rules'); +const hostRules = mocked(_hostRules); + +const githubApiHost = 'https://api.github.com'; + +describe('modules/datasource/github-release-attachments/index', () => { + beforeEach(() => { + hostRules.hosts.mockReturnValue([]); + hostRules.find.mockReturnValue({ + token: 'some-token', + }); + }); + + describe('getReleases', () => { + it('returns releases', async () => { + jest.spyOn(githubGraphql, 'queryReleases').mockResolvedValueOnce([ + { + id: 1, + url: 'https://example.com', + name: 'some/dep2', + description: 'some description', + version: 'a', + releaseTimestamp: '2020-03-09T13:00:00Z', + }, + { + id: 2, + url: 'https://example.com', + name: 'some/dep2', + description: 'some description', + version: 'v', + releaseTimestamp: '2020-03-09T12:00:00Z', + }, + { + id: 3, + url: 'https://example.com', + name: 'some/dep2', + description: 'some description', + version: '1.0.0', + releaseTimestamp: '2020-03-09T11:00:00Z', + }, + { + id: 4, + url: 'https://example.com', + name: 'some/dep2', + description: 'some description', + version: 'v1.1.0', + releaseTimestamp: '2020-03-09T10:00:00Z', + }, + { + id: 5, + url: 'https://example.com', + name: 'some/dep2', + description: 'some description', + version: '2.0.0', + releaseTimestamp: '2020-04-09T10:00:00Z', + isStable: false, + }, + ]); + + const res = await getPkgReleases({ + datasource: GithubReleaseAttachmentsDatasource.id, + packageName: 'some/dep', + }); + + expect(res).toMatchObject({ + registryUrl: 'https://github.com', + releases: [ + { releaseTimestamp: '2020-03-09T11:00:00.000Z', version: '1.0.0' }, + { version: 'v1.1.0', releaseTimestamp: '2020-03-09T10:00:00.000Z' }, + { + version: '2.0.0', + releaseTimestamp: '2020-04-09T10:00:00.000Z', + isStable: false, + }, + ], + sourceUrl: 'https://github.com/some/dep', + }); + }); + }); + + describe('getDigest', () => { + const packageName = 'some/dep'; + const currentValue = 'v1.0.0'; + const currentDigest = 'v1.0.0-digest'; + + const releaseMock = new GitHubReleaseAttachmentMocker( + githubApiHost, + packageName + ); + + it('requires currentDigest', async () => { + const digest = await getDigest( + { datasource: GithubReleaseAttachmentsDatasource.id, packageName }, + currentValue + ); + expect(digest).toBeNull(); + }); + + it('defaults to currentDigest when currentVersion is missing', async () => { + const digest = await getDigest( + { + datasource: GithubReleaseAttachmentsDatasource.id, + packageName, + currentDigest, + }, + currentValue + ); + expect(digest).toEqual(currentDigest); + }); + + it('returns updated digest in new release', async () => { + releaseMock.withDigestFileAsset( + currentValue, + `${currentDigest} asset.zip` + ); + const nextValue = 'v1.0.1'; + const nextDigest = 'updated-digest'; + releaseMock.withDigestFileAsset(nextValue, `${nextDigest} asset.zip`); + const digest = await getDigest( + { + datasource: GithubReleaseAttachmentsDatasource.id, + packageName, + currentValue, + currentDigest, + }, + nextValue + ); + expect(digest).toEqual(nextDigest); + }); + + // This is awkward, but I found returning `null` in this case to not produce an update + // I'd prefer a PR with the old digest (that I can manually patch) to no PR, so I made this decision. + it('ignores failures verifying currentDigest', async () => { + releaseMock.release(currentValue); + const digest = await getDigest( + { + datasource: GithubReleaseAttachmentsDatasource.id, + packageName, + currentValue, + currentDigest, + }, + currentValue + ); + expect(digest).toEqual(currentDigest); + }); + }); +}); diff --git a/lib/modules/datasource/github-release-attachments/index.ts b/lib/modules/datasource/github-release-attachments/index.ts new file mode 100644 index 00000000000000..02516713ee424a --- /dev/null +++ b/lib/modules/datasource/github-release-attachments/index.ts @@ -0,0 +1,250 @@ +import is from '@sindresorhus/is'; +import hasha from 'hasha'; +import { logger } from '../../../logger'; +import { cache } from '../../../util/cache/package/decorator'; +import { queryReleases } from '../../../util/github/graphql'; +import type { + GithubDigestFile, + GithubRestAsset, + GithubRestRelease, +} from '../../../util/github/types'; +import { getApiBaseUrl, getSourceUrl } from '../../../util/github/url'; +import { GithubHttp } from '../../../util/http/github'; +import { newlineRegex, regEx } from '../../../util/regex'; +import { Datasource } from '../datasource'; +import type { + DigestConfig, + GetReleasesConfig, + Release, + ReleaseResult, +} from '../types'; + +export const cacheNamespace = 'datasource-github-releases'; + +function inferHashAlg(digest: string): string { + switch (digest.length) { + case 64: + return 'sha256'; + default: + case 96: + return 'sha512'; + } +} + +export class GithubReleaseAttachmentsDatasource extends Datasource { + static readonly id = 'github-release-attachments'; + + override readonly defaultRegistryUrls = ['https://github.com']; + + override http: GithubHttp; + + constructor() { + super(GithubReleaseAttachmentsDatasource.id); + this.http = new GithubHttp(GithubReleaseAttachmentsDatasource.id); + } + + @cache({ + ttlMinutes: 1440, + namespace: 'datasource-github-releases', + key: (release: GithubRestRelease, digest: string) => + `${release.html_url}:${digest}`, + }) + async findDigestFile( + release: GithubRestRelease, + digest: string + ): Promise { + const smallAssets = release.assets.filter( + (a: GithubRestAsset) => a.size < 5 * 1024 + ); + for (const asset of smallAssets) { + const res = await this.http.get(asset.browser_download_url); + for (const line of res.body.split(newlineRegex)) { + const [lineDigest, lineFilename] = line.split(regEx(/\s+/), 2); + if (lineDigest === digest) { + return { + assetName: asset.name, + digestedFileName: lineFilename, + currentVersion: release.tag_name, + currentDigest: lineDigest, + }; + } + } + } + return null; + } + + @cache({ + ttlMinutes: 1440, + namespace: 'datasource-github-releases', + key: (asset: GithubRestAsset, algorithm: string) => + `${asset.browser_download_url}:${algorithm}:assetDigest`, + }) + async downloadAndDigest( + asset: GithubRestAsset, + algorithm: string + ): Promise { + const res = this.http.stream(asset.browser_download_url); + const digest = await hasha.fromStream(res, { algorithm }); + return digest; + } + + async findAssetWithDigest( + release: GithubRestRelease, + digest: string + ): Promise { + const algorithm = inferHashAlg(digest); + const assetsBySize = release.assets.sort( + (a: GithubRestAsset, b: GithubRestAsset) => { + if (a.size < b.size) { + return -1; + } + if (a.size > b.size) { + return 1; + } + return 0; + } + ); + + for (const asset of assetsBySize) { + const assetDigest = await this.downloadAndDigest(asset, algorithm); + if (assetDigest === digest) { + return { + assetName: asset.name, + currentVersion: release.tag_name, + currentDigest: assetDigest, + }; + } + } + return null; + } + + /** Identify the asset associated with a known digest. */ + async findDigestAsset( + release: GithubRestRelease, + digest: string + ): Promise { + const digestFile = await this.findDigestFile(release, digest); + if (digestFile) { + return digestFile; + } + + const asset = await this.findAssetWithDigest(release, digest); + return asset; + } + + /** Given a digest asset, find the equivalent digest in a different release. */ + async mapDigestAssetToRelease( + digestAsset: GithubDigestFile, + release: GithubRestRelease + ): Promise { + const current = digestAsset.currentVersion.replace(regEx(/^v/), ''); + const next = release.tag_name.replace(regEx(/^v/), ''); + const releaseChecksumAssetName = digestAsset.assetName.replace( + current, + next + ); + const releaseAsset = release.assets.find( + (a: GithubRestAsset) => a.name === releaseChecksumAssetName + ); + if (!releaseAsset) { + return null; + } + if (digestAsset.digestedFileName) { + const releaseFilename = digestAsset.digestedFileName.replace( + current, + next + ); + const res = await this.http.get(releaseAsset.browser_download_url); + for (const line of res.body.split(newlineRegex)) { + const [lineDigest, lineFn] = line.split(regEx(/\s+/), 2); + if (lineFn === releaseFilename) { + return lineDigest; + } + } + } else { + const algorithm = inferHashAlg(digestAsset.currentDigest); + const newDigest = await this.downloadAndDigest(releaseAsset, algorithm); + return newDigest; + } + return null; + } + + /** + * Attempts to resolve the digest for the specified package. + * + * The `newValue` supplied here should be a valid tag for the GitHub release. + * Requires `currentValue` and `currentDigest`. + * + * There may be many assets attached to the release. This function will: + * - Identify the asset pinned by `currentDigest` in the `currentValue` release + * - Download small release assets, parse as checksum manifests (e.g. `SHASUMS.txt`). + * - Download individual assets until `currentDigest` is encountered. This is limited to sha256 and sha512. + * - Map the hashed asset to `newValue` and return the updated digest as a string + */ + override async getDigest( + { + packageName: repo, + currentValue, + currentDigest, + registryUrl, + }: DigestConfig, + newValue: string + ): Promise { + logger.debug( + { repo, currentValue, currentDigest, registryUrl, newValue }, + 'getDigest' + ); + if (!currentDigest) { + return null; + } + if (!currentValue) { + return currentDigest; + } + + const apiBaseUrl = getApiBaseUrl(registryUrl); + const { body: currentRelease } = await this.http.getJson( + `${apiBaseUrl}repos/${repo}/releases/tags/${currentValue}` + ); + const digestAsset = await this.findDigestAsset( + currentRelease, + currentDigest + ); + let newDigest: string | null; + if (!digestAsset || newValue === currentValue) { + newDigest = currentDigest; + } else { + const { body: newRelease } = await this.http.getJson( + `${apiBaseUrl}repos/${repo}/releases/tags/${newValue}` + ); + newDigest = await this.mapDigestAssetToRelease(digestAsset, newRelease); + } + return newDigest; + } + + /** + * This function can be used to fetch releases with a customisable versioning + * (e.g. semver) and with releases. + * + * This function will: + * - Fetch all releases + * - Sanitize the versions if desired (e.g. strip out leading 'v') + * - Return a dependency object containing sourceUrl string and releases array + */ + async getReleases(config: GetReleasesConfig): Promise { + const releasesResult = await queryReleases(config, this.http); + const releases = releasesResult.map((item) => { + const { version, releaseTimestamp, isStable } = item; + const result: Release = { + version, + gitRef: version, + releaseTimestamp, + }; + if (is.boolean(isStable)) { + result.isStable = isStable; + } + return result; + }); + const sourceUrl = getSourceUrl(config.packageName, config.registryUrl); + return { sourceUrl, releases }; + } +} diff --git a/lib/modules/datasource/github-releases/test/index.ts b/lib/modules/datasource/github-release-attachments/test/index.ts similarity index 97% rename from lib/modules/datasource/github-releases/test/index.ts rename to lib/modules/datasource/github-release-attachments/test/index.ts index e7dfcc82c91828..84f6f3086c1e28 100644 --- a/lib/modules/datasource/github-releases/test/index.ts +++ b/lib/modules/datasource/github-release-attachments/test/index.ts @@ -2,7 +2,7 @@ import * as httpMock from '../../../../../test/http-mock'; import { partial } from '../../../../../test/util'; import type { GithubRestRelease } from '../../../../util/github/types'; -export class GitHubReleaseMocker { +export class GitHubReleaseAttachmentMocker { constructor( private readonly githubApiHost: string, private readonly packageName: string diff --git a/lib/modules/datasource/github-releases/index.spec.ts b/lib/modules/datasource/github-releases/index.spec.ts index f90efc018f4bfa..42f485fa589158 100644 --- a/lib/modules/datasource/github-releases/index.spec.ts +++ b/lib/modules/datasource/github-releases/index.spec.ts @@ -1,17 +1,14 @@ import { getDigest, getPkgReleases } from '..'; +import { mocked } from '../../../../test/util'; import * as githubGraphql from '../../../util/github/graphql'; import * as _hostRules from '../../../util/host-rules'; -import { GitHubReleaseMocker } from './test'; import { GithubReleasesDatasource } from '.'; jest.mock('../../../util/host-rules'); -const hostRules: any = _hostRules; - -const githubApiHost = 'https://api.github.com'; +const hostRules = mocked(_hostRules); describe('modules/datasource/github-releases/index', () => { beforeEach(() => { - jest.resetAllMocks(); hostRules.hosts.mockReturnValue([]); hostRules.find.mockReturnValue({ token: 'some-token', @@ -88,38 +85,48 @@ describe('modules/datasource/github-releases/index', () => { describe('getDigest', () => { const packageName = 'some/dep'; const currentValue = 'v1.0.0'; - const currentDigest = 'v1.0.0-digest'; - - const releaseMock = new GitHubReleaseMocker(githubApiHost, packageName); + const currentDigest = 'sha-of-v1'; + const newValue = 'v15.0.0'; + const newDigest = 'sha-of-v15'; - it('requires currentDigest', async () => { - const digest = await getDigest( - { datasource: GithubReleasesDatasource.id, packageName }, - currentValue - ); - expect(digest).toBeNull(); + beforeEach(() => { + jest.spyOn(githubGraphql, 'queryTags').mockResolvedValueOnce([ + { + version: 'v1.0.0', + gitRef: 'v1.0.0', + releaseTimestamp: '2021-01-01', + hash: 'sha-of-v1', + }, + { + version: 'v15.0.0', + gitRef: 'v15.0.0', + releaseTimestamp: '2022-10-01', + hash: 'sha-of-v15', + }, + ]); }); - it('defaults to currentDigest when currentVersion is missing', async () => { + it('should be independent of the current digest', async () => { const digest = await getDigest( { datasource: GithubReleasesDatasource.id, packageName, - currentDigest, + currentValue, }, - currentValue + newValue ); - expect(digest).toEqual(currentDigest); + expect(digest).toBe(newDigest); }); - it('returns updated digest in new release', async () => { - releaseMock.withDigestFileAsset( - currentValue, - `${currentDigest} asset.zip` + it('should be independent of the current value', async () => { + const digest = await getDigest( + { datasource: GithubReleasesDatasource.id, packageName }, + newValue ); - const nextValue = 'v1.0.1'; - const nextDigest = 'updated-digest'; - releaseMock.withDigestFileAsset(nextValue, `${nextDigest} asset.zip`); + expect(digest).toBe(newDigest); + }); + + it('returns updated digest in new release', async () => { const digest = await getDigest( { datasource: GithubReleasesDatasource.id, @@ -127,15 +134,12 @@ describe('modules/datasource/github-releases/index', () => { currentValue, currentDigest, }, - nextValue + newValue ); - expect(digest).toEqual(nextDigest); + expect(digest).toEqual(newDigest); }); - // This is awkward, but I found returning `null` in this case to not produce an update - // I'd prefer a PR with the old digest (that I can manually patch) to no PR, so I made this decision. - it('ignores failures verifying currentDigest', async () => { - releaseMock.release(currentValue); + it('returns null if the new value/tag does not exist', async () => { const digest = await getDigest( { datasource: GithubReleasesDatasource.id, @@ -143,9 +147,9 @@ describe('modules/datasource/github-releases/index', () => { currentValue, currentDigest, }, - currentValue + 'unknown-tag' ); - expect(digest).toEqual(currentDigest); + expect(digest).toBeNull(); }); }); }); diff --git a/lib/modules/datasource/github-releases/index.ts b/lib/modules/datasource/github-releases/index.ts index 346fe27e0adca0..11714a8593be37 100644 --- a/lib/modules/datasource/github-releases/index.ts +++ b/lib/modules/datasource/github-releases/index.ts @@ -1,17 +1,9 @@ -// TODO: types (#7154) import is from '@sindresorhus/is'; -import hasha from 'hasha'; import { logger } from '../../../logger'; -import { cache } from '../../../util/cache/package/decorator'; import { queryReleases } from '../../../util/github/graphql'; -import type { - GithubDigestFile, - GithubRestAsset, - GithubRestRelease, -} from '../../../util/github/types'; -import { getApiBaseUrl, getSourceUrl } from '../../../util/github/url'; +import { findCommitOfTag } from '../../../util/github/tags'; +import { getSourceUrl } from '../../../util/github/url'; import { GithubHttp } from '../../../util/http/github'; -import { newlineRegex, regEx } from '../../../util/regex'; import { Datasource } from '../datasource'; import type { DigestConfig, @@ -22,16 +14,6 @@ import type { export const cacheNamespace = 'datasource-github-releases'; -function inferHashAlg(digest: string): string { - switch (digest.length) { - case 64: - return 'sha256'; - default: - case 96: - return 'sha512'; - } -} - export class GithubReleasesDatasource extends Datasource { static readonly id = 'github-releases'; @@ -44,145 +26,17 @@ export class GithubReleasesDatasource extends Datasource { this.http = new GithubHttp(GithubReleasesDatasource.id); } - @cache({ - ttlMinutes: 1440, - namespace: 'datasource-github-releases', - key: (release: GithubRestRelease, digest: string) => - `${release.html_url}:${digest}`, - }) - async findDigestFile( - release: GithubRestRelease, - digest: string - ): Promise { - const smallAssets = release.assets.filter( - (a: GithubRestAsset) => a.size < 5 * 1024 - ); - for (const asset of smallAssets) { - const res = await this.http.get(asset.browser_download_url); - for (const line of res.body.split(newlineRegex)) { - const [lineDigest, lineFilename] = line.split(regEx(/\s+/), 2); - if (lineDigest === digest) { - return { - assetName: asset.name, - digestedFileName: lineFilename, - currentVersion: release.tag_name, - currentDigest: lineDigest, - }; - } - } - } - return null; - } - - @cache({ - ttlMinutes: 1440, - namespace: 'datasource-github-releases', - key: (asset: GithubRestAsset, algorithm: string) => - `${asset.browser_download_url}:${algorithm}:assetDigest`, - }) - async downloadAndDigest( - asset: GithubRestAsset, - algorithm: string - ): Promise { - const res = this.http.stream(asset.browser_download_url); - const digest = await hasha.fromStream(res, { algorithm }); - return digest; - } - - async findAssetWithDigest( - release: GithubRestRelease, - digest: string - ): Promise { - const algorithm = inferHashAlg(digest); - const assetsBySize = release.assets.sort( - (a: GithubRestAsset, b: GithubRestAsset) => { - if (a.size < b.size) { - return -1; - } - if (a.size > b.size) { - return 1; - } - return 0; - } - ); - - for (const asset of assetsBySize) { - const assetDigest = await this.downloadAndDigest(asset, algorithm); - if (assetDigest === digest) { - return { - assetName: asset.name, - currentVersion: release.tag_name, - currentDigest: assetDigest, - }; - } - } - return null; - } - - /** Identify the asset associated with a known digest. */ - async findDigestAsset( - release: GithubRestRelease, - digest: string - ): Promise { - const digestFile = await this.findDigestFile(release, digest); - if (digestFile) { - return digestFile; - } - - const asset = await this.findAssetWithDigest(release, digest); - return asset; - } - - /** Given a digest asset, find the equivalent digest in a different release. */ - async mapDigestAssetToRelease( - digestAsset: GithubDigestFile, - release: GithubRestRelease - ): Promise { - const current = digestAsset.currentVersion.replace(regEx(/^v/), ''); - const next = release.tag_name.replace(regEx(/^v/), ''); - const releaseChecksumAssetName = digestAsset.assetName.replace( - current, - next - ); - const releaseAsset = release.assets.find( - (a: GithubRestAsset) => a.name === releaseChecksumAssetName - ); - if (!releaseAsset) { - return null; - } - if (digestAsset.digestedFileName) { - const releaseFilename = digestAsset.digestedFileName.replace( - current, - next - ); - const res = await this.http.get(releaseAsset.browser_download_url); - for (const line of res.body.split(newlineRegex)) { - const [lineDigest, lineFn] = line.split(regEx(/\s+/), 2); - if (lineFn === releaseFilename) { - return lineDigest; - } - } - } else { - const algorithm = inferHashAlg(digestAsset.currentDigest); - const newDigest = await this.downloadAndDigest(releaseAsset, algorithm); - return newDigest; - } - return null; - } - /** - * github.getDigest + * Attempts to resolve the digest for the specified package. * - * The `newValue` supplied here should be a valid tag for the GitHub release. - * Requires `currentValue` and `currentDigest`. + * The `newValue` supplied here should be a valid tag for the GitHub release. The digest + * of a GitHub release will be the underlying SHA of the release tag. * - * There may be many assets attached to the release. This function will: - * - Identify the asset pinned by `currentDigest` in the `currentValue` release - * - Download small release assets, parse as checksum manifests (e.g. `SHASUMS.txt`). - * - Download individual assets until `currentDigest` is encountered. This is limited to sha256 and sha512. - * - Map the hashed asset to `newValue` and return the updated digest as a string + * Some managers like Bazel will deal with individual artifacts from releases and handle + * the artifact checksum computation separately. This data-source does not know about + * specific artifacts being used, as that could vary per manager */ - override async getDigest( + override getDigest( { packageName: repo, currentValue, @@ -195,37 +49,13 @@ export class GithubReleasesDatasource extends Datasource { { repo, currentValue, currentDigest, registryUrl, newValue }, 'getDigest' ); - if (!currentDigest) { - return null; - } - if (!currentValue) { - return currentDigest; - } - const apiBaseUrl = getApiBaseUrl(registryUrl); - const { body: currentRelease } = await this.http.getJson( - `${apiBaseUrl}repos/${repo}/releases/tags/${currentValue}` - ); - const digestAsset = await this.findDigestAsset( - currentRelease, - currentDigest - ); - let newDigest: string | null; - if (!digestAsset || newValue === currentValue) { - newDigest = currentDigest; - } else { - const { body: newRelease } = await this.http.getJson( - `${apiBaseUrl}repos/${repo}/releases/tags/${newValue}` - ); - newDigest = await this.mapDigestAssetToRelease(digestAsset, newRelease); - } - return newDigest; + return findCommitOfTag(registryUrl, repo, newValue, this.http); } /** - * github.getReleases - * - * This function can be used to fetch releases with a customisable versioning (e.g. semver) and with releases. + * This function can be used to fetch releases with a customizable versioning + * (e.g. semver) and with releases. * * This function will: * - Fetch all releases diff --git a/lib/modules/datasource/github-tags/index.ts b/lib/modules/datasource/github-tags/index.ts index 09d72813011716..f5e32f4f959403 100644 --- a/lib/modules/datasource/github-tags/index.ts +++ b/lib/modules/datasource/github-tags/index.ts @@ -2,6 +2,7 @@ import is from '@sindresorhus/is'; import { logger } from '../../../logger'; import { queryReleases, queryTags } from '../../../util/github/graphql'; import type { GithubReleaseItem } from '../../../util/github/graphql/types'; +import { findCommitOfTag } from '../../../util/github/tags'; import { getApiBaseUrl, getSourceUrl } from '../../../util/github/url'; import { GithubHttp } from '../../../util/http/github'; import { Datasource } from '../datasource'; @@ -24,42 +25,6 @@ export class GithubTagsDatasource extends Datasource { this.http = new GithubHttp(GithubTagsDatasource.id); } - async getTagCommit( - registryUrl: string | undefined, - packageName: string, - tag: string - ): Promise { - logger.trace(`github-tags.getTagCommit(${packageName}, ${tag})`); - try { - const tags = await queryTags({ packageName, registryUrl }, this.http); - // istanbul ignore if - if (!tags.length) { - logger.debug( - `github-tags.getTagCommit(): No tags found for ${packageName}` - ); - } - const tagItem = tags.find(({ version }) => version === tag); - if (tagItem) { - if (tagItem.hash) { - return tagItem.hash; - } - logger.debug( - `github-tags.getTagCommit(): Tag ${tag} has no hash for ${packageName}` - ); - } else { - logger.debug( - `github-tags.getTagCommit(): Tag ${tag} not found for ${packageName}` - ); - } - } catch (err) { - logger.debug( - { githubRepo: packageName, err }, - 'Error getting tag commit from GitHub repo' - ); - } - return null; - } - async getCommit( registryUrl: string | undefined, githubRepo: string @@ -91,7 +56,7 @@ export class GithubTagsDatasource extends Datasource { newValue?: string ): Promise { return newValue - ? this.getTagCommit(registryUrl, repo!, newValue) + ? findCommitOfTag(registryUrl, repo!, newValue, this.http) : this.getCommit(registryUrl, repo!); } diff --git a/lib/util/github/tags.spec.ts b/lib/util/github/tags.spec.ts new file mode 100644 index 00000000000000..9747b8acf12846 --- /dev/null +++ b/lib/util/github/tags.spec.ts @@ -0,0 +1,78 @@ +import { GithubHttp } from '../http/github'; +import * as githubGraphql from './graphql'; +import { findCommitOfTag } from './tags'; + +describe('util/github/tags', () => { + describe('findCommitOfTag', () => { + const http = new GithubHttp(); + const queryTagsSpy = jest.spyOn(githubGraphql, 'queryTags'); + + it('should be able to find the hash of a Git tag', async () => { + queryTagsSpy.mockResolvedValueOnce([ + { + version: 'v1.0.0', + gitRef: 'v1.0.0', + releaseTimestamp: '2021-01-01', + hash: '123', + }, + { + version: 'v2.0.0', + gitRef: 'v2.0.0', + releaseTimestamp: '2022-01-01', + hash: 'abc', + }, + ]); + + const commit = await findCommitOfTag( + undefined, + 'some-org/repo', + 'v2.0.0', + http + ); + expect(commit).toBe('abc'); + }); + + it('should support passing a custom registry URL', async () => { + queryTagsSpy.mockResolvedValueOnce([]); + + const commit = await findCommitOfTag( + 'https://my-enterprise-github.dev', + 'some-org/repo', + 'v2.0.0', + http + ); + expect(commit).toBeNull(); + expect(githubGraphql.queryTags).toHaveBeenCalledWith( + { + packageName: 'some-org/repo', + registryUrl: 'https://my-enterprise-github.dev', + }, + http + ); + }); + + it('should return `null` if the tag does not exist', async () => { + queryTagsSpy.mockResolvedValueOnce([]); + + const commit = await findCommitOfTag( + undefined, + 'some-org/repo', + 'v2.0.0', + http + ); + expect(commit).toBeNull(); + }); + + it('should gracefully return `null` if tags cannot be queried', async () => { + queryTagsSpy.mockRejectedValue(new Error('some error')); + + const commit = await findCommitOfTag( + undefined, + 'some-org/repo', + 'v2.0.0', + http + ); + expect(commit).toBeNull(); + }); + }); +}); diff --git a/lib/util/github/tags.ts b/lib/util/github/tags.ts new file mode 100644 index 00000000000000..51101958af8413 --- /dev/null +++ b/lib/util/github/tags.ts @@ -0,0 +1,39 @@ +import { logger } from '../../logger'; +import type { GithubHttp } from '../http/github'; +import { queryTags } from './graphql'; + +export async function findCommitOfTag( + registryUrl: string | undefined, + packageName: string, + tag: string, + http: GithubHttp +): Promise { + logger.trace(`github/tags.findCommitOfTag(${packageName}, ${tag})`); + try { + const tags = await queryTags({ packageName, registryUrl }, http); + if (!tags.length) { + logger.debug( + `github/tags.findCommitOfTag(): No tags found for ${packageName}` + ); + } + const tagItem = tags.find(({ version }) => version === tag); + if (tagItem) { + if (tagItem.hash) { + return tagItem.hash; + } + logger.debug( + `github/tags.findCommitOfTag: Tag ${tag} has no hash for ${packageName}` + ); + } else { + logger.debug( + `github/tags.findCommitOfTag: Tag ${tag} not found for ${packageName}` + ); + } + } catch (err) { + logger.debug( + { githubRepo: packageName, err }, + 'Error getting tag commit from GitHub repo' + ); + } + return null; +} From 27f10b28c548c9abb4f48e202200faf5ce000cd9 Mon Sep 17 00:00:00 2001 From: Lctrs Date: Sat, 4 Feb 2023 20:30:12 +0100 Subject: [PATCH 13/16] feat(datasource): support range constraints filtering Closes #18715 Closes #8476 --- lib/modules/datasource/index.ts | 10 +++++----- lib/modules/versioning/composer/index.spec.ts | 20 +++++++++++++++++++ lib/modules/versioning/composer/index.ts | 9 +++++++++ lib/modules/versioning/npm/index.spec.ts | 20 +++++++++++++++++++ lib/modules/versioning/npm/index.ts | 2 ++ lib/modules/versioning/types.ts | 2 ++ 6 files changed, 58 insertions(+), 5 deletions(-) diff --git a/lib/modules/datasource/index.ts b/lib/modules/datasource/index.ts index 0452ae6c54838f..9c3325cbcc7a71 100644 --- a/lib/modules/datasource/index.ts +++ b/lib/modules/datasource/index.ts @@ -404,20 +404,20 @@ export async function getPkgReleases( for (const [constraintName, constraintValue] of Object.entries( config.constraints ?? {} )) { - // Currently we only support if the constraint is a plain version - // TODO: Support range/range compatibility filtering #8476 - if (version.isVersion(constraintValue)) { + if (version.isValid(constraintValue)) { res.releases = res.releases.filter((release) => { const constraint = release.constraints?.[constraintName]; if (!is.nonEmptyArray(constraint)) { // A release with no constraints is OK return true; } + return constraint.some( - // If any of the release's constraints match, then it's OK + // If the constraint value is a subset of ant release's constraints, then it's OK + // fallback to release's constraint match if subset is not supported by versioning (releaseConstraint) => !releaseConstraint || - version.matches(constraintValue, releaseConstraint) + (version.subset?.(constraintValue, releaseConstraint) ?? version.matches(constraintValue, releaseConstraint)) ); }); } diff --git a/lib/modules/versioning/composer/index.spec.ts b/lib/modules/versioning/composer/index.spec.ts index 8f4e30b9283f92..80b2d77679056a 100644 --- a/lib/modules/versioning/composer/index.spec.ts +++ b/lib/modules/versioning/composer/index.spec.ts @@ -116,6 +116,26 @@ describe('modules/versioning/composer/index', () => { expect(semver.matches(a, b)).toBe(expected); }); + test.each` + a | b | expected + ${'1.0.0'} | ${'1.0.0'} | ${true} + ${'1.0.0'} | ${'>=1.0.0'} | ${true} + ${'1.1.0'} | ${'^1.0.0'} | ${true} + ${'>=1.0.0'} | ${'>=1.0.0'} | ${true} + ${'~1.0.0'} | ${'~1.0.0'} | ${true} + ${'^1.0.0'} | ${'^1.0.0'} | ${true} + ${'>=1.0.0'} | ${'>=1.1.0'} | ${false} + ${'~1.0.0'} | ${'~1.1.0'} | ${false} + ${'^1.0.0'} | ${'^1.1.0'} | ${false} + ${'>=1.0.0'} | ${'<1.0.0'} | ${false} + ${'~1.0.0'} | ${'~0.9.0'} | ${false} + ${'^1.0.0'} | ${'^0.9.0'} | ${false} + ${'^1.1.0 || ^2.0.0'} | ${'^1.0.0 || ^2.0.0'} | ${true} + ${'^1.0.0 || ^2.0.0'} | ${'^1.1.0 || ^2.0.0'} | ${false} + `('subset("$a", "$b") === $expected', ({ a, b, expected }) => { + expect(semver.subset?.(a, b)).toBe(expected); + }); + test.each` currentValue | rangeStrategy | currentVersion | newVersion | expected ${'~1.0'} | ${'pin'} | ${'1.0'} | ${'V1.1'} | ${'V1.1'} diff --git a/lib/modules/versioning/composer/index.ts b/lib/modules/versioning/composer/index.ts index 45740464213f83..3bb17c716c0acb 100644 --- a/lib/modules/versioning/composer/index.ts +++ b/lib/modules/versioning/composer/index.ts @@ -163,6 +163,14 @@ function minSatisfyingVersion( ); } +function subset(sub: string, dom: string): boolean { + if (npm.subset) { + return npm.subset(composer2npm(sub), composer2npm(dom)); + } + + return false; +} + function getNewValue({ currentValue, rangeStrategy, @@ -304,5 +312,6 @@ export const api: VersioningApi = { minSatisfyingVersion, getNewValue, sortVersions, + subset, }; export default api; diff --git a/lib/modules/versioning/npm/index.spec.ts b/lib/modules/versioning/npm/index.spec.ts index 20dedb0f82616c..ed2f8b28d021f4 100644 --- a/lib/modules/versioning/npm/index.spec.ts +++ b/lib/modules/versioning/npm/index.spec.ts @@ -55,6 +55,26 @@ describe('modules/versioning/npm/index', () => { expect(res).toBe(isSingle); }); + test.each` + a | b | expected + ${'1.0.0'} | ${'1.0.0'} | ${true} + ${'1.0.0'} | ${'>=1.0.0'} | ${true} + ${'1.1.0'} | ${'^1.0.0'} | ${true} + ${'>=1.0.0'} | ${'>=1.0.0'} | ${true} + ${'~1.0.0'} | ${'~1.0.0'} | ${true} + ${'^1.0.0'} | ${'^1.0.0'} | ${true} + ${'>=1.0.0'} | ${'>=1.1.0'} | ${false} + ${'~1.0.0'} | ${'~1.1.0'} | ${false} + ${'^1.0.0'} | ${'^1.1.0'} | ${false} + ${'>=1.0.0'} | ${'<1.0.0'} | ${false} + ${'~1.0.0'} | ${'~0.9.0'} | ${false} + ${'^1.0.0'} | ${'^0.9.0'} | ${false} + ${'^1.1.0 || ^2.0.0'} | ${'^1.0.0 || ^2.0.0'} | ${true} + ${'^1.0.0 || ^2.0.0'} | ${'^1.1.0 || ^2.0.0'} | ${false} + `('subset("$a", "$b") === $expected', ({ a, b, expected }) => { + expect(semver.subset?.(a, b)).toBe(expected); + }); + test.each` currentValue | rangeStrategy | currentVersion | newVersion | expected ${'=1.0.0'} | ${'bump'} | ${'1.0.0'} | ${'1.1.0'} | ${'=1.1.0'} diff --git a/lib/modules/versioning/npm/index.ts b/lib/modules/versioning/npm/index.ts index 0f5d75cce198d5..a74e4e4b8f779d 100644 --- a/lib/modules/versioning/npm/index.ts +++ b/lib/modules/versioning/npm/index.ts @@ -33,6 +33,7 @@ const { ltr: isLessThanRange, gt: isGreaterThan, eq: equals, + subset } = semver; // If this is left as an alias, inputs like "17.04.0" throw errors @@ -63,6 +64,7 @@ export const api: VersioningApi = { getSatisfyingVersion, minSatisfyingVersion, sortVersions, + subset }; export default api; diff --git a/lib/modules/versioning/types.ts b/lib/modules/versioning/types.ts index 362a6bd0d0d78e..f0262f85305b2b 100644 --- a/lib/modules/versioning/types.ts +++ b/lib/modules/versioning/types.ts @@ -97,6 +97,8 @@ export interface VersioningApi { matches(version: string, range: string | Range): boolean; valueToVersion?(version: string): string; + + subset?(sub: string, dom: string): boolean; } export interface VersioningApiConstructor { From 425766a9b173731a0a4967eb719bcfc69bda4461 Mon Sep 17 00:00:00 2001 From: Lctrs Date: Thu, 16 Feb 2023 10:30:00 +0100 Subject: [PATCH 14/16] add tests, tsdoc, subset support for python & simplify subset calls --- lib/modules/datasource/index.spec.ts | 27 ++++++++++++++++--- lib/modules/datasource/index.ts | 2 +- lib/modules/versioning/composer/index.spec.ts | 2 +- lib/modules/versioning/composer/index.ts | 8 ++---- lib/modules/versioning/npm/index.spec.ts | 2 +- lib/modules/versioning/pep440/index.ts | 5 ++++ lib/modules/versioning/poetry/index.ts | 5 ++++ lib/modules/versioning/python/index.ts | 7 +++++ lib/modules/versioning/types.ts | 6 ++++- 9 files changed, 50 insertions(+), 14 deletions(-) diff --git a/lib/modules/datasource/index.spec.ts b/lib/modules/datasource/index.spec.ts index cb2bd428db396b..8b8dac55d090c1 100644 --- a/lib/modules/datasource/index.spec.ts +++ b/lib/modules/datasource/index.spec.ts @@ -35,6 +35,7 @@ const defaultRegistriesMock: RegistriesMock = { }; class DummyDatasource extends Datasource { + override defaultVersioning = 'python'; override defaultRegistryUrls = ['https://reg1.com']; constructor(private registriesMock: RegistriesMock = defaultRegistriesMock) { @@ -695,13 +696,31 @@ describe('modules/datasource/index', () => { 'https://foo.bar': { releases: [ { - version: '0.0.1', + version: '0.0.5', constraints: { - python: ['2.7'], + python: ['>= 3.0.0, < 4.0'], + }, + }, + { + version: '0.0.4', + constraints: { + python: ['>= 2.7, < 4.0'], + }, + }, + { + version: '0.0.3', + constraints: { + python: ['>= 2.7, < 3.0'], }, }, { version: '0.0.2', + constraints: { + python: ['2.7'], + }, + }, + { + version: '0.0.1', constraints: { python: ['1.0'], }, @@ -714,11 +733,11 @@ describe('modules/datasource/index', () => { datasource, packageName, defaultRegistryUrls: ['https://foo.bar'], - constraints: { python: '2.7.0' }, + constraints: { python: '>= 2.7, < 3.0' }, constraintsFiltering: 'strict', }); expect(res).toMatchObject({ - releases: [{ version: '0.0.1' }], + releases: [{ version: '0.0.3' }, { version: '0.0.4' }], }); }); }); diff --git a/lib/modules/datasource/index.ts b/lib/modules/datasource/index.ts index 9c3325cbcc7a71..4d356560a6e8ed 100644 --- a/lib/modules/datasource/index.ts +++ b/lib/modules/datasource/index.ts @@ -413,7 +413,7 @@ export async function getPkgReleases( } return constraint.some( - // If the constraint value is a subset of ant release's constraints, then it's OK + // If the constraint value is a subset of any release's constraints, then it's OK // fallback to release's constraint match if subset is not supported by versioning (releaseConstraint) => !releaseConstraint || diff --git a/lib/modules/versioning/composer/index.spec.ts b/lib/modules/versioning/composer/index.spec.ts index 80b2d77679056a..4e70f09098dba2 100644 --- a/lib/modules/versioning/composer/index.spec.ts +++ b/lib/modules/versioning/composer/index.spec.ts @@ -133,7 +133,7 @@ describe('modules/versioning/composer/index', () => { ${'^1.1.0 || ^2.0.0'} | ${'^1.0.0 || ^2.0.0'} | ${true} ${'^1.0.0 || ^2.0.0'} | ${'^1.1.0 || ^2.0.0'} | ${false} `('subset("$a", "$b") === $expected', ({ a, b, expected }) => { - expect(semver.subset?.(a, b)).toBe(expected); + expect(semver.subset!(a, b)).toBe(expected); }); test.each` diff --git a/lib/modules/versioning/composer/index.ts b/lib/modules/versioning/composer/index.ts index 3bb17c716c0acb..94595af8e118c3 100644 --- a/lib/modules/versioning/composer/index.ts +++ b/lib/modules/versioning/composer/index.ts @@ -163,12 +163,8 @@ function minSatisfyingVersion( ); } -function subset(sub: string, dom: string): boolean { - if (npm.subset) { - return npm.subset(composer2npm(sub), composer2npm(dom)); - } - - return false; +function subset(sub: string, dom: string): boolean | undefined { + return npm.subset!(composer2npm(sub), composer2npm(dom)); } function getNewValue({ diff --git a/lib/modules/versioning/npm/index.spec.ts b/lib/modules/versioning/npm/index.spec.ts index ed2f8b28d021f4..f1eb743964935d 100644 --- a/lib/modules/versioning/npm/index.spec.ts +++ b/lib/modules/versioning/npm/index.spec.ts @@ -72,7 +72,7 @@ describe('modules/versioning/npm/index', () => { ${'^1.1.0 || ^2.0.0'} | ${'^1.0.0 || ^2.0.0'} | ${true} ${'^1.0.0 || ^2.0.0'} | ${'^1.1.0 || ^2.0.0'} | ${false} `('subset("$a", "$b") === $expected', ({ a, b, expected }) => { - expect(semver.subset?.(a, b)).toBe(expected); + expect(semver.subset!(a, b)).toBe(expected); }); test.each` diff --git a/lib/modules/versioning/pep440/index.ts b/lib/modules/versioning/pep440/index.ts index 26c6f80ce70178..83aa02d3636d8b 100644 --- a/lib/modules/versioning/pep440/index.ts +++ b/lib/modules/versioning/pep440/index.ts @@ -74,6 +74,10 @@ export { isVersion, matches }; const equals = (version1: string, version2: string): boolean => isVersion(version1) && isVersion(version2) && eq(version1, version2); +function subset(sub: string, dom: string): boolean | undefined { + return undefined; +} + export const api: VersioningApi = { equals, getMajor, @@ -91,6 +95,7 @@ export const api: VersioningApi = { getNewValue, sortVersions, isLessThanRange, + subset }; export default api; diff --git a/lib/modules/versioning/poetry/index.ts b/lib/modules/versioning/poetry/index.ts index 230bbb46228a9c..904566a1575f4f 100644 --- a/lib/modules/versioning/poetry/index.ts +++ b/lib/modules/versioning/poetry/index.ts @@ -232,6 +232,10 @@ function sortVersions(a: string, b: string): number { return npm.sortVersions(poetry2semver(a) ?? '', poetry2semver(b) ?? ''); } +function subset(sub: string, dom: string): boolean | undefined { + return npm.subset!(poetry2npm(sub), poetry2npm(dom)); +} + export const api: VersioningApi = { equals, getMajor, @@ -249,5 +253,6 @@ export const api: VersioningApi = { matches, minSatisfyingVersion, sortVersions, + subset }; export default api; diff --git a/lib/modules/versioning/python/index.ts b/lib/modules/versioning/python/index.ts index 7128ae92d76b46..97c94d8f0657d8 100644 --- a/lib/modules/versioning/python/index.ts +++ b/lib/modules/versioning/python/index.ts @@ -45,6 +45,12 @@ function getNewValue(_: NewValueConfig): string | null { return null; } +function subset(sub: string, dom: string): boolean | undefined { + return poetry.isValid(sub) && poetry.isValid(dom) + ? poetry.subset!(sub, dom) + : pep440.subset!(sub, dom); +} + export const api: VersioningApi = { ...poetry, getNewValue, @@ -53,5 +59,6 @@ export const api: VersioningApi = { isValid, matches, minSatisfyingVersion, + subset }; export default api; diff --git a/lib/modules/versioning/types.ts b/lib/modules/versioning/types.ts index f0262f85305b2b..fb48929d33bea5 100644 --- a/lib/modules/versioning/types.ts +++ b/lib/modules/versioning/types.ts @@ -98,7 +98,11 @@ export interface VersioningApi { valueToVersion?(version: string): string; - subset?(sub: string, dom: string): boolean; + /** + * Returns true if sub range is entirely contained by dom range, false otherwise, + * and undefined if we wannot determine it. + */ + subset?(sub: string, dom: string): boolean | undefined; } export interface VersioningApiConstructor { From 83f9ebb44f0dcf24d149b6f13159b943192ff99e Mon Sep 17 00:00:00 2001 From: Lctrs Date: Thu, 16 Feb 2023 14:56:04 +0100 Subject: [PATCH 15/16] cs, tests, review fixes --- lib/modules/datasource/index.ts | 3 +- lib/modules/versioning/composer/index.spec.ts | 30 +++++++++---------- lib/modules/versioning/composer/index.ts | 2 +- lib/modules/versioning/index.spec.ts | 1 + lib/modules/versioning/npm/index.spec.ts | 30 +++++++++---------- lib/modules/versioning/npm/index.ts | 4 +-- lib/modules/versioning/pep440/index.ts | 5 ---- lib/modules/versioning/poetry/index.ts | 2 +- lib/modules/versioning/python/index.ts | 4 +-- lib/modules/versioning/types.ts | 7 +++-- 10 files changed, 44 insertions(+), 44 deletions(-) diff --git a/lib/modules/datasource/index.ts b/lib/modules/datasource/index.ts index 4d356560a6e8ed..543ee601a537e5 100644 --- a/lib/modules/datasource/index.ts +++ b/lib/modules/datasource/index.ts @@ -417,7 +417,8 @@ export async function getPkgReleases( // fallback to release's constraint match if subset is not supported by versioning (releaseConstraint) => !releaseConstraint || - (version.subset?.(constraintValue, releaseConstraint) ?? version.matches(constraintValue, releaseConstraint)) + (version.subset?.(constraintValue, releaseConstraint) ?? + version.matches(constraintValue, releaseConstraint)) ); }); } diff --git a/lib/modules/versioning/composer/index.spec.ts b/lib/modules/versioning/composer/index.spec.ts index 4e70f09098dba2..f5ad722ef60478 100644 --- a/lib/modules/versioning/composer/index.spec.ts +++ b/lib/modules/versioning/composer/index.spec.ts @@ -117,21 +117,21 @@ describe('modules/versioning/composer/index', () => { }); test.each` - a | b | expected - ${'1.0.0'} | ${'1.0.0'} | ${true} - ${'1.0.0'} | ${'>=1.0.0'} | ${true} - ${'1.1.0'} | ${'^1.0.0'} | ${true} - ${'>=1.0.0'} | ${'>=1.0.0'} | ${true} - ${'~1.0.0'} | ${'~1.0.0'} | ${true} - ${'^1.0.0'} | ${'^1.0.0'} | ${true} - ${'>=1.0.0'} | ${'>=1.1.0'} | ${false} - ${'~1.0.0'} | ${'~1.1.0'} | ${false} - ${'^1.0.0'} | ${'^1.1.0'} | ${false} - ${'>=1.0.0'} | ${'<1.0.0'} | ${false} - ${'~1.0.0'} | ${'~0.9.0'} | ${false} - ${'^1.0.0'} | ${'^0.9.0'} | ${false} - ${'^1.1.0 || ^2.0.0'} | ${'^1.0.0 || ^2.0.0'} | ${true} - ${'^1.0.0 || ^2.0.0'} | ${'^1.1.0 || ^2.0.0'} | ${false} + a | b | expected + ${'1.0.0'} | ${'1.0.0'} | ${true} + ${'1.0.0'} | ${'>=1.0.0'} | ${true} + ${'1.1.0'} | ${'^1.0.0'} | ${true} + ${'>=1.0.0'} | ${'>=1.0.0'} | ${true} + ${'~1.0.0'} | ${'~1.0.0'} | ${true} + ${'^1.0.0'} | ${'^1.0.0'} | ${true} + ${'>=1.0.0'} | ${'>=1.1.0'} | ${false} + ${'~1.0.0'} | ${'~1.1.0'} | ${false} + ${'^1.0.0'} | ${'^1.1.0'} | ${false} + ${'>=1.0.0'} | ${'<1.0.0'} | ${false} + ${'~1.0.0'} | ${'~0.9.0'} | ${false} + ${'^1.0.0'} | ${'^0.9.0'} | ${false} + ${'^1.1.0 || ^2.0.0'} | ${'^1.0.0 || ^2.0.0'} | ${true} + ${'^1.0.0 || ^2.0.0'} | ${'^1.1.0 || ^2.0.0'} | ${false} `('subset("$a", "$b") === $expected', ({ a, b, expected }) => { expect(semver.subset!(a, b)).toBe(expected); }); diff --git a/lib/modules/versioning/composer/index.ts b/lib/modules/versioning/composer/index.ts index 94595af8e118c3..9b09836fe2ac9b 100644 --- a/lib/modules/versioning/composer/index.ts +++ b/lib/modules/versioning/composer/index.ts @@ -164,7 +164,7 @@ function minSatisfyingVersion( } function subset(sub: string, dom: string): boolean | undefined { - return npm.subset!(composer2npm(sub), composer2npm(dom)); + return npm.subset!(composer2npm(sub), composer2npm(dom)); } function getNewValue({ diff --git a/lib/modules/versioning/index.spec.ts b/lib/modules/versioning/index.spec.ts index b7c8d3e28afa59..76935aa6bd2db8 100644 --- a/lib/modules/versioning/index.spec.ts +++ b/lib/modules/versioning/index.spec.ts @@ -82,6 +82,7 @@ describe('modules/versioning/index', () => { 'toLocaleString', 'toString', 'valueOf', + 'subset', ]; const npmApi = Object.keys(allVersioning.get(semverVersioning.id)) .filter((val) => !optionalFunctions.includes(val)) diff --git a/lib/modules/versioning/npm/index.spec.ts b/lib/modules/versioning/npm/index.spec.ts index f1eb743964935d..d67a02b1b4ba34 100644 --- a/lib/modules/versioning/npm/index.spec.ts +++ b/lib/modules/versioning/npm/index.spec.ts @@ -56,21 +56,21 @@ describe('modules/versioning/npm/index', () => { }); test.each` - a | b | expected - ${'1.0.0'} | ${'1.0.0'} | ${true} - ${'1.0.0'} | ${'>=1.0.0'} | ${true} - ${'1.1.0'} | ${'^1.0.0'} | ${true} - ${'>=1.0.0'} | ${'>=1.0.0'} | ${true} - ${'~1.0.0'} | ${'~1.0.0'} | ${true} - ${'^1.0.0'} | ${'^1.0.0'} | ${true} - ${'>=1.0.0'} | ${'>=1.1.0'} | ${false} - ${'~1.0.0'} | ${'~1.1.0'} | ${false} - ${'^1.0.0'} | ${'^1.1.0'} | ${false} - ${'>=1.0.0'} | ${'<1.0.0'} | ${false} - ${'~1.0.0'} | ${'~0.9.0'} | ${false} - ${'^1.0.0'} | ${'^0.9.0'} | ${false} - ${'^1.1.0 || ^2.0.0'} | ${'^1.0.0 || ^2.0.0'} | ${true} - ${'^1.0.0 || ^2.0.0'} | ${'^1.1.0 || ^2.0.0'} | ${false} + a | b | expected + ${'1.0.0'} | ${'1.0.0'} | ${true} + ${'1.0.0'} | ${'>=1.0.0'} | ${true} + ${'1.1.0'} | ${'^1.0.0'} | ${true} + ${'>=1.0.0'} | ${'>=1.0.0'} | ${true} + ${'~1.0.0'} | ${'~1.0.0'} | ${true} + ${'^1.0.0'} | ${'^1.0.0'} | ${true} + ${'>=1.0.0'} | ${'>=1.1.0'} | ${false} + ${'~1.0.0'} | ${'~1.1.0'} | ${false} + ${'^1.0.0'} | ${'^1.1.0'} | ${false} + ${'>=1.0.0'} | ${'<1.0.0'} | ${false} + ${'~1.0.0'} | ${'~0.9.0'} | ${false} + ${'^1.0.0'} | ${'^0.9.0'} | ${false} + ${'^1.1.0 || ^2.0.0'} | ${'^1.0.0 || ^2.0.0'} | ${true} + ${'^1.0.0 || ^2.0.0'} | ${'^1.1.0 || ^2.0.0'} | ${false} `('subset("$a", "$b") === $expected', ({ a, b, expected }) => { expect(semver.subset!(a, b)).toBe(expected); }); diff --git a/lib/modules/versioning/npm/index.ts b/lib/modules/versioning/npm/index.ts index a74e4e4b8f779d..6ece07d64fbf30 100644 --- a/lib/modules/versioning/npm/index.ts +++ b/lib/modules/versioning/npm/index.ts @@ -33,7 +33,7 @@ const { ltr: isLessThanRange, gt: isGreaterThan, eq: equals, - subset + subset, } = semver; // If this is left as an alias, inputs like "17.04.0" throw errors @@ -64,7 +64,7 @@ export const api: VersioningApi = { getSatisfyingVersion, minSatisfyingVersion, sortVersions, - subset + subset, }; export default api; diff --git a/lib/modules/versioning/pep440/index.ts b/lib/modules/versioning/pep440/index.ts index 83aa02d3636d8b..26c6f80ce70178 100644 --- a/lib/modules/versioning/pep440/index.ts +++ b/lib/modules/versioning/pep440/index.ts @@ -74,10 +74,6 @@ export { isVersion, matches }; const equals = (version1: string, version2: string): boolean => isVersion(version1) && isVersion(version2) && eq(version1, version2); -function subset(sub: string, dom: string): boolean | undefined { - return undefined; -} - export const api: VersioningApi = { equals, getMajor, @@ -95,7 +91,6 @@ export const api: VersioningApi = { getNewValue, sortVersions, isLessThanRange, - subset }; export default api; diff --git a/lib/modules/versioning/poetry/index.ts b/lib/modules/versioning/poetry/index.ts index 904566a1575f4f..eea852f8994812 100644 --- a/lib/modules/versioning/poetry/index.ts +++ b/lib/modules/versioning/poetry/index.ts @@ -253,6 +253,6 @@ export const api: VersioningApi = { matches, minSatisfyingVersion, sortVersions, - subset + subset, }; export default api; diff --git a/lib/modules/versioning/python/index.ts b/lib/modules/versioning/python/index.ts index 97c94d8f0657d8..bdce4d812bff12 100644 --- a/lib/modules/versioning/python/index.ts +++ b/lib/modules/versioning/python/index.ts @@ -48,7 +48,7 @@ function getNewValue(_: NewValueConfig): string | null { function subset(sub: string, dom: string): boolean | undefined { return poetry.isValid(sub) && poetry.isValid(dom) ? poetry.subset!(sub, dom) - : pep440.subset!(sub, dom); + : undefined; } export const api: VersioningApi = { @@ -59,6 +59,6 @@ export const api: VersioningApi = { isValid, matches, minSatisfyingVersion, - subset + subset, }; export default api; diff --git a/lib/modules/versioning/types.ts b/lib/modules/versioning/types.ts index fb48929d33bea5..2ed85c224c35c5 100644 --- a/lib/modules/versioning/types.ts +++ b/lib/modules/versioning/types.ts @@ -99,8 +99,11 @@ export interface VersioningApi { valueToVersion?(version: string): string; /** - * Returns true if sub range is entirely contained by dom range, false otherwise, - * and undefined if we wannot determine it. + * @returns true if sub range is entirely contained by dom range, false otherwise, + * and undefined if it cannot determine it. + * + * @param sub - the sub range + * @param dom - the dom range */ subset?(sub: string, dom: string): boolean | undefined; } From 47aced98eb924ac2e1419c0ff3d69be0110a11be Mon Sep 17 00:00:00 2001 From: Lctrs Date: Thu, 16 Feb 2023 15:16:15 +0100 Subject: [PATCH 16/16] rename subset params --- lib/modules/versioning/composer/index.ts | 4 ++-- lib/modules/versioning/poetry/index.ts | 4 ++-- lib/modules/versioning/python/index.ts | 6 +++--- lib/modules/versioning/types.ts | 8 ++++---- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/modules/versioning/composer/index.ts b/lib/modules/versioning/composer/index.ts index 9b09836fe2ac9b..1c1db9884b2d42 100644 --- a/lib/modules/versioning/composer/index.ts +++ b/lib/modules/versioning/composer/index.ts @@ -163,8 +163,8 @@ function minSatisfyingVersion( ); } -function subset(sub: string, dom: string): boolean | undefined { - return npm.subset!(composer2npm(sub), composer2npm(dom)); +function subset(subRange: string, superRange: string): boolean | undefined { + return npm.subset!(composer2npm(subRange), composer2npm(superRange)); } function getNewValue({ diff --git a/lib/modules/versioning/poetry/index.ts b/lib/modules/versioning/poetry/index.ts index eea852f8994812..a4f50f42104379 100644 --- a/lib/modules/versioning/poetry/index.ts +++ b/lib/modules/versioning/poetry/index.ts @@ -232,8 +232,8 @@ function sortVersions(a: string, b: string): number { return npm.sortVersions(poetry2semver(a) ?? '', poetry2semver(b) ?? ''); } -function subset(sub: string, dom: string): boolean | undefined { - return npm.subset!(poetry2npm(sub), poetry2npm(dom)); +function subset(subRange: string, superRange: string): boolean | undefined { + return npm.subset!(poetry2npm(subRange), poetry2npm(superRange)); } export const api: VersioningApi = { diff --git a/lib/modules/versioning/python/index.ts b/lib/modules/versioning/python/index.ts index bdce4d812bff12..7e287abc052d86 100644 --- a/lib/modules/versioning/python/index.ts +++ b/lib/modules/versioning/python/index.ts @@ -45,9 +45,9 @@ function getNewValue(_: NewValueConfig): string | null { return null; } -function subset(sub: string, dom: string): boolean | undefined { - return poetry.isValid(sub) && poetry.isValid(dom) - ? poetry.subset!(sub, dom) +function subset(subRange: string, superRange: string): boolean | undefined { + return poetry.isValid(subRange) && poetry.isValid(superRange) + ? poetry.subset!(subRange, superRange) : undefined; } diff --git a/lib/modules/versioning/types.ts b/lib/modules/versioning/types.ts index 2ed85c224c35c5..724f4cab622929 100644 --- a/lib/modules/versioning/types.ts +++ b/lib/modules/versioning/types.ts @@ -99,13 +99,13 @@ export interface VersioningApi { valueToVersion?(version: string): string; /** - * @returns true if sub range is entirely contained by dom range, false otherwise, + * @returns true if subRange is entirely contained by superRange, false otherwise, * and undefined if it cannot determine it. * - * @param sub - the sub range - * @param dom - the dom range + * @param subRange - the sub range + * @param superRange - the dom range */ - subset?(sub: string, dom: string): boolean | undefined; + subset?(subRange: string, superRange: string): boolean | undefined; } export interface VersioningApiConstructor {