renovate/lib/config/types.ts

498 lines
13 KiB
TypeScript
Raw Normal View History

2021-03-02 20:44:55 +00:00
import type { LogLevel } from 'bunyan';
import type { PlatformId } from '../constants';
2021-03-02 20:44:55 +00:00
import type { HostRule } from '../types';
import type { GitNoVerifyOption } from '../util/git/types';
2019-08-23 13:46:31 +00:00
export type RenovateConfigStage =
| 'global'
| 'repository'
| 'package'
| 'branch'
| 'pr';
export type RepositoryCacheConfig = 'disabled' | 'enabled' | 'reset';
export type RepositoryCacheType = 'local' | string;
export type DryRunConfig = 'extract' | 'lookup' | 'full';
export type RequiredConfig = 'required' | 'optional' | 'ignored';
export interface GroupConfig extends Record<string, unknown> {
branchName?: string;
branchTopic?: string;
}
2019-08-23 13:46:31 +00:00
// TODO: Proper typings
export interface RenovateSharedConfig {
$schema?: string;
2019-08-23 13:46:31 +00:00
automerge?: boolean;
automergeStrategy?: MergeStrategy;
autoReplaceGlobalMatch?: boolean;
pruneBranchAfterAutomerge?: boolean;
branchPrefix?: string;
2022-05-28 11:53:34 +00:00
branchPrefixOld?: string;
branchName?: string;
branchNameStrict?: boolean;
2023-02-21 10:46:29 +00:00
manager?: string;
commitMessage?: string;
commitMessagePrefix?: string;
commitMessageTopic?: string;
commitMessageAction?: string;
commitMessageExtra?: string;
confidential?: boolean;
customChangelogUrl?: string;
draftPR?: boolean;
2019-08-23 13:46:31 +00:00
enabled?: boolean;
enabledManagers?: string[];
extends?: string[];
2020-05-03 08:14:22 +00:00
fileMatch?: string[];
force?: RenovateConfig;
group?: GroupConfig;
groupName?: string;
groupSlug?: string;
2020-05-03 08:14:22 +00:00
includePaths?: string[];
ignoreDeps?: string[];
ignorePaths?: string[];
ignoreTests?: boolean;
internalChecksAsSuccess?: boolean;
labels?: string[];
addLabels?: string[];
2020-07-11 09:55:30 +00:00
dependencyDashboardApproval?: boolean;
hashedBranchLength?: number;
npmrc?: string;
npmrcMerge?: boolean;
postUpgradeTasks?: PostUpgradeTasks;
prBodyColumns?: string[];
prBodyDefinitions?: Record<string, string>;
prCreation?: 'immediate' | 'not-pending' | 'status-success' | 'approval';
productLinks?: Record<string, string>;
prPriority?: number;
rebaseLabel?: string;
respectLatest?: boolean;
stopUpdatingLabel?: string;
rebaseWhen?: string;
recreateClosed?: boolean;
repository?: string;
repositoryCache?: RepositoryCacheConfig;
repositoryCacheType?: RepositoryCacheType;
schedule?: string[];
feat(core/automerge): Allow a separate schedule for automerge (#15680) * feat(core/automerge): Allow a separate schedule for automerge - init commit * feat(core/automerge): Allow a separate schedule for automerge - lint ci fix * feat(core/automerge): Allow a separate schedule for automerge - added docs entry * feat(core/automerge): Allow a separate schedule for automerge - added test coverage * feat(core/automerge): Allow a separate schedule for automerge - config-description.ts reorder methods * Apply suggestions from code review Co-authored-by: Michael Kriese <michael.kriese@visualon.de> * feat(core/automerge): Allow a separate schedule for automerge - cr changes - revert schedule.spec.ts changes - reset mocks in automerge.spec.ts * feat(core/automerge): Allow a separate schedule for automerge - cr changes * feat(core/automerge): Allow a separate schedule for automerge - cr changes * Apply suggestions from code review Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com> * feat(core/automerge): Allow a separate schedule for automerge - cr changes * feat(core/automerge): Allow a separate schedule for automerge - cr changes log update * feat(core/automerge): Allow a separate schedule for automerge - cr changes * Apply suggestions from code review Co-authored-by: Michael Kriese <michael.kriese@visualon.de> * feat(core/automerge): Allow a separate schedule for automerge - prettier fix and test update Co-authored-by: Michael Kriese <michael.kriese@visualon.de> Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com> Co-authored-by: Rhys Arkins <rhys@arkins.net>
2022-05-31 05:13:05 +00:00
automergeSchedule?: string[];
semanticCommits?: 'auto' | 'enabled' | 'disabled';
semanticCommitScope?: string | null;
2019-08-23 13:46:31 +00:00
semanticCommitType?: string;
suppressNotifications?: string[];
timezone?: string;
unicodeEmoji?: boolean;
gitIgnoredAuthors?: string[];
platformCommit?: boolean;
}
2021-02-05 09:49:34 +00:00
// Config options used only within the global worker
2021-02-05 12:08:17 +00:00
// The below should contain config options where stage=global
2021-02-07 21:12:54 +00:00
export interface GlobalOnlyConfig {
2021-02-05 09:49:34 +00:00
autodiscover?: boolean;
autodiscoverFilter?: string[] | string;
2021-02-05 21:35:03 +00:00
baseDir?: string;
2021-05-19 10:27:37 +00:00
cacheDir?: string;
containerbaseDir?: string;
detectHostRulesFromEnv?: boolean;
2021-02-05 11:43:26 +00:00
forceCli?: boolean;
gitNoVerify?: GitNoVerifyOption[];
2021-02-05 11:43:26 +00:00
gitPrivateKey?: string;
globalExtends?: string[];
2021-02-05 09:49:34 +00:00
logFile?: string;
logFileLevel?: LogLevel;
2021-02-05 11:43:26 +00:00
prCommitsPerRunLimit?: number;
privateKeyPath?: string;
privateKeyPathOld?: string;
2021-02-05 09:49:34 +00:00
redisUrl?: string;
repositories?: RenovateRepository[];
platform?: PlatformId;
endpoint?: string;
2021-02-05 09:49:34 +00:00
}
2021-02-05 12:08:17 +00:00
// Config options used within the repository worker, but not user configurable
2021-08-15 06:34:54 +00:00
// The below should contain config options where globalOnly=true
export interface RepoGlobalConfig {
allowCustomCrateRegistries?: boolean;
allowPlugins?: boolean;
allowPostUpgradeCommandTemplating?: boolean;
allowScripts?: boolean;
allowedPostUpgradeCommands?: string[];
binarySource?: 'docker' | 'global' | 'install' | 'hermit';
cacheHardTtlMinutes?: number;
customEnvVariables?: Record<string, string>;
dockerChildPrefix?: string;
2021-02-05 08:20:47 +00:00
dockerImagePrefix?: string;
dockerUser?: string;
dryRun?: DryRunConfig;
executionTimeout?: number;
2022-04-17 17:12:42 +00:00
gitTimeout?: number;
exposeAllEnv?: boolean;
githubTokenWarn?: boolean;
2021-05-22 21:47:28 +00:00
migratePresets?: Record<string, string>;
2021-09-10 10:47:33 +00:00
privateKey?: string;
privateKeyOld?: string;
localDir?: string;
cacheDir?: string;
containerbaseDir?: string;
platform?: PlatformId;
endpoint?: string;
2021-02-05 08:20:47 +00:00
}
2021-02-07 21:13:55 +00:00
export interface LegacyAdminConfig {
localDir?: string;
2021-02-05 09:49:34 +00:00
logContext?: string;
onboarding?: boolean;
onboardingBranch?: string;
onboardingCommitMessage?: string;
onboardingNoDeps?: boolean;
onboardingRebaseCheckbox?: boolean;
onboardingPrTitle?: string;
onboardingConfig?: RenovateSharedConfig;
onboardingConfigFileName?: string;
requireConfig?: RequiredConfig;
2019-08-23 13:46:31 +00:00
}
2021-04-09 03:51:03 +00:00
export type ExecutionMode = 'branch' | 'update';
2019-08-23 13:46:31 +00:00
export interface PostUpgradeTasks {
2020-02-04 05:59:13 +00:00
commands?: string[];
fileFilters?: string[];
2021-04-09 03:51:03 +00:00
executionMode: ExecutionMode;
}
2020-02-04 05:59:13 +00:00
export type UpdateConfig<
T extends RenovateSharedConfig = RenovateSharedConfig
> = Partial<Record<UpdateType, T | null>>;
2019-08-23 13:46:31 +00:00
export type RenovateRepository =
| string
| {
repository: string;
2021-03-22 14:51:38 +00:00
secrets?: Record<string, string>;
};
export interface RegexManagerTemplates {
2020-03-06 08:07:55 +00:00
depNameTemplate?: string;
packageNameTemplate?: string;
datasourceTemplate?: string;
2020-03-06 08:07:55 +00:00
versioningTemplate?: string;
depTypeTemplate?: string;
currentValueTemplate?: string;
currentDigestTemplate?: string;
extractVersionTemplate?: string;
registryUrlTemplate?: string;
}
export interface RegExManager extends RegexManagerTemplates {
fileMatch: string[];
matchStrings: string[];
matchStringsStrategy?: MatchStringsStrategy;
autoReplaceStringTemplate?: string;
2020-03-06 08:07:55 +00:00
}
export type UseBaseBranchConfigType = 'merge' | 'none';
export type ConstraintsFilter = 'strict' | 'none';
2019-08-23 13:46:31 +00:00
// TODO: Proper typings
export interface RenovateConfig
2021-02-07 21:13:55 +00:00
extends LegacyAdminConfig,
RenovateSharedConfig,
2019-08-23 13:46:31 +00:00
UpdateConfig<PackageRule>,
AssigneesAndReviewersConfig,
ConfigMigration,
Record<string, unknown> {
depName?: string;
2019-08-23 13:46:31 +00:00
baseBranches?: string[];
useBaseBranchConfig?: UseBaseBranchConfigType;
baseBranch?: string;
defaultBranch?: string;
branchList?: string[];
2020-04-29 12:27:33 +00:00
description?: string | string[];
force?: RenovateConfig;
2019-08-23 13:46:31 +00:00
errors?: ValidationMessage[];
gitAuthor?: string;
hostRules?: HostRule[];
ignorePresets?: string[];
forkProcessing?: 'auto' | 'enabled' | 'disabled';
isFork?: boolean;
fileList?: string[];
2021-02-05 21:24:20 +00:00
configWarningReuseIssue?: boolean;
2020-07-11 09:55:30 +00:00
dependencyDashboard?: boolean;
dependencyDashboardAutoclose?: boolean;
dependencyDashboardChecks?: Record<string, string>;
dependencyDashboardIssue?: number;
2020-07-11 09:55:30 +00:00
dependencyDashboardTitle?: string;
dependencyDashboardHeader?: string;
dependencyDashboardFooter?: string;
dependencyDashboardLabels?: string[];
packageFile?: string;
2019-08-23 13:46:31 +00:00
packageRules?: PackageRule[];
2021-02-05 16:55:37 +00:00
postUpdateOptions?: string[];
prConcurrentLimit?: number;
prHourlyLimit?: number;
forkModeDisallowMaintainerEdits?: boolean;
defaultRegistryUrls?: string[];
registryUrls?: string[] | null;
registryAliases?: Record<string, string>;
repoIsOnboarded?: boolean;
repoIsActivated?: boolean;
updateInternalDeps?: boolean;
updateType?: UpdateType;
2019-08-23 13:46:31 +00:00
warnings?: ValidationMessage[];
vulnerabilityAlerts?: RenovateSharedConfig;
osvVulnerabilityAlerts?: boolean;
regexManagers?: RegExManager[];
fetchReleaseNotes?: boolean;
2021-03-22 14:51:38 +00:00
secrets?: Record<string, string>;
constraints?: Record<string, string>;
skipInstalls?: boolean | null;
constraintsFiltering?: ConstraintsFilter;
2019-08-23 13:46:31 +00:00
}
2022-07-21 07:00:02 +00:00
export interface AllConfig
extends RenovateConfig,
GlobalOnlyConfig,
RepoGlobalConfig {}
2021-02-05 09:49:34 +00:00
export interface AssigneesAndReviewersConfig {
assigneesFromCodeOwners?: boolean;
assignees?: string[];
assigneesSampleSize?: number;
ignoreReviewers?: string[];
reviewersFromCodeOwners?: boolean;
reviewers?: string[];
reviewersSampleSize?: number;
additionalReviewers?: string[];
2021-04-22 19:16:58 +00:00
filterUnavailableUsers?: boolean;
}
2019-08-23 13:46:31 +00:00
export type UpdateType =
| 'major'
| 'minor'
| 'patch'
| 'pin'
| 'digest'
| 'pinDigest'
2019-08-23 13:46:31 +00:00
| 'lockFileMaintenance'
| 'lockfileUpdate'
2019-08-23 13:46:31 +00:00
| 'rollback'
| 'bump'
| 'replacement';
2019-08-23 13:46:31 +00:00
export type MatchStringsStrategy = 'any' | 'recursive' | 'combination';
export type MergeStrategy =
| 'auto'
| 'fast-forward'
| 'merge-commit'
| 'rebase'
| 'squash';
2019-08-23 13:46:31 +00:00
// TODO: Proper typings
export interface PackageRule
extends RenovateSharedConfig,
UpdateConfig,
Record<string, unknown> {
description?: string | string[];
2021-02-19 15:29:50 +00:00
matchFiles?: string[];
matchPaths?: string[];
matchLanguages?: string[];
matchBaseBranches?: string[];
matchManagers?: string | string[];
matchDatasources?: string[];
matchDepTypes?: string[];
matchDepNames?: string[];
matchDepPatterns?: string[];
matchPackageNames?: string[];
matchPackagePatterns?: string[];
matchPackagePrefixes?: string[];
excludeDepNames?: string[];
excludeDepPatterns?: string[];
2019-08-23 13:46:31 +00:00
excludePackageNames?: string[];
excludePackagePatterns?: string[];
excludePackagePrefixes?: string[];
2022-09-25 06:56:02 +00:00
matchCurrentValue?: string;
matchCurrentVersion?: string;
matchSourceUrlPrefixes?: string[];
2022-03-28 07:58:20 +00:00
matchSourceUrls?: string[];
matchUpdateTypes?: UpdateType[];
registryUrls?: string[] | null;
2019-08-23 13:46:31 +00:00
}
export interface ValidationMessage {
topic: string;
2019-08-23 13:46:31 +00:00
message: string;
}
2021-03-02 20:44:55 +00:00
export interface RenovateOptionBase {
/**
* If true, the option can only be configured by people with access to the Renovate instance.
* Furthermore, the option should be documented in docs/usage/self-hosted-configuration.md.
*/
2021-08-15 06:34:54 +00:00
globalOnly?: boolean;
2021-03-02 20:44:55 +00:00
allowedValues?: string[];
allowString?: boolean;
cli?: boolean;
description: string;
env?: false | string;
/**
* Do not validate object children
*/
2021-03-02 20:44:55 +00:00
freeChoice?: boolean;
2021-03-02 20:44:55 +00:00
mergeable?: boolean;
autogenerated?: boolean;
name: string;
parent?: 'hostRules' | 'packageRules' | 'postUpgradeTasks' | 'regexManagers';
// used by tests
relatedOptions?: string[];
stage?: RenovateConfigStage;
experimental?: boolean;
experimentalDescription?: string;
experimentalIssues?: number[];
advancedUse?: boolean;
2021-03-02 20:44:55 +00:00
}
export interface RenovateArrayOption<
T extends string | number | Record<string, unknown> = Record<string, unknown>
> extends RenovateOptionBase {
default?: T[] | null;
2021-03-02 20:44:55 +00:00
mergeable?: boolean;
type: 'array';
subType?: 'string' | 'object' | 'number';
supportedManagers?: string[] | 'all';
supportedPlatforms?: string[] | 'all';
2021-03-02 20:44:55 +00:00
}
export interface RenovateStringArrayOption extends RenovateArrayOption<string> {
format?: 'regex';
subType: 'string';
supportedManagers?: string[] | 'all';
supportedPlatforms?: string[] | 'all';
2021-03-02 20:44:55 +00:00
}
export interface RenovateNumberArrayOption extends RenovateArrayOption<number> {
subType: 'number';
supportedManagers?: string[] | 'all';
supportedPlatforms?: string[] | 'all';
2021-03-02 20:44:55 +00:00
}
export interface RenovateBooleanOption extends RenovateOptionBase {
default?: boolean | null;
2021-03-02 20:44:55 +00:00
type: 'boolean';
supportedManagers?: string[] | 'all';
supportedPlatforms?: string[] | 'all';
2021-03-02 20:44:55 +00:00
}
export interface RenovateIntegerOption extends RenovateOptionBase {
default?: number | null;
2021-03-02 20:44:55 +00:00
type: 'integer';
supportedManagers?: string[] | 'all';
supportedPlatforms?: string[] | 'all';
2021-03-02 20:44:55 +00:00
}
export interface RenovateStringOption extends RenovateOptionBase {
default?: string | null;
2021-03-02 20:44:55 +00:00
format?: 'regex';
// Not used
replaceLineReturns?: boolean;
type: 'string';
supportedManagers?: string[] | 'all';
supportedPlatforms?: string[] | 'all';
2021-03-02 20:44:55 +00:00
}
export interface RenovateObjectOption extends RenovateOptionBase {
default?: any | null;
2021-03-02 20:44:55 +00:00
additionalProperties?: Record<string, unknown> | boolean;
mergeable?: boolean;
type: 'object';
supportedManagers?: string[] | 'all';
supportedPlatforms?: string[] | 'all';
2021-03-02 20:44:55 +00:00
}
export type RenovateOptions =
| RenovateStringOption
| RenovateNumberArrayOption
| RenovateStringArrayOption
| RenovateIntegerOption
| RenovateBooleanOption
| RenovateArrayOption
| RenovateObjectOption;
export interface PackageRuleInputConfig extends Record<string, unknown> {
versioning?: string;
packageFile?: string;
depType?: string;
depTypes?: string[];
depName?: string;
packageName?: string | null;
currentValue?: string | null;
currentVersion?: string;
lockedVersion?: string;
updateType?: UpdateType;
isBump?: boolean;
sourceUrl?: string | null;
language?: string;
baseBranch?: string;
2023-02-21 10:46:29 +00:00
manager?: string;
datasource?: string;
packageRules?: (PackageRule & PackageRuleInputConfig)[];
}
export interface ConfigMigration {
configMigration?: boolean;
}
export interface MigratedConfig {
isMigrated: boolean;
migratedConfig: RenovateConfig;
}
export interface MigratedRenovateConfig extends RenovateConfig {
endpoints?: HostRule[];
pathRules: PackageRule[];
packages: PackageRule[];
node?: RenovateConfig;
travis?: RenovateConfig;
gradle?: RenovateConfig;
}
export interface ManagerConfig extends RenovateConfig {
manager: string;
language?: string | null;
}
export interface ValidationResult {
errors: ValidationMessage[];
warnings: ValidationMessage[];
}