Skip to content

Conversation

rhatdan
Copy link
Member

@rhatdan rhatdan commented Oct 6, 2025

Does this PR introduce a user-facing change?

Users of podman artifact add can override the org.opencontainers.image.title annotation.

Copy link
Contributor

openshift-ci bot commented Oct 6, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: rhatdan
Once this PR has been reviewed and has the lgtm label, please assign giuseppe for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@rhatdan
Copy link
Member Author

rhatdan commented Oct 6, 2025

@Luap99 PTAL

@ninja-quokka
Copy link
Collaborator

An issue this introduces is when using podman artifact add --annotation [1] the annotation is added to each file/blob passed in the call.

So ./bin/podman artifact add --annotation=org.opencontainers.image.title=testname multitest README.md MAINTAINERS.md results in an artifact with two files with the image title testname

So we need to do something like block setting the org.opencontainers.image.title if multiple artifacts are being added in one call or maybe better yet fail if the artifact already has file/blob with the same image.title as this will cover the situation of adding a file/blob to an existing artifact with podman artifact --append

@baude WDYT

[1] https://docs.podman.io/en/v5.6.2/markdown/podman-artifact-add.1.html#annotation-annotation-value

@rhatdan
Copy link
Member Author

rhatdan commented Oct 6, 2025

The same issue exists if you do the same name multiple times.

./bin/podman artifact add --annotation=org.opencontainers.image.title=testname multitest README.md
./bin/podman artifact add --annotation=org.opencontainers.image.title=testname multitest Maintainers.md

So we can either check to see if the annotation is already defined, or just leave it to the users to deal with it. IE this is legal theoretically in the spec, so if users add it then they have to deal with it when the attempt to mount the object.

Copy link
Member

@Luap99 Luap99 left a comment

Choose a reason for hiding this comment

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

looks reasonable, as we discussed in the community meeting we should generate an error if the same name is set for more than one file.

title := RandomString(12)
annotation3 := fmt.Sprintf("org.opencontainers.image.title=%s", title)
podmanTest.PodmanExitCleanly("artifact", "add", "--annotation", annotation3, "foobar", artifact1File)
Expect(a.Manifest.Layers[0].Annotations["org.opencontainers.image.title"]).To(Equal(title))
Copy link
Member

Choose a reason for hiding this comment

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

that is not checking the right thing, you need to inspect the artifact you just created with podmanTest.InspectArtifact("foobar") and use that return value to check the annotation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants