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: with:
configurationFile: ${{ matrix.configurationFile }} configurationFile: ${{ matrix.configurationFile }}
renovate-version: ${{ env.RENOVATE_VERSION }} renovate-version: ${{ env.RENOVATE_VERSION }}
docker-cmd-file: example/entrypoint.sh docker-entrypoint-file: example/entrypoint.sh
docker-user: root docker-user: root
release: release:

View file

@ -11,7 +11,7 @@ GitHub Action to run Renovate self-hosted.
- [Badges](#badges) - [Badges](#badges)
- [Options](#options) - [Options](#options)
- [`configurationFile`](#configurationfile) - [`configurationFile`](#configurationfile)
- [`docker-cmd-file`](#docker-cmd-file) - [`docker-entrypoint-file`](#docker-entrypoint-file)
- [`docker-network`](#docker-network) - [`docker-network`](#docker-network)
- [`docker-socket-host-path`](#docker-socket-host-path) - [`docker-socket-host-path`](#docker-socket-host-path)
- [`docker-user`](#docker-user) - [`docker-user`](#docker-user)
@ -67,11 +67,10 @@ This disables the requirement of a configuration file for the repository and dis
requireConfig: false, requireConfig: false,
``` ```
### `docker-cmd-file` ### `docker-entrypoint-file`
Specify a command to run when the image start. Specify an entrypoint file to run when the image starts.
By default the image run 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`
`renovate`.
This option is useful to customize the image before running `renovate`. This option is useful to customize the image before running `renovate`.
It must be an existing executable file on the local system. It must be an existing executable file on the local system.
It will be mounted to the docker container. It will be mounted to the docker container.
@ -102,7 +101,7 @@ jobs:
- name: Self-hosted Renovate - name: Self-hosted Renovate
uses: renovatebot/github-action@v40.2.10 uses: renovatebot/github-action@v40.2.10
with: with:
docker-cmd-file: .github/renovate-entrypoint.sh docker-entrypoint-file: .github/renovate-entrypoint.sh
docker-user: root docker-user: root
token: ${{ secrets.RENOVATE_TOKEN }} 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. 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. image as root, do some customization and switch back to a unprivileged user.
### `docker-volumes` ### `docker-volumes`

View file

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

View file

@ -77,9 +77,11 @@ class Input {
return core.getInput('docker-socket-host-path') || '/var/run/docker.sock'; return core.getInput('docker-socket-host-path') || '/var/run/docker.sock';
} }
getDockerCmdFile(): string | null { getDockerEntrypointFile(): string | null {
const cmdFile = core.getInput('docker-cmd-file'); const entryPointFile = core.getInput('docker-entrypoint-file');
return !!cmdFile && cmdFile !== '' ? path.resolve(cmdFile) : null; return !!entryPointFile && entryPointFile !== ''
? path.resolve(entryPointFile)
: null;
} }
getDockerUser(): string | 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; let dockerCmd: string | null = null;
if (dockerCmdFile !== null) { if (dockerEntryPointFile !== null) {
const baseName = path.basename(dockerCmdFile); const baseName = path.basename(dockerEntryPointFile);
const mountPath = `/${baseName}`; const mountPath = `/${baseName}`;
dockerArguments.push(`--volume ${dockerCmdFile}:${mountPath}`); dockerArguments.push(`--volume ${dockerEntryPointFile}:${mountPath}`);
dockerCmd = mountPath; dockerCmd = mountPath;
} }