Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 14 additions & 0 deletions lib/config/global.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { GlobalConfig } from './global';
import { getOptions } from './options';

describe('config/global', () => {
it('all values in OPTIONS are sorted', () => {
Expand All @@ -10,4 +11,17 @@
sorted,
);
});

it('all globalOnly configuration options should be defined in OPTIONS', () => {
const globalOnlyOptions = getOptions()
.filter((o) => o.globalOnly)
.map((o) => o.name);

const defined = GlobalConfig.OPTIONS;

expect(
globalOnlyOptions,
'All globalOnly options should be defined in OPTIONS',
).toEqual(defined);

Check failure on line 25 in lib/config/global.spec.ts

View workflow job for this annotation

GitHub Actions / test (16/16)

lib/config/global.spec.ts > config/global > all globalOnly configuration options should be defined in OPTIONS

AssertionError: All globalOnly options should be defined in OPTIONS: expected [ 'allowedHeaders', …(100) ] to deeply equal [ Array(101) ] - Expected + Received [ - "allowCustomCrateRegistries", - "allowPlugins", - "allowScripts", - "allowedCommands", - "allowedEnv", "allowedHeaders", - "allowedUnsafeExecutions", - "autodiscover", - "autodiscoverFilter", - "autodiscoverNamespaces", - "autodiscoverProjects", "autodiscoverRepoOrder", "autodiscoverRepoSort", - "autodiscoverTopics", + "allowedEnv", + "detectGlobalManagerConfig", + "detectHostRulesFromEnv", + "mergeConfidenceEndpoint", + "mergeConfidenceDatasources", + "useCloudMetadataServices", + "userAgent", + "allowedCommands", + "onboardingBranch", + "onboardingCommitMessage", + "configFileNames", + "onboardingConfigFileName", + "onboardingNoDeps", + "onboardingPrTitle", + "productLinks", + "secrets", + "variables", + "migratePresets", + "presetCachePersistence", + "globalExtends", + "repositoryCache", + "repositoryCacheType", + "reportType", + "reportPath", + "force", + "forceCli", + "dryRun", + "binarySource", + "redisUrl", + "redisPrefix", "baseDir", - "bbUseDevelopmentBranch", - "binarySource", "cacheDir", - "cacheHardTtlMinutes", - "cachePrivatePackages", - "cacheTtlOverride", - "checkedBranches", - "configFileNames", - "configValidationError", "containerbaseDir", "customEnvVariables", - "deleteAdditionalConfigFile", - "deleteConfigFile", - "detectGlobalManagerConfig", - "detectHostRulesFromEnv", "dockerChildPrefix", "dockerCliOptions", - "dockerMaxPages", "dockerSidecarImage", "dockerUser", - "dryRun", - "encryptedWarning", - "endpoint", - "executionTimeout", - "exposeAllEnv", - "force", - "forceCli", + "logContext", + "onboarding", + "onboardingConfig", + "onboardingRebaseCheckbox", + "includeMirrors", "forkCreation", + "forkToken", "forkOrg", - "forkToken", - "gitNoVerify", - "gitPrivateKey", - "gitPrivateKeyPassphrase", - "gitTimeout", - "gitUrl", "githubTokenWarn", - "globalExtends", - "httpCacheTtlDays", - "ignorePrAuthor", - "includeMirrors", + "encryptedWarning", "inheritConfig", + "inheritConfigRepoName", "inheritConfigFileName", - "inheritConfigRepoName", "inheritConfigStrict", - "logContext", - "mergeConfidenceDatasources", - "mergeConfidenceEndpoint", - "migratePresets", - "onboarding", - "onboardingBranch", - "onboardingCommitMessage", - "onboardingConfig", - "onboardingConfigFileName", - "onboardingNoDeps", - "onboardingPrTitle", - "onboardingRebaseCheckbox", + "requireConfig", "optimizeForDisabled", - "password", - "persistRepoData", - "platform", - "prCommitsPerRunLimit", - "presetCachePersistence", "privateKey", "privateKeyOld", "privateKeyPath", "privateKeyPathOld", + "persistRepoData", + "exposeAllEnv", + "allowPlugins", + "allowScripts", + "allowCustomCrateRegistries", + "platform", + "endpoint", + "token", + "username", + "password", + "autodiscover", + "autodiscoverFilter", + "autodiscoverNamespaces", + "autodiscoverProjects", + "autodiscoverTopics", + "prCommitsPerRunLimit", + "repositories", + "gitPrivateKey", + "gitPrivateKeyPassphrase", + "gitTimeout", + "executionTimeout", "processEnv", - "productLinks", - "redisPrefix", - "redisUrl", - "reportPath", - "reportType", - "repositories", - "repositoryCache", - "repositoryCacheType", - "requireConfig", + "bbUseDevelopmentBranch", + "cacheHardTtlMinutes", + "cacheTtlOverride", + "unicodeEmoji", + "ignorePrAuthor", + "allowedUnsafeExecutions", + "gitNoVerify", + "gitUrl", + "writeDiscoveredRepos", + "checkedBranches", + "httpCacheTtlDays", + "dockerMaxPages", + "deleteConfigFile", + "deleteAdditionalConfigFile", "s3Endpoint", "s3PathStyle", - "secrets", - "token", - "unicodeEmoji", - "useCloudMetadataServices
});
});
150 changes: 109 additions & 41 deletions lib/config/global.ts
Original file line number Diff line number Diff line change
@@ -1,46 +1,114 @@
import type { RenovateConfig, RepoGlobalConfig } from './types';
import type {
GlobalOnlyConfig,
RenovateConfig,
RepoGlobalConfig,
} from './types';

export class GlobalConfig {
// TODO: once global config work is complete, add a test to make sure this list includes all options with globalOnly=true (#9603)
static OPTIONS: readonly (keyof RepoGlobalConfig)[] = [
'allowCustomCrateRegistries',
'allowPlugins',
'allowScripts',
'allowedCommands',
'allowedEnv',
'allowedHeaders',
'autodiscoverRepoOrder',
'autodiscoverRepoSort',
'binarySource',
'cacheDir',
'cacheHardTtlMinutes',
'cachePrivatePackages',
'cacheTtlOverride',
'containerbaseDir',
'customEnvVariables',
'dockerChildPrefix',
'dockerCliOptions',
'dockerMaxPages',
'dockerSidecarImage',
'dockerUser',
'dryRun',
'encryptedWarning',
'endpoint',
'executionTimeout',
'exposeAllEnv',
'gitTimeout',
'githubTokenWarn',
'httpCacheTtlDays',
'ignorePrAuthor',
'includeMirrors',
'localDir',
'migratePresets',
'platform',
'presetCachePersistence',
's3Endpoint',
's3PathStyle',
'userAgent',
];
static OPTIONS: readonly (keyof RepoGlobalConfig | keyof GlobalOnlyConfig)[] =
[
'allowCustomCrateRegistries',
'allowPlugins',
'allowScripts',
'allowedCommands',
'allowedEnv',
'allowedHeaders',
'allowedUnsafeExecutions',
'autodiscover',
'autodiscoverFilter',
'autodiscoverNamespaces',
'autodiscoverProjects',
'autodiscoverRepoOrder',
'autodiscoverRepoSort',
'autodiscoverTopics',
'baseDir',
'bbUseDevelopmentBranch',

Check failure on line 25 in lib/config/global.ts

View workflow job for this annotation

GitHub Actions / build

Type '"bbUseDevelopmentBranch"' is not assignable to type '"privateKey" | "privateKeyOld" | "gitPrivateKey" | "endpoint" | "allowedCommands" | "allowCustomCrateRegistries" | "allowPlugins" | "allowScripts" | "allowedEnv" | "allowedHeaders" | ... 54 more ... | "deleteAdditionalConfigFile"'.

Check failure on line 25 in lib/config/global.ts

View workflow job for this annotation

GitHub Actions / lint-other

Type '"bbUseDevelopmentBranch"' is not assignable to type '"platform" | "privateKey" | "privateKeyOld" | "gitPrivateKey" | "endpoint" | "localDir" | "cacheDir" | "allowedCommands" | "allowCustomCrateRegistries" | "allowPlugins" | ... 54 more ... | "deleteAdditionalConfigFile"'.
'binarySource',
'cacheDir',
'cacheHardTtlMinutes',
'cachePrivatePackages',
'cacheTtlOverride',
'checkedBranches',

Check failure on line 31 in lib/config/global.ts

View workflow job for this annotation

GitHub Actions / build

Type '"checkedBranches"' is not assignable to type '"privateKey" | "privateKeyOld" | "gitPrivateKey" | "endpoint" | "allowedCommands" | "allowCustomCrateRegistries" | "allowPlugins" | "allowScripts" | "allowedEnv" | "allowedHeaders" | ... 54 more ... | "deleteAdditionalConfigFile"'.

Check failure on line 31 in lib/config/global.ts

View workflow job for this annotation

GitHub Actions / lint-other

Type '"checkedBranches"' is not assignable to type '"platform" | "privateKey" | "privateKeyOld" | "gitPrivateKey" | "endpoint" | "localDir" | "cacheDir" | "allowedCommands" | "allowCustomCrateRegistries" | "allowPlugins" | ... 54 more ... | "deleteAdditionalConfigFile"'.
'configFileNames',
'configValidationError',

Check failure on line 33 in lib/config/global.ts

View workflow job for this annotation

GitHub Actions / build

Type '"configValidationError"' is not assignable to type '"privateKey" | "privateKeyOld" | "gitPrivateKey" | "endpoint" | "allowedCommands" | "allowCustomCrateRegistries" | "allowPlugins" | "allowScripts" | "allowedEnv" | "allowedHeaders" | ... 54 more ... | "deleteAdditionalConfigFile"'.

Check failure on line 33 in lib/config/global.ts

View workflow job for this annotation

GitHub Actions / lint-other

Type '"configValidationError"' is not assignable to type '"platform" | "privateKey" | "privateKeyOld" | "gitPrivateKey" | "endpoint" | "localDir" | "cacheDir" | "allowedCommands" | "allowCustomCrateRegistries" | "allowPlugins" | ... 54 more ... | "deleteAdditionalConfigFile"'.
'containerbaseDir',
'customEnvVariables',
'deleteAdditionalConfigFile',
'deleteConfigFile',
'detectGlobalManagerConfig',

Check failure on line 38 in lib/config/global.ts

View workflow job for this annotation

GitHub Actions / build

Type '"detectGlobalManagerConfig"' is not assignable to type '"privateKey" | "privateKeyOld" | "gitPrivateKey" | "endpoint" | "allowedCommands" | "allowCustomCrateRegistries" | "allowPlugins" | "allowScripts" | "allowedEnv" | "allowedHeaders" | ... 54 more ... | "deleteAdditionalConfigFile"'.

Check failure on line 38 in lib/config/global.ts

View workflow job for this annotation

GitHub Actions / lint-other

Type '"detectGlobalManagerConfig"' is not assignable to type '"platform" | "privateKey" | "privateKeyOld" | "gitPrivateKey" | "endpoint" | "localDir" | "cacheDir" | "allowedCommands" | "allowCustomCrateRegistries" | "allowPlugins" | ... 54 more ... | "deleteAdditionalConfigFile"'.
'detectHostRulesFromEnv',
'dockerChildPrefix',
'dockerCliOptions',
'dockerMaxPages',
'dockerSidecarImage',
'dockerUser',
'dryRun',
'encryptedWarning',
'endpoint',
'executionTimeout',
'exposeAllEnv',
'force',

Check failure on line 50 in lib/config/global.ts

View workflow job for this annotation

GitHub Actions / build

Type '"force"' is not assignable to type '"privateKey" | "privateKeyOld" | "gitPrivateKey" | "endpoint" | "allowedCommands" | "allowCustomCrateRegistries" | "allowPlugins" | "allowScripts" | "allowedEnv" | "allowedHeaders" | ... 54 more ... | "deleteAdditionalConfigFile"'.

Check failure on line 50 in lib/config/global.ts

View workflow job for this annotation

GitHub Actions / lint-other

Type '"force"' is not assignable to type '"platform" | "privateKey" | "privateKeyOld" | "gitPrivateKey" | "endpoint" | "localDir" | "cacheDir" | "allowedCommands" | "allowCustomCrateRegistries" | "allowPlugins" | ... 54 more ... | "deleteAdditionalConfigFile"'.
'forceCli',
'forkCreation',

Check failure on line 52 in lib/config/global.ts

View workflow job for this annotation

GitHub Actions / build

Type '"forkCreation"' is not assignable to type '"privateKey" | "privateKeyOld" | "gitPrivateKey" | "endpoint" | "allowedCommands" | "allowCustomCrateRegistries" | "allowPlugins" | "allowScripts" | "allowedEnv" | "allowedHeaders" | ... 54 more ... | "deleteAdditionalConfigFile"'.

Check failure on line 52 in lib/config/global.ts

View workflow job for this annotation

GitHub Actions / lint-other

Type '"forkCreation"' is not assignable to type '"platform" | "privateKey" | "privateKeyOld" | "gitPrivateKey" | "endpoint" | "localDir" | "cacheDir" | "allowedCommands" | "allowCustomCrateRegistries" | "allowPlugins" | ... 54 more ... | "deleteAdditionalConfigFile"'.
'forkOrg',

Check failure on line 53 in lib/config/global.ts

View workflow job for this annotation

GitHub Actions / build

Type '"forkOrg"' is not assignable to type '"privateKey" | "privateKeyOld" | "gitPrivateKey" | "endpoint" | "allowedCommands" | "allowCustomCrateRegistries" | "allowPlugins" | "allowScripts" | "allowedEnv" | "allowedHeaders" | ... 54 more ... | "deleteAdditionalConfigFile"'.

Check failure on line 53 in lib/config/global.ts

View workflow job for this annotation

GitHub Actions / lint-other

Type '"forkOrg"' is not assignable to type '"platform" | "privateKey" | "privateKeyOld" | "gitPrivateKey" | "endpoint" | "localDir" | "cacheDir" | "allowedCommands" | "allowCustomCrateRegistries" | "allowPlugins" | ... 54 more ... | "deleteAdditionalConfigFile"'.
'forkToken',

Check failure on line 54 in lib/config/global.ts

View workflow job for this annotation

GitHub Actions / build

Type '"forkToken"' is not assignable to type '"privateKey" | "privateKeyOld" | "gitPrivateKey" | "endpoint" | "allowedCommands" | "allowCustomCrateRegistries" | "allowPlugins" | "allowScripts" | "allowedEnv" | "allowedHeaders" | ... 54 more ... | "deleteAdditionalConfigFile"'.

Check failure on line 54 in lib/config/global.ts

View workflow job for this annotation

GitHub Actions / lint-other

Type '"forkToken"' is not assignable to type '"platform" | "privateKey" | "privateKeyOld" | "gitPrivateKey" | "endpoint" | "localDir" | "cacheDir" | "allowedCommands" | "allowCustomCrateRegistries" | "allowPlugins" | ... 54 more ... | "deleteAdditionalConfigFile"'.
'gitNoVerify',
'gitPrivateKey',
'gitPrivateKeyPassphrase',
'gitTimeout',
'gitUrl',

Check failure on line 59 in lib/config/global.ts

View workflow job for this annotation

GitHub Actions / build

Type '"gitUrl"' is not assignable to type '"privateKey" | "privateKeyOld" | "gitPrivateKey" | "endpoint" | "allowedCommands" | "allowCustomCrateRegistries" | "allowPlugins" | "allowScripts" | "allowedEnv" | "allowedHeaders" | ... 54 more ... | "deleteAdditionalConfigFile"'.

Check failure on line 59 in lib/config/global.ts

View workflow job for this annotation

GitHub Actions / lint-other

Type '"gitUrl"' is not assignable to type '"platform" | "privateKey" | "privateKeyOld" | "gitPrivateKey" | "endpoint" | "localDir" | "cacheDir" | "allowedCommands" | "allowCustomCrateRegistries" | "allowPlugins" | ... 54 more ... | "deleteAdditionalConfigFile"'.
'githubTokenWarn',
'globalExtends',
'httpCacheTtlDays',
'ignorePrAuthor',
'includeMirrors',
'inheritConfig',

Check failure on line 65 in lib/config/global.ts

View workflow job for this annotation

GitHub Actions / build

Type '"inheritConfig"' is not assignable to type '"privateKey" | "privateKeyOld" | "gitPrivateKey" | "endpoint" | "allowedCommands" | "allowCustomCrateRegistries" | "allowPlugins" | "allowScripts" | "allowedEnv" | "allowedHeaders" | ... 54 more ... | "deleteAdditionalConfigFile"'.

Check failure on line 65 in lib/config/global.ts

View workflow job for this annotation

GitHub Actions / lint-other

Type '"inheritConfig"' is not assignable to type '"platform" | "privateKey" | "privateKeyOld" | "gitPrivateKey" | "endpoint" | "localDir" | "cacheDir" | "allowedCommands" | "allowCustomCrateRegistries" | "allowPlugins" | ... 54 more ... | "deleteAdditionalConfigFile"'.
'inheritConfigFileName',
'inheritConfigRepoName',
'inheritConfigStrict',
'logContext',
'mergeConfidenceDatasources',
'mergeConfidenceEndpoint',
'migratePresets',
'onboarding',
'onboardingBranch',
'onboardingCommitMessage',
'onboardingConfig',
'onboardingConfigFileName',
'onboardingNoDeps',
'onboardingPrTitle',
'onboardingRebaseCheckbox',
'optimizeForDisabled',
'password',
'persistRepoData',
'platform',
'prCommitsPerRunLimit',
'presetCachePersistence',
'privateKey',
'privateKeyOld',
'privateKeyPath',
'privateKeyPathOld',
'processEnv',
'productLinks',
'redisPrefix',
'redisUrl',
'reportPath',
'reportType',
'repositories',
'repositoryCache',
'repositoryCacheType',
'requireConfig',
's3Endpoint',
's3PathStyle',
'secrets',
'token',
'unicodeEmoji',
'useCloudMetadataServices',
'userAgent',
'username',
'variables',
'writeDiscoveredRepos',
];

private static config: RepoGlobalConfig = {};

Expand Down
Loading