feat(config)!: change onboardingNoDeps from boolean to enum (#28133)

Change onboardingNoDeps from boolean to enum, with new default "auto". Auto means that Renovate will continue skipping repos with no dependencies if autodiscover is in use, but onboarding them if they are explicitly specified in a non-autodiscover mode.

Closes #28101

BREAKING CHANGE: onboardingNoDeps changes from boolean to enum. Repositories with no dependencies will be onboarded unless in autodiscover mode.
This commit is contained in:
RahulGautamSingh 2024-04-14 20:01:15 +05:45 committed by Rhys Arkins
parent b05f389c63
commit 0c500f52f2
8 changed files with 32 additions and 8 deletions

View file

@ -273,7 +273,7 @@ To get a onboarding PR from Renovate, change to Interactive mode either at the R
#### Installing Renovate into selected repositories always leads to onboarding PRs #### Installing Renovate into selected repositories always leads to onboarding PRs
Additionally, if an Organization is installed with "Selected repositories" then the app will change `onboardingNoDeps` to `true` so that an Onboarding PR is created even if no dependencies are detected. Additionally, if an Organization is installed with "Selected repositories" then the app will change `onboardingNoDeps` to `"enabled"` so that an Onboarding PR is created even if no dependencies are detected.
### Fork Processing ### Fork Processing

View file

@ -850,8 +850,12 @@ Falls back to `renovate.json` if the name provided is not valid.
## onboardingNoDeps ## onboardingNoDeps
Set this to `true` if you want Renovate to create an onboarding PR even if no dependencies are found. The default `auto` setting is converted to `disabled` if `autodiscoverRepositories` is `true`, or converted to `enabled` if false.
Otherwise, Renovate skips onboarding a repository if it finds no dependencies in it.
In other words, the default behavior is:
- If you run Renovate on discovered repositories then it will skip onboarding those without dependencies detected, but
- If you run Renovate on _specific_ repositories then Renovate will onboard all such repositories even if no dependencies are found
## onboardingPrTitle ## onboardingPrTitle

View file

@ -207,8 +207,9 @@ const options: RenovateOptions[] = [
{ {
name: 'onboardingNoDeps', name: 'onboardingNoDeps',
description: 'Onboard the repository even if no dependencies are found.', description: 'Onboard the repository even if no dependencies are found.',
type: 'boolean', type: 'string',
default: false, default: 'auto',
allowedValues: ['auto', 'enabled', 'disabled'],
globalOnly: true, globalOnly: true,
inheritConfigSupport: true, inheritConfigSupport: true,
}, },

View file

@ -178,7 +178,7 @@ export interface LegacyAdminConfig {
onboarding?: boolean; onboarding?: boolean;
onboardingBranch?: string; onboardingBranch?: string;
onboardingCommitMessage?: string; onboardingCommitMessage?: string;
onboardingNoDeps?: boolean; onboardingNoDeps?: 'auto' | 'enabled' | 'disabled';
onboardingRebaseCheckbox?: boolean; onboardingRebaseCheckbox?: boolean;
onboardingPrTitle?: string; onboardingPrTitle?: string;
onboardingConfig?: RenovateSharedConfig; onboardingConfig?: RenovateSharedConfig;

View file

@ -173,5 +173,18 @@ describe('workers/global/config/parse/index', () => {
const parsed = await configParser.parseConfigs(defaultEnv, defaultArgv); const parsed = await configParser.parseConfigs(defaultEnv, defaultArgv);
expect(parsed).toContainEntries([['dryRun', null]]); expect(parsed).toContainEntries([['dryRun', null]]);
}); });
it('massage onboardingNoDeps when autodiscover is false', async () => {
jest.mock(
'../../config.js',
() => ({ onboardingNoDeps: 'auto', autodiscover: false }),
{
virtual: true,
},
);
const env: NodeJS.ProcessEnv = {};
const parsedConfig = await configParser.parseConfigs(env, defaultArgv);
expect(parsedConfig).toContainEntries([['onboardingNoDeps', 'enabled']]);
});
}); });
}); });

View file

@ -113,6 +113,12 @@ export async function parseConfigs(
config.forkProcessing = 'enabled'; config.forkProcessing = 'enabled';
} }
// Massage onboardingNoDeps
if (!config.autodiscover && config.onboardingNoDeps !== 'disabled') {
logger.debug('Enabling onboardingNoDeps while in non-autodiscover mode');
config.onboardingNoDeps = 'enabled';
}
// Remove log file entries // Remove log file entries
delete config.logFile; delete config.logFile;
delete config.logFileLevel; delete config.logFileLevel;

View file

@ -59,7 +59,7 @@ describe('workers/repository/onboarding/branch/index', () => {
}); });
it("doesn't throw if there are no package files and onboardingNoDeps config option is set", async () => { it("doesn't throw if there are no package files and onboardingNoDeps config option is set", async () => {
config.onboardingNoDeps = true; config.onboardingNoDeps = 'enabled';
await expect(checkOnboardingBranch(config)).resolves.not.toThrow( await expect(checkOnboardingBranch(config)).resolves.not.toThrow(
REPOSITORY_NO_PACKAGE_FILES, REPOSITORY_NO_PACKAGE_FILES,
); );

View file

@ -108,7 +108,7 @@ export async function checkOnboardingBranch(
Object.entries((await extractAllDependencies(mergedConfig)).packageFiles) Object.entries((await extractAllDependencies(mergedConfig)).packageFiles)
.length === 0 .length === 0
) { ) {
if (!config?.onboardingNoDeps) { if (config.onboardingNoDeps !== 'enabled') {
throw new Error(REPOSITORY_NO_PACKAGE_FILES); throw new Error(REPOSITORY_NO_PACKAGE_FILES);
} }
} }