diff --git a/docs/usage/self-hosted-configuration.md b/docs/usage/self-hosted-configuration.md index dc6955ccef896de064187c33ff010b4e51281053..7168509723fbe981822f1a4cfeb0a3bf7fb8e46f 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 4bb544b4d94cfa24e98524c00f6eea952d39a175..757ad222ec1d46044c710ca70aa9aa7b15407f51 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 6e58e06a6f89c0325cc308a0d7232198f73f2640..31f564af38eae9f855abd346293ca84e7d20406e 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 1561621ca7896a670147ffcccc51457f8e2c13c5..383790945cb8ac05ffa68454b8e9a75ec69b0444 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 931df554374e8344ca666c54a72b275e897b3d7a..89327a7fa34facdf782a579bb8c06596d35ce84b 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 de508be1fcc481a8aa8548d4d76e91110808d1eb..507d10bfb088a399abbcb2c63accead33527d5f2 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; }