Skip to content
Snippets Groups Projects
Commit beb37bc1 authored by Rhys Arkins's avatar Rhys Arkins
Browse files

feat(lockFile): Support lockFileMaintenance disabling in env

It’s now possible to set `RENOVATE_LOCK_FILE_MAINTENANCE={}` in env to disable lock file maintenance.

Closes #515
parent 66194f55
No related branches found
No related tags found
No related merge requests found
...@@ -474,7 +474,7 @@ Obviously, you can't set repository or package file location with this method. ...@@ -474,7 +474,7 @@ Obviously, you can't set repository or package file location with this method.
"prBody": "This {{#if isGitHub}}Pull{{else}}Merge{{/if}} Request updates `package.json` lock files to use the latest dependency versions.\n\n{{#if schedule}}\n**Note**: This PR was created on a configured schedule (\"{{schedule}}\"{{#if timezone}} in timezone `{{timezone}}`{{/if}}) and will not receive updates outside those times.\n{{/if}}\n\n{{#if hasErrors}}\n\n---\n\n### Errors\n\nRenovate encountered some errors when processing your repository, so you are being notified here even if they do not directly apply to this PR.\n\n{{#each errors as |error|}}\n- `{{error.depName}}`: {{error.message}}\n{{/each}}\n{{/if}}\n\n{{#if hasWarnings}}\n\n---\n\n### Warnings\n\nPlease make sure the following warnings are safe to ignore:\n\n{{#each warnings as |warning|}}\n- `{{warning.depName}}`: {{warning.message}}\n{{/each}}\n{{/if}}\n\n---\n\nThis {{#if isGitHub}}PR{{else}}MR{{/if}} has been generated by [Renovate Bot](https://renovateapp.com).", "prBody": "This {{#if isGitHub}}Pull{{else}}Merge{{/if}} Request updates `package.json` lock files to use the latest dependency versions.\n\n{{#if schedule}}\n**Note**: This PR was created on a configured schedule (\"{{schedule}}\"{{#if timezone}} in timezone `{{timezone}}`{{/if}}) and will not receive updates outside those times.\n{{/if}}\n\n{{#if hasErrors}}\n\n---\n\n### Errors\n\nRenovate encountered some errors when processing your repository, so you are being notified here even if they do not directly apply to this PR.\n\n{{#each errors as |error|}}\n- `{{error.depName}}`: {{error.message}}\n{{/each}}\n{{/if}}\n\n{{#if hasWarnings}}\n\n---\n\n### Warnings\n\nPlease make sure the following warnings are safe to ignore:\n\n{{#each warnings as |warning|}}\n- `{{warning.depName}}`: {{warning.message}}\n{{/each}}\n{{/if}}\n\n---\n\nThis {{#if isGitHub}}PR{{else}}MR{{/if}} has been generated by [Renovate Bot](https://renovateapp.com).",
"schedule": "before 5am on monday" "schedule": "before 5am on monday"
}</pre></td> }</pre></td>
<td></td> <td>`RENOVATE_LOCK_FILE_MAINTENANCE`</td>
<td><td> <td><td>
</tr> </tr>
<tr> <tr>
......
...@@ -313,7 +313,6 @@ const options = [ ...@@ -313,7 +313,6 @@ const options = [
schedule: 'before 5am on monday', schedule: 'before 5am on monday',
}, },
cli: false, cli: false,
env: false,
mergeable: true, mergeable: true,
}, },
// Dependency Groups // Dependency Groups
......
...@@ -26,6 +26,7 @@ function getConfig(env) { ...@@ -26,6 +26,7 @@ function getConfig(env) {
list: val => val.split(',').map(el => el.trim()), list: val => val.split(',').map(el => el.trim()),
string: val => val, string: val => val,
integer: val => parseInt(val, 10), integer: val => parseInt(val, 10),
json: val => JSON.parse(val),
}; };
options.forEach(option => { options.forEach(option => {
......
...@@ -70,21 +70,22 @@ async function renovatePackageFile(packageFileConfig) { ...@@ -70,21 +70,22 @@ async function renovatePackageFile(packageFileConfig) {
if (await config.api.getFileContent(packageLockFileName)) { if (await config.api.getFileContent(packageLockFileName)) {
config.hasPackageLock = true; config.hasPackageLock = true;
} }
if (config.hasYarnLock || config.hasPackageLock) { if (
config.lockFileMaintenance.enabled &&
(config.hasYarnLock || config.hasPackageLock)
) {
logger.debug('lockFileMaintenance enabled');
// Maintain lock files // Maintain lock files
const lockFileMaintenanceConf = configParser.mergeChildConfig( const lockFileMaintenanceConf = configParser.mergeChildConfig(
config, config,
config.lockFileMaintenance config.lockFileMaintenance
); );
if (lockFileMaintenanceConf.enabled) { lockFileMaintenanceConf.type = 'lockFileMaintenance';
logger.debug('lockFileMaintenance enabled'); logger.debug(
lockFileMaintenanceConf.type = 'lockFileMaintenance'; { config: lockFileMaintenanceConf },
logger.debug( `lockFileMaintenanceConf`
{ config: lockFileMaintenanceConf }, );
`lockFileMaintenanceConf` upgrades.push(lockFileMaintenanceConf);
);
upgrades.push(lockFileMaintenanceConf);
}
} }
logger.info('Finished processing package file'); logger.info('Finished processing package file');
......
...@@ -34,6 +34,10 @@ describe('config/env', () => { ...@@ -34,6 +34,10 @@ describe('config/env', () => {
const envParam = { RENOVATE_GITHUB_APP_ID: 5 }; const envParam = { RENOVATE_GITHUB_APP_ID: 5 };
env.getConfig(envParam).should.eql({ githubAppId: 5 }); env.getConfig(envParam).should.eql({ githubAppId: 5 });
}); });
it('supports json', () => {
const envParam = { RENOVATE_LOCK_FILE_MAINTENANCE: '{}' };
expect(env.getConfig(envParam)).toEqual({ lockFileMaintenance: {} });
});
}); });
describe('.getEnvName(definition)', () => { describe('.getEnvName(definition)', () => {
it('returns empty', () => { it('returns empty', () => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment