diff --git a/README.md b/README.md index 34822dfc673..eacb595c896 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,7 @@ GitHub Action to run Renovate self-hosted. - [`docker-cmd-file`](#docker-cmd-file) - [`docker-network`](#docker-network) - [`docker-socket-host-path`](#docker-socket-host-path) + - [`docker-tty`](#docker-tty) - [`docker-user`](#docker-user) - [`docker-volumes`](#docker-volumes) - [`env-regex`](#env-regex) @@ -120,6 +121,11 @@ Allows the overriding of the host path for the Docker socket that is mounted int Useful on systems where the host Docker socket is located somewhere other than `/var/run/docker.sock` (the default). Only applicable when `mount-docker-socket` is true. +### `docker-tty` + +Defaults to `true`. When enabled, Docker commands are run with `-t` (allocate pseudo-TTY). +Set to `false` to disable TTY allocation. + ### `docker-user` Specify a user (or user-id) to run docker command. diff --git a/action.yml b/action.yml index 1131e10ec85..198580cbc2c 100644 --- a/action.yml +++ b/action.yml @@ -61,6 +61,12 @@ inputs: Docker volume mounts. Default to /tmp:/tmp default: /tmp:/tmp required: false + docker-tty: + description: | + Allocate a pseudo-TTY (`-t`) for Docker runs. + Set to `false` to disable TTY allocation. + default: 'true' + required: false runs: using: node24 diff --git a/src/input.ts b/src/input.ts index ee988b6cccf..c1ef3a4aa60 100644 --- a/src/input.ts +++ b/src/input.ts @@ -96,6 +96,10 @@ export class Input { return getInput('docker-network'); } + dockerTty(): boolean { + return getInput('docker-tty') !== 'false'; + } + /** * Convert to environment variables. * diff --git a/src/renovate.ts b/src/renovate.ts index 419ce53de83..e86a43aef0d 100644 --- a/src/renovate.ts +++ b/src/renovate.ts @@ -15,7 +15,8 @@ export class Renovate { } async runDockerContainerForVersion(): Promise { - const command = `docker run -t --rm ${this.docker.image()} --version`; + const ttyArgument = this.input.dockerTty() ? '-t ' : ''; + const command = `docker run ${ttyArgument}--rm ${this.docker.image()} --version`; const { exitCode, stdout } = await getExecOutput(command); if (exitCode !== 0) { @@ -87,7 +88,8 @@ export class Renovate { dockerArguments.push(dockerCmd); } - const command = `docker run -t ${dockerArguments.join(' ')}`; + const ttyArgument = this.input.dockerTty() ? '-t ' : ''; + const command = `docker run ${ttyArgument}${dockerArguments.join(' ')}`; const code = await exec(command); if (code !== 0) {