Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

refactor!: use packageName and not depName for datasource lookups #20474

Merged
merged 20 commits into from
Feb 21, 2023
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions docs/usage/configuration-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,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.
Expand Down Expand Up @@ -1761,7 +1774,7 @@ This field also supports Regular Expressions if they begin and end with `/`. e.g
{
"packageRules": [
{
"matchBaseBranches": ["/^release\\/.*/"],
"matchBaseBranches": ["/^release/.*/"],
"excludePackagePatterns": ["^eslint"],
"enabled": false
}
Expand Down Expand Up @@ -2732,7 +2745,7 @@ regex definition:
{
"fileMatch": ["values.yaml$"],
"matchStrings": [
"image:\\s+(?<depName>my\\.old\\.registry\\/aRepository\\/andImage):(?<currentValue>[^\\s]+)"
"image:\\s+(?<depName>my\\.old\\.registry/aRepository/andImage):(?<currentValue>[^\\s]+)"
],
"depNameTemplate": "my.new.registry/aRepository/andImage",
"autoReplaceStringTemplate": "image: {{{depName}}}:{{{newValue}}}",
Expand Down
12 changes: 6 additions & 6 deletions docs/usage/self-hosted-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

<!-- prettier-ignore -->
Expand All @@ -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

Expand Down
25 changes: 16 additions & 9 deletions lib/config/options/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -340,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,
},
{
Expand Down Expand Up @@ -953,7 +961,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,
Expand Down Expand Up @@ -1334,7 +1342,7 @@ const options: RenovateOptions[] = [
name: 'rangeStrategy',
description: 'Determines how to modify or update existing ranges.',
type: 'string',
default: 'replace',
default: 'auto',
allowedValues: [
'auto',
'pin',
Expand Down Expand Up @@ -1571,16 +1579,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',
Expand Down Expand Up @@ -2240,9 +2248,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',
Expand Down
3 changes: 2 additions & 1 deletion lib/config/presets/common.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export const removedPresets: Record<string, string | null> = {
':autodetectPinVersions': ':autodetectRangeStrategy',
':autodetectPinVersions': null,
':autodetectRangeStrategy': null,
':automergeBranchMergeCommit': ':automergeBranch',
':automergeBranchPush': ':automergeBranch',
':base': 'config:base',
Expand Down
3 changes: 0 additions & 3 deletions lib/config/presets/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -839,9 +839,6 @@ describe('config/presets/index', () => {
':dependencyDashboard',
':semanticPrefixFixDepsChoreOthers',
':ignoreModulesAndTests',
':autodetectRangeStrategy',
':prHourlyLimit2',
':prConcurrentLimit10',
'group:monorepos',
'group:recommended',
'workarounds:all',
Expand Down
3 changes: 0 additions & 3 deletions lib/config/presets/internal/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ export const presets: Record<string, Preset> = {
':dependencyDashboard',
':semanticPrefixFixDepsChoreOthers',
':ignoreModulesAndTests',
':autodetectRangeStrategy',
':prHourlyLimit2',
':prConcurrentLimit10',
'group:monorepos',
'group:recommended',
'workarounds:all',
Expand Down
4 changes: 0 additions & 4 deletions lib/config/presets/internal/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ export const presets: Record<string, Preset> = {
assignees: ['{{arg0}}'],
description: 'Assign PRs to `{{arg0}}`.',
},
autodetectRangeStrategy: {
description: 'Automatically detect the best rangeStrategy to use.',
rangeStrategy: 'auto',
},
automergeAll: {
automerge: true,
description:
Expand Down
2 changes: 1 addition & 1 deletion lib/config/presets/internal/group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ const staticGroups = {
{
groupName: 'PHPStan packages',
matchDatasources: ['packagist'],
matchPackagePatterns: ['^phpstan\\/phpstan$', '\\/phpstan-'],
matchPackagePatterns: ['^phpstan/phpstan$', '/phpstan-'],
},
],
},
Expand Down
2 changes: 1 addition & 1 deletion lib/config/presets/internal/monorepo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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/',
Expand Down
3 changes: 3 additions & 0 deletions lib/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -251,6 +252,8 @@ export interface RenovateConfig

constraints?: Record<string, string>;
skipInstalls?: boolean;

constraintsFiltering?: ConstraintsFilter;
}

export interface AllConfig
Expand Down
4 changes: 1 addition & 3 deletions lib/modules/datasource/artifactory/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -70,7 +70,6 @@ describe('modules/datasource/artifactory/index', () => {
.reply(200, '<html>\n<h1>Header</h1>\n<a>1.3.0</a>\n<hmtl/>');
const res = await getPkgReleases({
registryUrls: [testRegistryUrl, secondRegistryUrl],
depName: testLookupName,
datasource,
packageName: testLookupName,
});
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/datasource/artifactory/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
18 changes: 9 additions & 9 deletions lib/modules/datasource/aws-machine-image/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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
Expand All @@ -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'
Expand All @@ -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();
Expand All @@ -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({
Expand All @@ -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({
Expand All @@ -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({
Expand Down
6 changes: 3 additions & 3 deletions lib/modules/datasource/aws-rds/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
Expand All @@ -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: [
Expand All @@ -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: [
Expand Down
8 changes: 4 additions & 4 deletions lib/modules/datasource/azure-pipelines-tasks/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe('modules/datasource/azure-pipelines-tasks/index', () => {
expect(
await getPkgReleases({
datasource: AzurePipelinesTasksDatasource.id,
depName: 'unknown',
packageName: 'unknown',
})
).toBeNull();
});
Expand All @@ -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' }] });
});
Expand All @@ -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' }] });
});
Expand All @@ -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' }] });
});
Expand Down
Loading