fix: allow renovate-image to take a full digest-pinned image (#1082)

In Renovate 44.82.0 we added support for Renovate to extract
`renovate-version` and `renovate-image` inputs from a GitHub Actions
workflow.

However, per [0], this doesn't actually work for digest-pinned images,
because this leads to i.e.

  ghcr.io/renovatebot/renovate:44.104.2@sha256:c87b1c55ab98286dad9df0c1d84ebe1fbe2a805a68d48dd7a6d577709bf951a7:44

where the `:44` is added, as no `renovate-version` is set.

To fix this, we can check for a `:` - denoting an image tag - in the
`renovate-image`, and prioritise the full image in that case.

[0]: https://github.com/renovatebot/renovate/discussions/41809#discussioncomment-18597558
This commit is contained in:
Jamie Tanna authored and GitHub committed 2026-09-25 16:17:38 +01:00
1 parent 63d12f680b
commit 16decedb2e
3 files changed
+37 -6

No files matched your search

+8
View File
@@ -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
+17
View File
@@ -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.
+12 -6
View File
@@ -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;
}
}