Skip to content

fix(controller)!: use the latest available creation time for NewestBuild - #6777

Merged
krancour merged 1 commit into
akuity:mainfrom
krancour:krancour/create-dts-fix
Aug 10, 2026
Merged

fix(controller)!: use the latest available creation time for NewestBuild#6777
krancour merged 1 commit into
akuity:mainfrom
krancour:krancour/create-dts-fix

Conversation

@krancour

@krancour krancour commented Aug 7, 2026

Copy link
Copy Markdown
Member

An image's creation time was taken from an org.opencontainers.image.created or org.label-schema.build-date label in preference to the creation time recorded in its config. Labels are copied from the base image unless a build overwrites them, so an image that sets no label of its own reports the build time of the image it was built from.

ubuntu:26.04 -- and therefore ubuntu:latest -- carries such a label; ubuntu:24.04 did not. Every image built from one of these between two republishes of the base reports an identical creation time. NewestBuild then sorts on a tie, falls back to reverse-lexical tag order, and truncates to discoveryLimit, so new images can go undiscovered rather than merely mis-ranked.

Separately, annotations on an index, and on an index's references to the images it contains, were read for display but never for creation time. Multi-arch builds annotated with buildx --annotation index:... got no benefit from them.

Creation time is now taken from the outermost metadata that claims one -- an index's annotations, then an index's reference to an image, then the image's own manifest -- and, failing all of those, from the later of the config's creation time and any claim in its labels. No object in a registry can be older than anything referencing it, and every way one of these timestamps goes wrong understates it: a label copied from a base image, a timestamp carried over with a reused layer, a fixed timestamp chosen to make digests reproducible. Taking the outermost claim, and otherwise the later of the two remaining, amounts to using the latest date available.

Verified against a local registry with images built to exhibit each shape: base image label inheritance, index-only annotations, a reproducible build with a fixed config timestamp, and all four metadata locations populated at once.

Note for upgrades: images that were previously mis-ranked, or truncated away by discoveryLimit, may become visible. On a Warehouse with auto-promotion enabled, that can trigger promotions for images that already existed. This is why this fix will not be back ported to v1.11.x and will, instead, ship with v1.12.0.

Refs: #4635, #4636, #5179

cc @34fathombelow

An image's creation time was taken from an `org.opencontainers.image.created`
or `org.label-schema.build-date` label in preference to the creation time
recorded in its config. Labels are copied from the base image unless a build
overwrites them, so an image that sets no label of its own reports the build
time of the image it was built from.

`ubuntu:26.04` -- and therefore `ubuntu:latest` -- carries such a label;
`ubuntu:24.04` did not. Every image built from one of these between two
republishes of the base reports an identical creation time. `NewestBuild` then
sorts on a tie, falls back to reverse-lexical tag order, and truncates to
`discoveryLimit`, so new images can go undiscovered rather than merely
mis-ranked.

Separately, annotations on an index, and on an index's references to the images
it contains, were read for display but never for creation time. Multi-arch
builds annotated with `buildx --annotation index:...` got no benefit from them.

Creation time is now taken from the outermost metadata that claims one -- an
index's annotations, then an index's reference to an image, then the image's
own manifest -- and, failing all of those, from the later of the config's
creation time and any claim in its labels. No object in a registry can be older
than anything referencing it, and every way one of these timestamps goes wrong
understates it: a label copied from a base image, a timestamp carried over with
a reused layer, a fixed timestamp chosen to make digests reproducible. Taking
the outermost claim, and otherwise the later of the two remaining, amounts to
using the latest date available.

Verified against a local registry with images built to exhibit each shape: base
image label inheritance, index-only annotations, a reproducible build with a
fixed config timestamp, and all four metadata locations populated at once.

Note for upgrades: images that were previously mis-ranked, or truncated away by
`discoveryLimit`, may become visible. On a `Warehouse` with auto-promotion
enabled, that can trigger promotions for images that already existed. This is
why this fix will not be back ported to v1.11.x and will, instead, ship with
v1.12.0.

Refs: akuity#4635, akuity#4636, akuity#5179
Signed-off-by: Kent Rancourt <kent.rancourt@gmail.com>
@krancour
krancour requested review from a team as code owners August 7, 2026 19:22
@krancour krancour added this to the v1.12.0 milestone Aug 7, 2026
@krancour krancour added kind/bug Something isn't working as intended; If unsure that something IS a bug, start a discussion instead kind/refactor Non-functional changes to implementation details priority/normal This is the priority for most work area/controller Affects the (main) controller labels Aug 7, 2026
@netlify

netlify Bot commented Aug 7, 2026

Copy link
Copy Markdown

Deploy Preview for docs-kargo-io ready!

Name Link
🔨 Latest commit 5f69cad
🔍 Latest deploy log https://app.netlify.com/projects/docs-kargo-io/deploys/6a76307e5285340008646910
😎 Deploy Preview https://deploy-preview-6777.docs.kargo.io
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@codecov

codecov Bot commented Aug 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 30.84%. Comparing base (2f0ad08) to head (5f69cad).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6777   +/-   ##
=======================================
  Coverage   30.83%   30.84%           
=======================================
  Files         824      824           
  Lines       80467    80475    +8     
=======================================
+ Hits        24815    24823    +8     
  Misses      54196    54196           
  Partials     1456     1456           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@fuskovic fuskovic left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@krancour
krancour added this pull request to the merge queue Aug 10, 2026
Merged via the queue into akuity:main with commit a8df2f9 Aug 10, 2026
21 checks passed
@krancour
krancour deleted the krancour/create-dts-fix branch August 10, 2026 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/controller Affects the (main) controller kind/bug Something isn't working as intended; If unsure that something IS a bug, start a discussion instead kind/refactor Non-functional changes to implementation details priority/normal This is the priority for most work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants