Skip to content

Fix #1138: Set org.opencontainers.image.created annotation on ModelKit manifests#1139

Open
itniuma2026 wants to merge 2 commits intokitops-ml:mainfrom
itniuma2026:fix/issue-1138
Open

Fix #1138: Set org.opencontainers.image.created annotation on ModelKit manifests#1139
itniuma2026 wants to merge 2 commits intokitops-ml:mainfrom
itniuma2026:fix/issue-1138

Conversation

@itniuma2026
Copy link
Copy Markdown

Summary

Add the standard OCI annotation org.opencontainers.image.created with the current time in RFC 3339 format to ModelKit manifests during the pack operation, alongside the existing ml.kitops.modelkit.cli-version annotation.

Approach

In the function within pkg/lib/filesystem/local-storage.go that constructs the manifest and sets annotations (where ml.kitops.modelkit.cli-version is already set), add a new annotation entry with key org.opencontainers.image.created and value set to time.Now().UTC().Format(time.RFC3339). This requires importing the time package if not already imported. The change should be placed right next to the existing CLI version annotation assignment to keep annotation logic grouped together.

Files Changed

  • pkg/lib/filesystem/local-storage.go

Related Issue

Fixes #1138

Testing

No tests were added with this change. Happy to add them if needed.

@gorkem
Copy link
Copy Markdown
Member

gorkem commented Mar 26, 2026

Can you add the sign-off messages to your commits. Click on the failing DCO check above for how to instructions.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds the standard OCI manifest annotation org.opencontainers.image.created during ModelKit pack so registries/tools can read creation time directly from the manifest metadata.

Changes:

  • Import time in the local storage pack implementation.
  • Set org.opencontainers.image.created on the OCI manifest annotations during SaveModel.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +68 to +70
if manifest.Annotations == nil {
manifest.Annotations = map[string]string{}
}
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

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

createManifest() already initializes manifest.Annotations (and sets ml.kitops.modelkit.cli-version), so this nil-check/map allocation is currently redundant, and it also makes the later if manifest.Annotations == nil block in the ModelPack annotation section dead code. Consider consolidating all “global annotation” writes (including org.opencontainers.image.created) in createManifest() and removing the duplicated nil checks.

Copilot uses AI. Check for mistakes.
if manifest.Annotations == nil {
manifest.Annotations = map[string]string{}
}
manifest.Annotations[ocispec.AnnotationCreated] = time.Now().UTC().Format(time.RFC3339)
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

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

Setting org.opencontainers.image.created to time.Now() makes the packed manifest digest non-deterministic across runs. This will break the existing reproducibility expectation (e.g., testing/pack-unpack_test.go:TestPackReproducibility asserts two consecutive kit pack runs produce the same digest) and can reduce layer/manifest deduplication in storage/registries. Consider sourcing the timestamp deterministically (e.g., from a reproducible build time env var) or gating this annotation so reproducible packs remain stable, and adjust tests accordingly.

Copilot uses AI. Check for mistakes.
@gorkem
Copy link
Copy Markdown
Member

gorkem commented Mar 30, 2026

@itniuma2026 can you fix the DCO failure

…fests

Add the standard OCI annotation `org.opencontainers.image.created` with the current time in RFC 3339 format to ModelKit manifests during the pack operation, alongside the existing `ml.kitops.modelkit.cli-version` annotation.

Fixes kitops-ml#1138

Signed-off-by: itniuma <itniuma@proton.me>
@itniuma2026
Copy link
Copy Markdown
Author

@gorkem Done! I've amended the commit with the required Signed-off-by line. The DCO check should pass now. Thanks for the reminder!

Comment on lines +68 to +72
if manifest.Annotations == nil {
manifest.Annotations = map[string]string{}
}
manifest.Annotations[ocispec.AnnotationCreated] = time.Now().UTC().Format(time.RFC3339)

Copy link
Copy Markdown
Contributor

@amisevsk amisevsk Apr 2, 2026

Choose a reason for hiding this comment

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

createManifest already sets up some annotations (the CLI version) -- it should probably also apply this annotation as part of that process. The reason we set the additional annotation below is because it's optionally included and ModelPack-specific behaviour.

createManifest should be responsible for creating the base ModelKit manifest in as complete a way as possible.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Good point! Moved the org.opencontainers.image.created annotation into createManifest() alongside the CLI version annotation, and removed the redundant nil-check from SaveModel(). Thanks for the review.

Move org.opencontainers.image.created annotation from SaveModel()
into createManifest() alongside the existing CliVersion annotation,
as requested by reviewer. Removes redundant nil-check in SaveModel().

Signed-off-by: itniuma <itniuma@proton.me>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 348 to 350
manifest.Annotations[constants.CliVersionAnnotation] = constants.Version
manifest.Annotations[ocispec.AnnotationCreated] = time.Now().UTC().Format(time.RFC3339)

Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

org.opencontainers.image.created is being set using a fresh time.Now() call here, which can diverge from the creation timestamp stored in the config blob (e.g., ModelPack config sets CreatedAt separately and currently uses non-UTC time). This can lead to inconsistent "created" times between manifest and config. Consider generating a single UTC timestamp once during pack and reusing it for both config creation and this manifest annotation (or deriving the manifest value from the config’s CreatedAt when available).

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Set org.opencontainers.image.created annotation on ModelKit manifests

4 participants