From 5f1f104d65aae7464cc77832024dffb78d497cfe Mon Sep 17 00:00:00 2001 From: Rhys Arkins <rhys@arkins.net> Date: Wed, 20 Apr 2022 21:33:36 +0100 Subject: [PATCH] fix(git): remove default gitTimeout (#15200) --- docs/usage/self-hosted-configuration.md | 2 -- lib/config/options/index.ts | 2 +- lib/config/validation.spec.ts | 13 ------------- lib/config/validation.ts | 13 ------------- lib/util/git/config.spec.ts | 3 --- lib/util/git/config.ts | 11 +++++++---- 6 files changed, 8 insertions(+), 36 deletions(-) diff --git a/docs/usage/self-hosted-configuration.md b/docs/usage/self-hosted-configuration.md index dc6955ccef..7168509723 100644 --- a/docs/usage/self-hosted-configuration.md +++ b/docs/usage/self-hosted-configuration.md @@ -367,8 +367,6 @@ This reduces the chance of unintended consequences with global Git configs on sh To handle the case where the underlying Git processes appear to hang, configure the timeout with the number of milliseconds to wait after last received content on either `stdOut` or `stdErr` streams before sending a `SIGINT` kill message. -The value must be between `2000` and `60000` (milliseconds) inclusive. - ## gitUrl Override the default resolution for Git remote, e.g. to switch GitLab from HTTPS to SSH-based. diff --git a/lib/config/options/index.ts b/lib/config/options/index.ts index 4bb544b4d9..757ad222ec 100644 --- a/lib/config/options/index.ts +++ b/lib/config/options/index.ts @@ -736,7 +736,7 @@ const options: RenovateOptions[] = [ 'Configure the timeout with a number of milliseconds to wait for a Git task.', type: 'integer', globalOnly: true, - default: 10000, + default: 0, }, { name: 'enabledManagers', diff --git a/lib/config/validation.spec.ts b/lib/config/validation.spec.ts index 6e58e06a6f..31f564af38 100644 --- a/lib/config/validation.spec.ts +++ b/lib/config/validation.spec.ts @@ -739,18 +739,5 @@ describe('config/validation', () => { }, ]); }); - - it.each([ - [ - 'invalid value', - { - gitTimeout: 'string', - }, - ], - ['out of range', { gitTimeout: 1000 }], - ])('checks invalid git timeout values', async (_case, config) => { - const { errors } = await configValidation.validateConfig(config); - expect(errors).toHaveLength(1); - }); }); }); diff --git a/lib/config/validation.ts b/lib/config/validation.ts index 1561621ca7..383790945c 100644 --- a/lib/config/validation.ts +++ b/lib/config/validation.ts @@ -128,19 +128,6 @@ export async function validateConfig( }); continue; } - if (key === 'gitTimeout') { - if (!is.number(val)) { - errors.push({ - topic: 'Config Error', - message: `GitTimeout must be set to an integer value`, - }); - } else if (!(val >= 2000 && val <= 60000)) { - errors.push({ - topic: 'Config Error', - message: `GitTimeout value must be within 2 to 60 seconds`, - }); - } - } if (parentPath && topLevelObjects.includes(key)) { errors.push({ topic: 'Configuration Error', diff --git a/lib/util/git/config.spec.ts b/lib/util/git/config.spec.ts index 931df55437..89327a7fa3 100644 --- a/lib/util/git/config.spec.ts +++ b/lib/util/git/config.spec.ts @@ -9,9 +9,6 @@ describe('util/git/config', () => { it('uses "close" events, ignores "exit" events from child processes', () => { expect(simpleGitConfig()).toEqual({ completion: { onClose: true, onExit: false }, - timeout: { - block: 10000, - }, }); }); diff --git a/lib/util/git/config.ts b/lib/util/git/config.ts index de508be1fc..507d10bfb0 100644 --- a/lib/util/git/config.ts +++ b/lib/util/git/config.ts @@ -18,13 +18,16 @@ export function getNoVerify(): GitNoVerifyOption[] { } export function simpleGitConfig(): Partial<SimpleGitOptions> { - return { + const config: Partial<SimpleGitOptions> = { completion: { onClose: true, onExit: false, }, - timeout: { - block: GlobalConfig.get('gitTimeout') ?? 10000, - }, }; + // https://github.com/steveukx/git-js/pull/591 + const gitTimeout = GlobalConfig.get('gitTimeout'); + if (is.number(gitTimeout) && gitTimeout > 0) { + config.timeout = { block: gitTimeout }; + } + return config; } -- GitLab