Skip to content

doc: add scenario doc for attaching files to a multi-platform image #1682

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 10 commits into from

Conversation

FeynmanZhou
Copy link
Member

@FeynmanZhou FeynmanZhou commented Apr 1, 2025

What this PR does / why we need it:

Add a scenario doc for attaching files to a multi-platform image. We need to discuss and align on the scenarios first.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #1531

Please check the following list:

  • Does the affected code have corresponding tests, e.g. unit test, E2E test?
  • Does this change require a documentation update?
  • Does this introduce breaking changes that would require an announcement or bumping the major version?
  • Do all new files have an appropriate license header?

Copy link

codecov bot commented Apr 1, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.20%. Comparing base (a008df7) to head (e6b0ece).
Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1682      +/-   ##
==========================================
+ Coverage   85.13%   85.20%   +0.06%     
==========================================
  Files         129      129              
  Lines        5780     5780              
==========================================
+ Hits         4921     4925       +4     
+ Misses        613      609       -4     
  Partials      246      246              

☔ View full report in Codecov by Sentry.
📢 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.

@sajayantony
Copy link
Contributor

I am hoping we can expand this scenario - Enable users to attach the same annotations to multiple manifests or index.
The scope then would be about providing a way to script or enable users to obtain an annotation set (entity/manifest or data) that can be used to attach it to either multiple manifests or images.

For e.g.

$manifest = $(oras manifest create --annotation ... --artifact type)
oras attach registry/repo:build-tag  --manifest-data $manifest
oras attach regisry/repo2:build-tag --manifest-data $manifest 
oras attach regisry/repo3:build-tag --platform linux/amd64 --manifest-data $manifest 

Copy link
Contributor

@shizhMSFT shizhMSFT left a comment

Choose a reason for hiding this comment

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

Nice summary on the scenarios. They can be summarized as the following two types of scenarios:

  1. Propagation (cascading updates)
  2. Individual updates

@FeynmanZhou FeynmanZhou marked this pull request as ready for review April 8, 2025 21:27
@Wwwsylvia
Copy link
Member

Wwwsylvia commented Apr 16, 2025

I am hoping we can expand this scenario - Enable users to attach the same annotations to multiple manifests or index. The scope then would be about providing a way to script or enable users to obtain an annotation set (entity/manifest or data) that can be used to attach it to either multiple manifests or images.

For e.g.

$manifest = $(oras manifest create --annotation ... --artifact type)
oras attach registry/repo:build-tag  --manifest-data $manifest
oras attach regisry/repo2:build-tag --manifest-data $manifest 
oras attach regisry/repo3:build-tag --platform linux/amd64 --manifest-data $manifest 

@sajayantony How does --manifest-data work here?

@sajayantony
Copy link
Contributor

Enabling oras to create some kind of temporary manifest that can be piped into commands was the idea.

@sajayantony How does --manifest-data work here?

For e.g. manifest data can be something like.

artifactType: application/sbom+json
annotations: 
   key1:value1

The remaining information like subject and created time etc. can be filled by attach

oras attach example.com/hello-world:latest --platform  linux/amd64 --manifest-data $manifest sbom.json
 oras attach  example.com/hello-world:latest  --platform  arm/amd64 --manifest-data $manifest sbom.json

oras attach example.com/hello-world-nightly:latest --platform  linux/amd64 --manifest-data $manifest sbom.json
oras attach  example.com/hello-world-nightly:latest   --platform  arm/amd64 --manifest-data $manifest sbom.json

Another option would be to enable annotation only but then I think enabling construction of these types is more generic.

For example. oras index create can also take these data structure to compose using annotations and/or artifacts.

@Wwwsylvia
Copy link
Member

@sajayantony What would be the expected result of these oras attach command? Would they create a referrer manifest that contains artifact type "application/sbom+json" and annotations "key1:value1" provided from the --manifest-data?

If so, is it equivalent to supplying --artifact-type and --annotation directly via environment variables?
Are there other common fields that can be shared between different referrer manifests, other than artifactType and annotations?

artifactType="application/sbom+json"
annotation="key1=value1"

oras attach example.com/hello-world:latest --platform  linux/amd64 --artifact-type $artifactType --annotation $annotation
oras attach example.com/hello-world:latest  --platform  arm/amd64 --artifact-type $artifactType --annotation $annotation

oras attach example.com/hello-world-nightly:latest --platform  linux/amd64 --artifact-type $artifactType --annotation $annotation
oras attach  example.com/hello-world-nightly:latest --platform  arm/amd64 --artifact-type $artifactType --annotation $annotation

Signed-off-by: Feynman Zhou <[email protected]>
Signed-off-by: Feynman Zhou <[email protected]>
Signed-off-by: Feynman Zhou <[email protected]>
Signed-off-by: Feynman Zhou <[email protected]>
Signed-off-by: Feynman Zhou <[email protected]>
Signed-off-by: Feynman Zhou <[email protected]>
Signed-off-by: Feynman Zhou <[email protected]>
Signed-off-by: Feynman Zhou <[email protected]>
Copy link
Contributor

@Copilot 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

A proposal document introducing scenarios for attaching files (e.g., EoL annotations) to multi-platform images via the ORAS CLI.

  • Adds a new markdown file outlining upward and downward annotation propagation scenarios.
  • Describes example workflows for marking outdated platform-specific and multi-platform images.
  • Illustrates current limitations and manual steps required with oras attach.
Comments suppressed due to low confidence (1)

docs/proposals/oras-attach-multi-platform.md:37

  • There's a missing 'to' in 'she has execute'; it should read 'she has to execute multiple commands.'
Alice has to manually retrieve the new digests and run `oras attach` twice: once for the old digest of the parent image index and once for the platform-specific image. If multiple platform-specific images require updates, she has execute multiple commands.

Signed-off-by: Feynman Zhou <[email protected]>
Comment on lines +25 to +31
Set environment variables:

```
ARTIFACT_TYPE=application/vnd.demo.artifact.lifecycle
ANNOTATION_KEY=vnd.demo.artifact.lifecycle.end-of-life.date
ANNOTATION_VALUE=2025-03-20T01:20:30Z
```
Copy link
Member

Choose a reason for hiding this comment

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

nit: I think it might be a bit abrupt to set the environment variables here without using them immediately. Should we move this section downward to be closer to the oras attach commands that utilize these variables?


Since the patched image has a new digest, the parent image index also receives an updated digest. When a platform-specific image is marked as EoL, dependent services stop using it, and vulnerability scanning tools can recognize it as deprecated through the lifecycle metadata.

![multi-arch image](./img/oras-attach-EoL.drawio.svg)
Copy link
Member

Choose a reason for hiding this comment

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

In the diagram, it's not clear that which on is a1a1 and which one is b1b1.

Comment on lines +60 to +66
A new image index is created:

```console
demo/alpine:z1z1 (image index)
-> demo/alpine:r1r1 (linux/amd64)
-> demo/alpine:c1c1 (linux/arm64)
```
Copy link
Member

Choose a reason for hiding this comment

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

nit: So b1b1 now becomes r1r1 and a1a1 now becomes z1z1? Does it mean that the image tags are updated after the images are patched? It might be strange as tags are usually reused while digests change.
Would it be better to use demo/alpine@sha256:a1a1 to represent the images?


#### Scenario B: attach a referrer to an index to downward propagate to all child images

In addition, if a vulnerability is detected and affects images of all platforms, the parent index and each child image are patched, generating new digest of each. The outdated multi-platform image and each child image are marked as invalid using an EoL annotation similar as above.
Copy link
Member

Choose a reason for hiding this comment

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

What's the difference between scenario A and B? It looks like it's the same that some platform-specific images are vulnerable and the affected index needs to be patched as well? 🤔

@FeynmanZhou
Copy link
Member Author

Close this PR as the corresponding issue #1531 has been moved to ORAS v1.4.0.

@FeynmanZhou FeynmanZhou closed this Jul 2, 2025
@TerryHowe
Copy link
Member

Why is this closed just because of scheduling?

@FeynmanZhou
Copy link
Member Author

FeynmanZhou commented Jul 4, 2025

@TerryHowe This doc does not cover the end-to-end scenarios of attaching referrers to an image index and listing them. I plan to refactor this doc and target resolving two issues #1741 #1531 in my new proposal. cc @Wwwsylvia

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.

Extend the ORAS annotating capabilities in oras attach
5 participants