Record and show that an image is already on its newest tag

An image that had been checked and is current looked exactly like one
that was never checked.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Dennis Nemec
2026-09-03 20:37:46 +02:00
parent 1cb634afca
commit 4efff51aa7
6 changed files with 69 additions and 15 deletions

View File

@ -59,6 +59,7 @@ pub struct ImageUpdate {
/// The image reference as it runs on the cluster.
pub image: String,
/// The newer tag that was checked, e.g. `docker.gitea.com/gitea:1.25.1-rootless`.
/// Empty when the check found no newer tag.
pub candidate: String,
pub checked_at: chrono::DateTime<chrono::Utc>,
/// CVE ids that are open on the running image and gone in the candidate.
@ -68,6 +69,13 @@ pub struct ImageUpdate {
pub candidate_total: usize,
}
impl ImageUpdate {
/// True when the check found no newer tag for this image.
pub fn up_to_date(&self) -> bool {
self.candidate.is_empty()
}
}
/// Numeric parts of a tag plus its suffix, e.g. `1.24.2-rootless` → ([1, 24, 2], "rootless").
fn version_parts(tag: &str) -> Option<(Vec<u64>, String)> {
let core = tag.strip_prefix('v').unwrap_or(tag);