From 162a45471f9f8b3ad0d976037f87682665a726ab Mon Sep 17 00:00:00 2001 From: Jan Gazda <7480694+1oglop1@users.noreply.github.com> Date: Thu, 3 Oct 2024 22:48:51 +0200 Subject: [PATCH 1/4] docs: fix typo in default env-regex --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index d2e274ecc48..f7126bdc401 100644 --- a/action.yml +++ b/action.yml @@ -19,7 +19,7 @@ inputs: env-regex: description: | Override the environment variables which will be passsed into the renovate container. - Defaults to `^(?:RENOVATE_\\w+|LOG_LEVEL|GITHUB_COM_TOKEN|NODE_OPTIONS|(?:HTTPS?|NO)_PROXY|(?:https?|no)_proxy)$` + Defaults to `^(?:RENOVATE_\w+|LOG_LEVEL|GITHUB_COM_TOKEN|NODE_OPTIONS|(?:HTTPS?|NO)_PROXY|(?:https?|no)_proxy)$` required: false renovate-version: description: | From b67a7b41a9c0bc8e74af746e050c3b480972cb7a Mon Sep 17 00:00:00 2001 From: Jan Gazda <7480694+1oglop1@users.noreply.github.com> Date: Thu, 3 Oct 2024 22:50:51 +0200 Subject: [PATCH 2/4] docs: clarify renovate-version and renovate-image --- README.md | 1 + action.yml | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f4d282d2b48..3310f4f9267 100644 --- a/README.md +++ b/README.md @@ -183,6 +183,7 @@ If you want to use the `github-actions` manager, you must setup a [special token The Renovate Docker image name to use. If omitted or `renovate-image === ''` the action will use the `ghcr.io/renovatebot/renovate` Docker image name otherwise. If a Docker image name is defined, the action will use that name to pull the image. +Note: Use only the image name without a tag, [`renovate-version`](#renovate-version) is used as the image tag. This sample will use `myproxyhub.domain.com/renovate/renovate` image. diff --git a/action.yml b/action.yml index f7126bdc401..f5386aba944 100644 --- a/action.yml +++ b/action.yml @@ -23,11 +23,11 @@ inputs: required: false renovate-version: description: | - Renovate version to use. Defaults to latest. + Renovate version to use. Also used as image tag together with the parameter `renovate-image`. Defaults to latest. required: false renovate-image: description: | - Renovate docker image name. + Renovate docker image name. Use the parameter `renovate-version` to set the image tag. Defaults to `ghcr.io/renovatebot/renovate`. required: false mount-docker-socket: From 2b7c66105e70414489e7864f7be128e1e4814995 Mon Sep 17 00:00:00 2001 From: Jan Gazda <7480694+1oglop1@users.noreply.github.com> Date: Thu, 3 Oct 2024 22:56:36 +0200 Subject: [PATCH 3/4] refactor!: rename docker-cmd-file to docker-entrypoint-file BREAKING CHANGE: input parameter `docker-cmd-file` is now `docker-entrypoint-file` --- .github/workflows/build.yml | 2 +- README.md | 13 ++++++------- action.yml | 4 ++-- src/input.ts | 8 +++++--- src/renovate.ts | 8 ++++---- 5 files changed, 18 insertions(+), 17 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 400af69f3fe..aa216aa02be 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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: diff --git a/README.md b/README.md index 3310f4f9267..2e47987dc3d 100644 --- a/README.md +++ b/README.md @@ -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` diff --git a/action.yml b/action.yml index f5386aba944..169034e4c68 100644 --- a/action.yml +++ b/action.yml @@ -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: | diff --git a/src/input.ts b/src/input.ts index 3b8c8791731..fc52d5785dc 100644 --- a/src/input.ts +++ b/src/input.ts @@ -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 { diff --git a/src/renovate.ts b/src/renovate.ts index 2edb32cc5cc..8ee68b939f3 100644 --- a/src/renovate.ts +++ b/src/renovate.ts @@ -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; } From e5a2162ce41fe70a285acb062b1395929cc323a8 Mon Sep 17 00:00:00 2001 From: Jan Gazda <7480694+1oglop1@users.noreply.github.com> Date: Sun, 24 Nov 2024 23:43:25 +0100 Subject: [PATCH 4/4] refactor!: make docker-cmd-file backward compatible --- action.yml | 4 ++++ src/input.ts | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 169034e4c68..d0e939e60d8 100644 --- a/action.yml +++ b/action.yml @@ -47,6 +47,10 @@ inputs: description: | Override docker docker entrypoint. Use with `docker-user: root`. See the example for usage. required: false + docker-cmd-file: + description: | + Deprecated, keeping it around for the backward compatibility. Use `docker-entrypoint-file` instead. + required: false docker-network: description: | Docker network. diff --git a/src/input.ts b/src/input.ts index fc52d5785dc..c2ce540f08e 100644 --- a/src/input.ts +++ b/src/input.ts @@ -78,7 +78,12 @@ class Input { } getDockerEntrypointFile(): string | null { - const entryPointFile = core.getInput('docker-entrypoint-file'); + const cmdFile = core.getInput('docker-entrypoint-file'); + const entryPointFile = + !!cmdFile && cmdFile !== '' + ? cmdFile + : core.getInput('docker-entrypoint-file'); + return !!entryPointFile && entryPointFile !== '' ? path.resolve(entryPointFile) : null;