refactor!: rename docker-cmd-file to docker-entrypoint-file

BREAKING CHANGE: input parameter `docker-cmd-file` is now `docker-entrypoint-file`
This commit is contained in:
Jan Gazda 2024-10-03 22:56:36 +02:00
parent b67a7b41a9
commit 2b7c66105e
No known key found for this signature in database
GPG key ID: 9637E36DAE206061
5 changed files with 18 additions and 17 deletions

View file

@ -117,7 +117,7 @@ jobs:
with:
configurationFile: ${{ matrix.configurationFile }}
renovate-version: ${{ env.RENOVATE_VERSION }}
docker-cmd-file: example/entrypoint.sh
docker-entrypoint-file: example/entrypoint.sh
docker-user: root
release:

View file

@ -11,7 +11,7 @@ GitHub Action to run Renovate self-hosted.
- [Badges](#badges)
- [Options](#options)
- [`configurationFile`](#configurationfile)
- [`docker-cmd-file`](#docker-cmd-file)
- [`docker-entrypoint-file`](#docker-entrypoint-file)
- [`docker-network`](#docker-network)
- [`docker-socket-host-path`](#docker-socket-host-path)
- [`docker-user`](#docker-user)
@ -67,11 +67,10 @@ This disables the requirement of a configuration file for the repository and dis
requireConfig: false,
```
### `docker-cmd-file`
### `docker-entrypoint-file`
Specify a command to run when the image start.
By default the image run
`renovate`.
Specify an entrypoint file to run when the image starts.
The default is [renovate-entrypoint.sh](https://github.com/renovatebot/renovate/blob/main/tools/docker/bin/renovate-entrypoint.sh) located in `/usr/local/sbin/renovate-entrypoint.sh`
This option is useful to customize the image before running `renovate`.
It must be an existing executable file on the local system.
It will be mounted to the docker container.
@ -102,7 +101,7 @@ jobs:
- name: Self-hosted Renovate
uses: renovatebot/github-action@v40.2.10
with:
docker-cmd-file: .github/renovate-entrypoint.sh
docker-entrypoint-file: .github/renovate-entrypoint.sh
docker-user: root
token: ${{ secrets.RENOVATE_TOKEN }}
```
@ -124,7 +123,7 @@ Only applicable when `mount-docker-socket` is true.
Specify a user (or user-id) to run docker command.
You can use it with [`docker-cmd-file`](#docker-cmd-file) in order to start the
You can use it with [`docker-entrypoint-file`](#docker-entrypoint-file) in order to start the
image as root, do some customization and switch back to a unprivileged user.
### `docker-volumes`

View file

@ -43,9 +43,9 @@ inputs:
Only applicable when 'mount-docker-socket' is true.
required: false
default: /var/run/docker.sock
docker-cmd-file:
docker-entrypoint-file:
description: |
Override docker command. Default command is `renovate`
Override docker docker entrypoint. Use with `docker-user: root`. See the example for usage.
required: false
docker-network:
description: |

View file

@ -77,9 +77,11 @@ class Input {
return core.getInput('docker-socket-host-path') || '/var/run/docker.sock';
}
getDockerCmdFile(): string | null {
const cmdFile = core.getInput('docker-cmd-file');
return !!cmdFile && cmdFile !== '' ? path.resolve(cmdFile) : null;
getDockerEntrypointFile(): string | null {
const entryPointFile = core.getInput('docker-entrypoint-file');
return !!entryPointFile && entryPointFile !== ''
? path.resolve(entryPointFile)
: null;
}
getDockerUser(): string | null {

View file

@ -47,12 +47,12 @@ class Renovate {
);
}
const dockerCmdFile = this.input.getDockerCmdFile();
const dockerEntryPointFile = this.input.getDockerEntrypointFile();
let dockerCmd: string | null = null;
if (dockerCmdFile !== null) {
const baseName = path.basename(dockerCmdFile);
if (dockerEntryPointFile !== null) {
const baseName = path.basename(dockerEntryPointFile);
const mountPath = `/${baseName}`;
dockerArguments.push(`--volume ${dockerCmdFile}:${mountPath}`);
dockerArguments.push(`--volume ${dockerEntryPointFile}:${mountPath}`);
dockerCmd = mountPath;
}