You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add an annotation to an existing manifest
Put the new manifest
Delete the old manifest by digest so that we don’t have a dangling manifest but maybe have and option to skip delete(flag)
@rchincha Will this functionally cover what you need?
Amending manifests can have unintended consequences that can affect existing attached artifacts, associated tags, and associated manifest list / index.
Scenario 1: Amending annotations of a signed image
Modifying a manifest will result in a manifest with a new digest. The signature of the previous manifest gets invalidated immediately.
Scenario 2: Amending annotations of an image tagged with latest, v1.1.0, v1.1, v1.
Modifying a manifest will result in a manifest with a new digest, which is not tagged.
If the previous manifest gets deleted, all associated tags are deleted.
Since there is no common API to reverse search the tags of the manifest being amended, the client has to scan all tags, which is inefficient with a repository full of tags, in order to tag the new manifest with the same tags.
Scenario 3: Amending annotations of an image manifest, which is in a manifest list.
Modifying a manifest will result in a manifest with a new digest. Therefore, the corresponding manifest list is required to be updated.
+1 on this. I would like to propose an amend command that would
Add an annotation to an existing manifest
Put the new manifest
Delete the old manifest by digest so that we don’t have a dangling manifest but maybe have and option to skip delete(flag)
Although we don't have a command like oras manifest amend --annotation key=value, this operation can be equivalently achieved using the oras CLI built from the main branch by
Amending manifests can have unintended consequences that can affect existing attached artifacts, associated tags, and associated manifest list / index.
* **Scenario 1**: Amending annotations of a signed image
* Modifying a manifest will result in a manifest with a new digest. The signature of the previous manifest gets invalidated immediately.
* **Scenario 2**: Amending annotations of an image tagged with `latest`, `v1.1.0`, `v1.1`, `v1`.
* Modifying a manifest will result in a manifest with a new digest, which is not tagged.
* If the previous manifest gets deleted, all associated tags are deleted.
* Since there is no common API to reverse search the tags of the manifest being amended, the client has to scan all tags, which is inefficient with a repository full of tags, in order to tag the new manifest with the same tags.
* **Scenario 3**: Amending annotations of an image manifest, which is in a manifest list.
* Modifying a manifest will result in a manifest with a new digest. Therefore, the corresponding manifest list is required to be updated.
Signatures or any other invariant will be invalidated since the image manifest itself is changing, which may be ok and would requiring re-signing etc.
When we compose, extend or distribute images based off of other images, this is really the normal.
Although we don't have a command like oras manifest amend --annotation key=value, this operation can be equivalently achieved using the oras CLI built from the main branch by
Delete the old manifest by oras manifest delete localhost:5000/test@sha256:xxxx using the digest obtained from step 1.
I think it's significant to support amend annotations to simplify the process above.
The effects on the existing attached artifacts, associated tags, and associated manifest list / index are acceptable but should be explicitly informed to users in the documentation or somewhere.
A teammate shared this ticket with me and I wanted to share my thoughts on this ticket as it's pending requirements.
As a user, my expectations for oras push are such that:
annotations provided are merged with any annotations present in a provided manifest, giving preference for the annotations in --annotations
I would like the option to do the following things, both on oras push and as an update (e.g. oras manifest amend):
set an annotation. If it already exists, replace it. If it does not, add it.
remove an annotation, if it exists (the syntax I have seen for this before is key-, which is what kubernetes uses I believe)
I think separately there may be value in an option to a command such as oras manifest amend such as oras manifest amend --replace-annotations and --replace-annotations-file that simply replaces all annotations.
I do not believe, due to the complexities of deleting an existing manifest, that a manifest amend command should include a manifest delete operation. I believe this should be a separate command call made by users.
I do believe some users want to call a command like oras manifest amend image:tag and have it do all of the steps of:
save tag name
resolve digest
push new manifest
assign tag to new manifest's digest
Though I think this still has too many edge cases because of manifest lists and multiple tags.
@lexrj Thanks for sharing your insights. Looks like users are looking for more fine-grained capabilities of managing annotations, not just adding annotations. In such case, would it be more flexible to introduce oras annotate command to add, amend, attach, and remove annotations of an OCI image/artifact?
Activity
sajayantony commentedon Sep 15, 2022
+1 on this. I would like to propose an amend command that would
qweeah commentedon Sep 16, 2022
@rchincha Will this functionally cover what you need?
rchincha commentedon Sep 16, 2022
https://github.com/opencontainers/distribution-spec/blob/main/spec.md#pushing-manifests
Note the two options that are possible.
By digest, it is a read-copy-update operation but by tag, it is a single in-situ update.
Thoughts?
shizhMSFT commentedon Sep 16, 2022
Amending manifests can have unintended consequences that can affect existing attached artifacts, associated tags, and associated manifest list / index.
latest,v1.1.0,v1.1,v1.shizhMSFT commentedon Sep 16, 2022
Although we don't have a command like
oras manifest amend --annotation key=value, this operation can be equivalently achieved using theorasCLI built from themainbranch byoras manifest fetch localhost:5000/test:latest --descriptor -o manifest.jsonmanifest.jsonwith any toolsoras manifest push localhost:5000/test:latest manifest.jsonoras manifest delete localhost:5000/test@sha256:xxxxusing the digest obtained from step 1.rchincha commentedon Sep 16, 2022
A slight enhancement ...
oras manifest amend --annotation key=value^ a single key/val
(OR) this
oras manifest amend --annotation key=value,key=value,key=value...rchincha commentedon Sep 16, 2022
Signatures or any other invariant will be invalidated since the image manifest itself is changing, which may be ok and would requiring re-signing etc.
When we compose, extend or distribute images based off of other images, this is really the normal.
shizhMSFT commentedon Sep 17, 2022
If we decide to do this, a suggested command is
which is consistent with
oras push.shizhMSFT commentedon Sep 17, 2022
/cc @FeynmanZhou @yizha1 for inputs.
shizhMSFT commentedon Sep 20, 2022
There are more questions:
FeynmanZhou commentedon Sep 21, 2022
I think it's significant to support amend annotations to simplify the process above.
The effects on the existing attached artifacts, associated tags, and associated manifest list / index are acceptable but should be explicitly informed to users in the documentation or somewhere.
The sample above only considered the case of appending new annotations. Should
DeleteorModifyannotations also be considered in the amending case?4 remaining items
github-actions commentedon Jul 24, 2023
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.
lexrj commentedon Feb 20, 2025
A teammate shared this ticket with me and I wanted to share my thoughts on this ticket as it's pending requirements.
As a user, my expectations for oras push are such that:
I would like the option to do the following things, both on
oras pushand as an update (e.g.oras manifest amend):key-, which is what kubernetes uses I believe)I think separately there may be value in an option to a command such as
oras manifest amendsuch asoras manifest amend --replace-annotationsand--replace-annotations-filethat simply replaces all annotations.I do not believe, due to the complexities of deleting an existing manifest, that a
manifest amendcommand should include amanifest deleteoperation. I believe this should be a separate command call made by users.I do believe some users want to call a command like
oras manifest amend image:tagand have it do all of the steps of:Though I think this still has too many edge cases because of manifest lists and multiple tags.
FeynmanZhou commentedon Apr 16, 2025
@lexrj Thanks for sharing your insights. Looks like users are looking for more fine-grained capabilities of managing annotations, not just adding annotations. In such case, would it be more flexible to introduce
oras annotatecommand to add, amend, attach, and remove annotations of an OCI image/artifact?