Skip to content

Commit

Permalink
Merge branch 'feat/parent-group-presets' of github.com:valenvb/renova…
Browse files Browse the repository at this point in the history
…te into feat/parent-group-presets
  • Loading branch information
valenvb committed Dec 12, 2023
2 parents 7f59f14 + f27f9c8 commit 3fa2c21
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 52 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FROM ghcr.io/containerbase/devcontainer:9.30.0
FROM ghcr.io/containerbase/devcontainer:9.30.2
2 changes: 1 addition & 1 deletion docs/usage/config-presets.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ If you are proposing a "monorepo" preset addition then it's OK to raise a PR dir
Whenever repository onboarding happens, Renovate checks for a a default config to extend.
Renovate will check for a repository called `renovate-config` with a `default.json` file in the parent user/group/org of the repository.
On platforms that support nested groups (e.g. GitLab), Renovate will check for this repository at each level of grouping, from nearest to furthest, and use the first one it finds.
On all platforms, it will also look for a repository named like `.{{platform}}` (e.g. `.github`) with a `renovate-config.json`, under the same top-level user/group/org.
On all platforms, it will then look for a repository named like `.{{platform}}` (e.g. `.github`) with a `renovate-config.json`, under the same top-level user/group/org.

If found, that repository's preset will be suggested as the sole extended preset, and any existing `onboardingConfig` config will be ignored/overridden.
For example the result may be:
Expand Down
7 changes: 6 additions & 1 deletion lib/config/validation.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import is from '@sindresorhus/is';
import { logger } from '../logger';
import { allManagersList, getManagerList } from '../modules/manager';
import { isCustomManager } from '../modules/manager/custom';
import type {
Expand Down Expand Up @@ -667,7 +668,11 @@ function validateRegexManagerFields(
for (const matchString of customManager.matchStrings) {
try {
regEx(matchString);
} catch (e) {
} catch (err) {
logger.debug(
{ err },
'customManager.matchStrings regEx validation error',
);
errors.push({
topic: 'Configuration Error',
message: `Invalid regExp for ${currentPath}: \`${matchString}\``,
Expand Down
44 changes: 31 additions & 13 deletions lib/modules/versioning/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,33 +12,51 @@ export interface VersioningApi {
// validation

/**
* Check whether the `version` is compatible with the `current` value
* constraint.
* Check whether the `input` is the valid version or range.
*
* For some managers, ranges are called "constraints","specifiers", "requirements", etc.
* We stick to the term "range" for all of it.
*/
isCompatible(version: string, current?: string): boolean;
isValid(input: string): boolean;

/**
* Check whether the `version` constraint is not a range, i.e. it only allows a
* single specific version.
* Check whether the `input` is a valid version.
*
* There is no direct way to determine whether the `input` is the range,
* but combination of `isVersion` and `isValid` can be used for that:
*
* `isValid(input) && !isVersion(input)`
*/
isSingleVersion(version: string): boolean;
isVersion(input: string | undefined | null): boolean;

/**
* Check whether the `version` is considered to be "stable".
* Check whether the `input` is the:
*
* 1. Version, or
* 2. Range with the special syntax of matching exactly one version:
* - `==1.2.3` or `===1.2.3` for Python,
* - `=1.2.3` for NPM,
* - `[1.2.3]` for Maven or NuGet.
*
* Example: in SemVer the version must not have a pre-release marker.
* This is used to provide pinning functionality.
*/
isStable(version: string): boolean;
isSingleVersion(input: string): boolean;

/**
* Check whether the `input` is a valid version or a valid version range constraint.
* Check whether the `version` is considered to be "stable".
*/
isValid(input: string): boolean;
isStable(version: string): boolean;

/**
* Check whether the `input` is a valid version string.
* Determines whether the version is compatible with the current one,
* in some manager-dependent way.
*
* For most managers, all valid versions are compatible between each other.
*
* However, for example, Docker versions `1.2.3` and `1.2.4-alpine` are not compatible,
* i.e. `1.2.4-alpine` is not a valid upgrade for `1.2.3`.
*/
isVersion(input: string | undefined | null): boolean;
isCompatible(version: string, current?: string): boolean;

// digestion of version

Expand Down
4 changes: 3 additions & 1 deletion lib/util/regex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,11 @@ export function regEx(
}
return instance;
} catch (err) {
logger.trace({ err }, 'RegEx constructor error');
const error = new Error(CONFIG_VALIDATION);
error.validationMessage = err.message;
error.validationSource = pattern.toString();
error.validationError = `Invalid regular expression: ${pattern.toString()}`;
error.validationError = `Invalid regular expression (re2): ${pattern.toString()}`;
throw error;
}
}
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@
"@opentelemetry/semantic-conventions": "1.18.1",
"@qnighy/marshal": "0.1.3",
"@renovatebot/osv-offline": "1.3.10",
"@renovatebot/pep440": "3.0.12",
"@renovatebot/ruby-semver": "3.0.19",
"@renovatebot/pep440": "3.0.13",
"@renovatebot/ruby-semver": "3.0.20",
"@sindresorhus/is": "4.6.0",
"@types/ms": "0.7.34",
"@types/tmp": "0.2.6",
Expand Down Expand Up @@ -283,7 +283,7 @@
"@types/git-url-parse": "9.0.3",
"@types/github-url-from-git": "1.5.3",
"@types/global-agent": "2.1.3",
"@types/ini": "1.3.33",
"@types/ini": "1.3.34",
"@types/js-yaml": "4.0.9",
"@types/json-dup-key-validator": "1.0.2",
"@types/linkify-markdown": "1.0.3",
Expand Down Expand Up @@ -339,7 +339,7 @@
"nyc": "15.1.0",
"pretty-format": "29.7.0",
"rimraf": "5.0.5",
"semantic-release": "22.0.8",
"semantic-release": "22.0.12",
"tar": "6.2.0",
"tmp-promise": "3.0.3",
"ts-jest": "29.1.1",
Expand Down
62 changes: 31 additions & 31 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3fa2c21

Please sign in to comment.