Skip to content

Commit

Permalink
feat: ignoreScripts (#4963)
Browse files Browse the repository at this point in the history
Adds new `ignoreScripts` config option. If set to true, managers such as npm and composer will skip running install scripts even if trustLevel is configured to high.

Closes #4567
  • Loading branch information
rarkins committed Dec 11, 2019
1 parent 4870583 commit 66ab414
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 2 deletions.
4 changes: 4 additions & 0 deletions docs/usage/configuration-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,10 @@ Use this if you are extending a complex preset but won't want to use every "sub

It would take the entire `"config:base"` preset - which contains a lot of sub-presets - but ignore the `":prHourlyLimit2"` rule.

## ignoreScripts

Applicable for npm and composer only for now. Set this to `true` if running scripts causes problems.

## ignoreUnstable

By default, Renovate won't update any package versions to unstable versions (e.g. `4.0.0-rc3`) unless the current version has the same major.minor.patch and was _already_ unstable (e.g. it was already on `4.0.0-rc2`). Renovate will not "jump" unstable versions automatically, e.g. if you are on `4.0.0-rc2` and newer versions `4.0.0` and `4.1.0-alpha.1` exist then Renovate will update you to `4.0.0` only. If you need to force permanent unstable updates for a package, you can add a package rule setting `ignoreUnstable` to `false`.
Expand Down
8 changes: 8 additions & 0 deletions lib/config/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,14 @@ const options: RenovateOptions[] = [
type: 'string',
default: 'low',
},
{
name: 'ignoreScripts',
description:
'Configure this to true if trustLevel is high but you wish to skip running scripts when updating lock files',
stage: 'package',
type: 'boolean',
default: false,
},
{
name: 'platform',
description: 'Platform type of repository',
Expand Down
1 change: 1 addition & 0 deletions lib/manager/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export interface UpdateArtifactsConfig extends ManagerConfig {
compatibility?: Record<string, string>;
cacheDir?: string;
postUpdateOptions?: string[];
ignoreScripts?: boolean;
}

export interface PackageUpdateConfig {
Expand Down
2 changes: 1 addition & 1 deletion lib/manager/composer/artifacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export async function updateArtifacts(
('update ' + updatedDeps.join(' ')).trim() + ' --with-dependencies';
}
args += ' --ignore-platform-reqs --no-ansi --no-interaction';
if (global.trustLevel !== 'high') {
if (global.trustLevel !== 'high' || config.ignoreScripts) {
args += ' --no-scripts --no-autoloader';
}
logger.debug({ cmd, args }, 'composer command');
Expand Down
2 changes: 1 addition & 1 deletion lib/manager/npm/post-update/pnpm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export async function generateLockFile(
logger.debug(`Using pnpm: ${cmd}`);
cmd += ' install';
cmd += ' --lockfile-only';
if (global.trustLevel !== 'high') {
if (global.trustLevel !== 'high' || config.ignoreScripts) {
cmd += ' --ignore-scripts';
cmd += ' --ignore-pnpmfile';
}
Expand Down
5 changes: 5 additions & 0 deletions renovate-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,11 @@
"type": "string",
"default": "low"
},
"ignoreScripts": {
"description": "Configure this to true if trustLevel is high but you wish to skip running scripts when updating lock files",
"type": "boolean",
"default": false
},
"platform": {
"description": "Platform type of repository",
"type": "string",
Expand Down

0 comments on commit 66ab414

Please sign in to comment.