43 Commits

Author SHA1 Message Date
renovate[bot] 1909c2ef22 build(deps): update dependency execa to v10 (main) (#45834)
* build(deps): update dependency execa to v10

| datasource | package | from  | to     |
| ---------- | ------- | ----- | ------ |
| npm        | execa   | 8.0.1 | 10.0.1 |

* fix(exec): adapt to execa v10 types and subprocess API

* fix(tools): type execa v10 results in hook exec and mkdocs

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: secustor <sebastian@poxhofer.at>
2026-09-25 09:00:52 +00:00
Michael Kriese c97111e37e fix(util/exec): disable execa rejection (#45651) 2026-09-03 08:20:45 +00:00
Dharma Teja Thoutam a3a00ce574 fix(exec): supress unhandled promise rehection from execa timeout (#45335)
* fix(exec): supress unhandled promise rehection from execa timeout

* fix: Use isFunction from @sindresorhus/is, fix v8 ignore comment

* fix: log suppressed rejection, add catch to mock per review

* fix: add type annotation for catch mock parameter
2026-08-28 16:30:18 +00:00
Gabriel-Ladzaretti 5ff2229e27 feat(exec): support custom stream output writers (#44910) 2026-07-29 07:10:32 +00:00
Sebastian Poxhofer 58771bb183 refactor(linters): enabled oxlints func-style (#44691)
* refactor(oxlint): enable func-style

Enable the built-in func-style rule as ["warn", "declaration"] so that
named functions are written as function declarations instead of arrow or
function expressions assigned to variables, matching the convention in
docs/development/best-practices.md (Functions section). Inline arrow
callbacks are unaffected; prefer-arrow-callback continues to cover the
callback direction.

Severity is "warn" instead of "error" as a fallback: a repo-wide run
found 196 pre-existing violations (70 in spec files, 126 in production
code), exceeding the 80-violation fix threshold for this change, so no
violations were fixed here. Follow-up work can convert the offenders
(largest clusters: lib/modules/versioning/ruby, lib/util/cache/package,
lib/modules/versioning/maven, lib/modules/versioning/gradle) and then
raise the rule to "error". Note oxlint 1.72 also supports an
allowTypeAnnotation option if typed consts should remain arrows.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* ci(linter): enforce func-style at error

* refactor(func-style): convert const-arrow functions to declarations in with-cache spec and ruby versioning

* refactor(func-style): convert const-arrow functions to declarations in maven/gradle modules

* refactor(func-style): convert const-arrow functions to declarations in remaining versioning modules

* refactor(func-style): convert const-arrow functions to declarations in platform modules

Discriminated-union closures (ensureCommentRemoval byTopic/byContent
helpers in github, gitlab, bitbucket, bitbucket-server) needed the
narrowed field passed explicitly as a parameter, since function
declarations are hoisted and lose the outer if-narrowing that inline
arrow-function closures previously relied on.

* refactor(func-style): convert const-arrow functions to declarations across util/manager/datasource modules

One case (logger/renovate-logger.ts logOnceFn) is kept as an arrow
function with a documented oxlint-disable: it is stored on
this.logger.once[level] and relies on lexically-bound this, which a
hoisted function declaration would not preserve.

* refactor(func-style): convert remaining const-arrow test helpers to declarations

get-updated.spec.ts: hoisted expectPipCompilePackageAndLockFile to
module scope (it only closes over the module-level pipCompile mock)
and added a documented oxlint-disable for vitest/expect-expect on its
caller test, since oxlint's expect-expect check does not trace
assertions through an externally-defined helper function.

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-19 11:14:22 +00:00
Sebastian Poxhofer 9717259ffc refactor(oxlint): enable no-else-return and unicorn/no-lonely-if (#44553)
Enable no-else-return (with allowElseIf: false) and unicorn/no-lonely-if
as errors in .oxlintrc.json and fix all 131 pre-existing violations
(91 no-else-return, 40 unicorn/no-lonely-if) across 98 files.

The no-else-return violations were fixed with the oxlint autofix
(iterated to a fixpoint, plus two else-if chains that required
--fix-dangerously) followed by Prettier formatting. One comment dropped
by the autofix in lib/modules/manager/pub/artifacts.ts was restored
manually. The unicorn/no-lonely-if violations were merged by hand,
preserving comments and coverage-ignore hints.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-14 12:11:21 +00:00
Michael Kriese a825cac81b fix(exec): don't extend env (#41024) 2026-02-09 09:48:01 +00:00
Sergei Zharinov 9d857c1f68 refactor(lint): Organize imports with biome (#40966) 2026-02-06 13:40:01 +00:00
Sergei Zharinov 930cf6633c refactor: Rewrite imports with .ts extensions (#40700)
fix: Additional vi.mock path corrections and prettier formatting
2026-01-26 22:48:17 +00:00
Michael Kriese 9fe353adb4 test: add coverage (part1) (#40636) 2026-01-23 15:09:01 +00:00
Jamie Tanna f903dcd4f0 chore(util/exec): allow specifying shell on CommandWithOptions (#40323)
As part of future changes, we need to be able to specify on a
per-command level whether a `shell` should be used.

Before we do this, we should make it possible to provide the `shell`
specifier.
2026-01-08 14:17:46 +00:00
Jamie Tanna 9f3db00d1a fix(util/exec): allow ignoring failures per-command (#40290)
As part of future changes which will fix issues with Composer + Yarn 1
introduced by f430552de4, we need to find
a way to ignore command failure, on a per-command basis.

To do this, we can provide a refactor to introduce a new type,
`CommandWithOptions` which has the ability to specify whether to
`ignoreFailure`.

To make this less of a refactor than would otherwise require, we can
pass around a `(string | CommandWithOptions)[]`
(or a `string[]` or a `CommandWithOptions[]`) to be used, and use
helpers `asRawCommand` and `asRawCommands` to extract the underlying
command where necessary.

In the case a command's failure is being ignored, return the error code
in the `ExecResult`.

We also need to make sure that when executing in Docker, we still
provide the `|| true`s, otherwise we'll start to see commands failing
unexpectedly.

As part of future-proofing the `CommandWithOptions`, we can make sure
that it uses `string[]`s for the command it's representing, to avoid
re-parsing it.
2026-01-08 09:36:06 +00:00
Jamie Tanna f430552de4 fix(util/exec): don't use shell by default
As it can lead to unexpected side effects, and opportunities for command
execution / variable interpolation when untrusted input is provided.
2025-12-31 10:37:18 +00:00
Jamie Tanna b19c3ee660 refactor(util/exec): use spawnargs to return error messages
As part of a future change, we will optionally be passing around
command arguments.

To make this a simpler change, we can prefactor this to make sure we're
using the space-separated `spawnargs` for error messages.
2025-12-31 10:37:17 +00:00
Jamie Tanna a0a84a4541 refactor(util/exec): specify the args array for execa
As part of a future change, we will optionally be passing around
command arguments.

To make this a simpler change, we can prefactor this to pass around the
(empty) args array first.
2025-12-31 10:37:17 +00:00
Jamie Tanna e773b32431 fix(util/exec): migrate to execa for command execution (#40212)
* fix(util/exec): migrate to `execa` for command execution

As part of a future change, we need to make sure that we have
cross-platform support for specific command executions.

By using `execa`'s functionality on top of `node:child_process`, we can
provide this functionality, as well as retain a consistent API with
internal users.

We need to make a couple of small tweaks to setting the `RawExecOptions`
as we're now bound by `readonly` properties.

As the `stdio` property's type is not exported, we can replace this with
an explicit setting of `stdin`, `stdout` and `stderr`.

This requires a number of test changes to make sure that the `stdin`,
`stdout` and `stderr` are set.

This doesn't migrate any calls under `tools`, as they can remain using
`node:child_process`.

* chore(util/exec): ignore floating promises `.on` calls

Since moving to use `execa`, we now have "floating promises" for the
`.on` method calls.

As we aren't handling them here, we can now mark them as `void` (as an
alternative to ignoring the ESLint rule).
2025-12-30 14:28:18 +00:00
Jamie Tanna 5c1cec370e fix(instrumentation): instrument command execution (#39654)
As part of ongoing work to improve OpenTelemetry instrumentation of
Renovate in #38609, we can introduce an instrumented call for each
external command execution.

This makes sure we cover the key functions used for command
execution -  `rawExec` - across the codebase, which is used
under-the-hood by `exec`.

Because commands could include sensitive arguments (such as repo or
global secrets) we need to make sure we sanitize the span name.

Note that we don't add instrumentation to `tools/utils/exec.ts` as it's
only used for i.e. building the docs site, and isn't used as part of the
core Renovate CLI.
2025-12-23 17:20:17 +00:00
RahulGautamSingh 76f911041a refactor: use named exports (#39196)
* use named exports

* fix test

* add missing imnport

* fix prettier
2025-11-10 12:00:35 +00:00
RahulGautamSingh 49fa1be464 feat(util): getEnv (#35161)
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2025-05-06 18:37:28 +00:00
Gabriel-Ladzaretti 50197c9738 feat(rawExec): add custom data listeners support (#34066)
Co-authored-by: Rhys Arkins <rhys@arkins.net>
2025-02-07 20:09:53 +00:00
Sebastian Poxhofer 3681b2a945 chore: eslint to enforce for typed imports (#30844) 2024-08-19 13:15:27 +00:00
renovate[bot] eb8c08079e chore(deps): update typescript-eslint monorepo to v8 (major) (#30750)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2024-08-14 10:33:02 +00:00
Sergei Zharinov b69416ce17 refactor(prettier): Force trailing commas (#25631) 2023-11-07 15:50:29 +00:00
Jamie Magee 176282e65f chore: use node: protocol imports (#21181) 2023-03-28 21:05:36 +00:00
Gabriel-Ladzaretti 21ab4bad63 feat(util/exec): enable process group handling on process termination (#17447) 2022-08-28 21:32:23 +03:00
Gabriel-Ladzaretti cb53e18de8 chore(util/exec): remove unneeded renaming related TODOs (#17399) 2022-08-25 06:43:13 +00:00
Gabriel-Ladzaretti 257d9a9d8e fix(core/exec): use nodejs style error messages when throwing (#16961) 2022-08-04 14:29:11 +00:00
Gabriel-Ladzaretti 892595aea8 feat(util/exec): use spawn instead of exec (#16414)
* refactor(util): use spawn instead of exec

 - Use child_process.spawn instead of child_process.exec

* refactor(util): use spawn instead of exec

 - Use child_process.spawn instead of child_process.exec

* refactor(util): use spawn instead of exec

 - Use child_process.spawn instead of child_process.exec

* refactor(util): use spawn instead of exec

 - Use child_process.spawn instead of child_process.exec

* refactor(util): use spawn instead of exec

 - init spawn-util

* refactor(util): use spawn instead of exec

 - spawn-util

* refactor(util): use spawn instead of exec

 - init index-spawn.spec.ts

* refactor(util): use spawn instead of exec

 - fixed various tests

* refactor(util): use spawn instead of exec

 - fix all artifacts.spec.ts

* refactor(util): use spawn instead of exec

 - fix all artifacts.spec.ts

* refactor(util): use spawn instead of exec

 - fix npm post update imports

* refactor(util): use spawn instead of exec

 - revert renaming to minimize PR diff

* refactor(util): use spawn instead of exec

 - revert renaming to minimize PR diff

* refactor(util): use spawn instead of exec

 - revert renaming to minimize PR diff

* refactor(util): use spawn instead of exec

 - revert renaming to minimize PR diff

* refactor(util): use spawn instead of exec

 - revert renaming to minimize PR diff
 - destroy stdio when terminating child process

* refactor(util): use spawn instead of exec

 - delete and revert dev related changes

* refactor(util): use spawn instead of exec
 - fix support for windows

* refactor(util): use spawn instead of exec

 - handle SIGSTOP and such
 - add test coverage

* refactor(util): use spawn instead of exec

 - now converts to strings when resolving/rejecting

* refactor(util): use spawn instead of exec

 - logs improvements
 - force shell (exec like)
 - fix tests

* refactor(util): use spawn instead of exec

 - strongly type listeners

* refactor(util): use spawn instead of exec

 - create helper mock for spawn

* refactor(util): use spawn instead of exec

 - cr changes

* Update lib/util/exec/common.ts

Co-authored-by: Sergei Zharinov <zharinov@users.noreply.github.com>

* refactor(util): use spawn instead of exec

 - documentation

* refactor(util): use spawn instead of exec

 - revert unnecessary formatting

* refactor(util): use spawn instead of exec

* refactor(util): use spawn instead of exec

 - added ExecError class

* refactor(util): use spawn instead of exec

 - exec-error.ts restructure

* refactor(util): use spawn instead of exec

* Apply suggestions from code review

Co-authored-by: Sergei Zharinov <zharinov@users.noreply.github.com>

* refactor(util): use spawn instead of exec

* refactor(util): use spawn instead of exec

* refactor(util): use spawn instead of exec

 - deprecated RawExecOptions.encoding property

* refactor(util): use spawn instead of exec

* refactor(util): use spawn instead of exec

* refactor(util): use spawn instead of exec

Co-authored-by: Sergei Zharinov <zharinov@users.noreply.github.com>
2022-07-22 15:43:28 +00:00
Rhys Arkins 328de3fc27 refactor: exec types (#12942) 2021-12-04 07:12:27 +01:00
Rhys Arkins 508cec1015 refactor: move preCommands out of docker options (#12938) 2021-12-03 12:07:32 +01:00
Rhys Arkins b95f608fa1 refactor: remove unused postCommands (#12939) 2021-12-03 11:00:49 +01:00
Sergei Zharinov 1b6ecd87c0 refactor: move binarySource option to admin config (#10022) 2021-06-02 06:50:23 +00:00
Sergei Zharinov fbbbce608e chore: Configure fs local dirs via admin config (#9990)
Co-authored-by: Rhys Arkins <rhys@arkins.net>
2021-05-17 13:21:28 +00:00
Rhys Arkins 80fd1fe0d6 refactor: move customEnvVariables to admin config 2021-02-07 22:07:16 +01:00
Rhys Arkins 4e2c33f10e feat: admin config init (#8546) 2021-02-05 09:20:47 +01:00
Rhys Arkins df2a31c7f5 fix: remove unused binarySource=auto (#8461) 2021-02-04 12:14:34 +01:00
Halil İbrahim Şener 207b177d60 feat: customEnvVariables (#8321)
Introduces a new option to pass custom environment variables to child processes. So that users can provide/override environment variables to influence executions, e.g. setting MAVEN_OPTS or passing credentials for private registries for the locking process.
2021-01-19 09:11:45 +01:00
Michael Kriese 0503ad7c7a feat: add docker image prefix (#7164)
Co-authored-by: Jamie Magee <JamieMagee@users.noreply.github.com>
2020-09-08 12:59:47 +02:00
Rhys Arkins 53ca91301f chore: import linting (#6105) 2020-05-01 18:03:48 +02:00
Sergio Zharinov 969701ad6b feat(util): Fetch docker tag according to version constraints (#5497) 2020-02-19 19:02:11 +01:00
Sergio Zharinov 8b6d280741 feat(exec): Allow for extra docker commands (#5208) 2020-01-22 11:45:21 +01:00
Sergio Zharinov 60d895bd5c feat(exec): Cache Docker image prefetch info (#5205) 2020-01-22 09:19:29 +01:00
Sergio Zharinov ef7357d022 fix(exec): Refactor binarySource out to global setting (#5190)
Co-authored-by: Rhys Arkins <rhys@arkins.net>
2020-01-20 16:50:32 +01:00