Skip to content

Conversation

rhatdan
Copy link
Member

@rhatdan rhatdan commented Sep 24, 2025

This commit implements automatic creation timestamp functionality for artifacts as requested in GitHub issue #27081, allowing users to see when artifacts were created.

Changes made:

  • Add org.opencontainers.image.created annotation with Unix nanoseconds timestamp during artifact creation
  • Preserve original creation timestamp when using --append option
  • Update artifact inspect and add man pages to document the new functionality
  • Add comprehensive e2e and system BATS tests to verify creation timestamp behavior
  • Store timestamp as integer (Unix nanoseconds) for programmatic access

The creation timestamp helps users understand artifact freshness, particularly useful for AI models and other time-sensitive artifacts managed by tools like RamaLama.

Usage examples:
podman artifact add myartifact:latest /path/to/file # Creates with timestamp
podman artifact inspect myartifact:latest # Shows created annotation as integer
podman artifact add --append myartifact:latest /file2 # Preserves original timestamp

Fixes: #27081

Does this PR introduce a user-facing change?

podman artifacts now include creation date.

@rhatdan
Copy link
Member Author

rhatdan commented Sep 24, 2025

Generated by Cursor.

if options.Annotations != nil {
annotations = maps.Clone(options.Annotations)
}
annotations[specV1.AnnotationCreated] = fmt.Sprintf("%d", time.Now().UTC().UnixNano())
Copy link
Member

Choose a reason for hiding this comment

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

This is wrong, should be an RFC 3339 string per the OCI spec.

Copy link
Member Author

Choose a reason for hiding this comment

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

I will tell Cursor to make the change. I would prefer this as an int, so it is easy to convert, But if this is defined in the spec.

artifact1Name := "localhost/test/artifact1"

// Record time before creation (with some buffer for slow systems)
beforeCreate := time.Now().UTC().Add(-time.Second)
Copy link
Member

Choose a reason for hiding this comment

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

is this gonna cause flakes for people?

Copy link
Member

Choose a reason for hiding this comment

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

I don't think so - the way it's implemented seems safe

Expect(failSession).Should(ExitWithError(125, "Error: append option is not compatible with type option"))
})

It("podman artifact inspect shows created date", func() {
Copy link
Member

Choose a reason for hiding this comment

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

could this be part of another test, maybe one of the more basic ones? not a requirement, just asking.

Copy link
Member Author

Choose a reason for hiding this comment

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

I combined the two tests together. One to check the creation date and one to make sure that appending to the artifact does not change the date.
These tests take almost not time.

This commit implements automatic creation timestamp functionality for artifacts
as requested in GitHub issue containers#27081, allowing users to see when artifacts were created.

Changes made:
- Add org.opencontainers.image.created annotation with Unix nanoseconds timestamp during artifact creation
- Preserve original creation timestamp when using --append option
- Update artifact inspect and add man pages to document the new functionality
- Add comprehensive e2e and system BATS tests to verify creation timestamp behavior
- Store timestamp as integer (Unix nanoseconds) for programmatic access

The creation timestamp helps users understand artifact freshness, particularly
useful for AI models and other time-sensitive artifacts managed by tools like RamaLama.

Usage examples:
  podman artifact add myartifact:latest /path/to/file     # Creates with timestamp
  podman artifact inspect myartifact:latest              # Shows created annotation as integer
  podman artifact add --append myartifact:latest /file2  # Preserves original timestamp

Fixes: containers#27081
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
@packit-as-a-service
Copy link

[NON-BLOCKING] Packit jobs failed. @containers/packit-build please check. Everyone else, feel free to ignore.

@rhatdan
Copy link
Member Author

rhatdan commented Sep 25, 2025

@baude @mheon PTANL

@baude
Copy link
Member

baude commented Sep 25, 2025

I'm cool with this ... LGTM

@mheon
Copy link
Member

mheon commented Sep 25, 2025

Sure
/lgtm
/approve

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Sep 25, 2025
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Sep 25, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mheon, rhatdan

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 25, 2025
@openshift-merge-bot openshift-merge-bot bot merged commit 2102673 into containers:main Sep 25, 2025
77 of 81 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. release-note

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Podman artifacts do not contain a createdat date?

3 participants