diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c8f74353..032142ea 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -129,6 +129,14 @@ jobs: docker-cmd-file: example/entrypoint.sh docker-user: root + - name: Renovate test with image and digest + uses: ./ + env: + LOG_LEVEL: debug + with: + configurationFile: ${{ matrix.configurationFile }} + renovate-image: ghcr.io/renovatebot/renovate:44.115.4@sha256:03e987bec9fbda0cf39ef63f2d293e821d96525119e1ab3d0ff87d5b3ef3edd9 + renovate-config-validator: runs-on: ubuntu-latest timeout-minutes: 10 diff --git a/README.md b/README.md index f5cace68..da7a7b7f 100644 --- a/README.md +++ b/README.md @@ -227,6 +227,23 @@ jobs: token: ${{ secrets.RENOVATE_TOKEN }} ``` +It is also possible to specify a full Docker image pinned to a version (and optionally, a digest) like so: + +```yml +.... +jobs: + renovate: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v7.0.1 + - name: Self-hosted Renovate + uses: renovatebot/github-action@v46.3.1 + with: + renovate-image: ghcr.io/renovatebot/renovate@sha256:0f7ba2b70c5d1a7e2d95b0f6c3d5b4a1e2f6b6a1e2f6b6a1e2f6b6a1e2f6b6a1 + token: ${{ secrets.RENOVATE_TOKEN }} +``` + ### `renovate-version` The Renovate version to use. diff --git a/src/docker.ts b/src/docker.ts index ea79eb9f..0ae6933d 100644 --- a/src/docker.ts +++ b/src/docker.ts @@ -1,17 +1,24 @@ +import { info, warning } from '@actions/core'; import type { Input } from './input'; -import { warning } from '@actions/core'; export class Docker { private static readonly image = 'ghcr.io/renovatebot/renovate'; private static readonly version = '44'; // renovate - private readonly dockerImage: string; - private readonly fullTag: string; + private readonly fullImageReference: string; constructor(input: Input) { let image = input.getDockerImage(); let version = input.getVersion(); + if (image?.includes(':')) { + info( + `Docker image looks like it contains a version, using that as the image itself`, + ); + this.fullImageReference = image; + return; + } + if (!image) { warning(`No Docker image specified, using ${Docker.image}`); image = Docker.image; @@ -21,11 +28,10 @@ export class Docker { version = Docker.version; } - this.dockerImage = image; - this.fullTag = version; + this.fullImageReference = `${image}:${version}`; } image(): string { - return `${this.dockerImage}:${this.fullTag}`; + return this.fullImageReference; } }