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
View an artifact's referrers manifest in pretty JSON output. The following fields should be outputted:
337
+
> [!NOTE]
338
+
> The `--output` flag will be replaced by the `--format` flag. The `--output` flag SHOULD be marked as "deprecated" in ORAS with a warning message and will be removed in future releases.
339
+
340
+
If the referrers have child referrers, ORAS SHOULD show the manifest content of the subject image and all referrers recursively in all formatted outputs (`tree`, `JSON`, `go-template`). It ensures data consistency of different data formats in the output.
341
+
342
+
#### JSON output of `oras discover`
336
343
337
-
-`manifests`: the list of referrers
344
+
When showing the subject image and all referrers' manifests recursively in a formatted JSON output, include the following fields:
345
+
346
+
- `reference`: full reference by digest of the subject image
347
+
- `mediaType`: media type of the subject image
348
+
- `digest`: digest of the subject image
349
+
- `size`: subject image size in bytes
350
+
- `referrers`: the list of referrers' manifest
338
351
- `reference`: full reference by digest of the referrer
339
352
- `mediaType`: media type of the referrer
340
-
-`size`: referrer file size in bytes
341
353
- `digest`: digest of the referrer
354
+
- `size`: referrer file size in bytes
342
355
- `artifactType`: artifact type of a referrer
343
356
- `annotations`: contains arbitrary metadata in a referrer
357
+
- `referrers`: the list of referrers' manifest
344
358
345
-
See an example:
359
+
Here is the JSON Schema to describe the required fields of JSON output:
> The `--format` flag will replace the existing `--output` flag. The `--output` will be marked as "deprecated" in ORAS v1.2.0 and will be removed in the future releases.
503
+
#### Table format of `oras discover` output
504
+
505
+
The `oras discover --format table` command currently lists only direct referrers in a table format. This table view has limitations: it does not effectively represent the hierarchical artifact reference relationships of all referrers. Users can't differentiate the reference relationship between each referrer in a table format output. See current sample output as follows:
In contrast, the tree view offers a more structured and human-readable output by visually displaying relationships of each referrer. Given this advantage, the table view no longer provides significant value to users. This document proposes deprecating the `--format table` option. When user specifies `--format table` flag with `oras discover`, the warning message SHOULD be printed out as follows:
Warning: "table" option has been deprecated in the "--format" flag, and will be removed in a future release. Please switch to either JSON or tree format for more structured output.
By default, ORAS displays all referrers of a subject image. However, when a subject image has a complex referrer graph, this can lead to throttling or performance issues. To mitigate this, ORAS SHOULD introduce an experimental `--depth` flag for `oras discover`, allowing users to specify the maximum depth of referrers in the formatted output.
536
+
537
+
Assume there is a sample image with referrers spanning four levels. By using the `--depth` flag, you can display only the referrers within the third level in a tree view. This command will display the referrers up to the third level only, helping to limit the scope and improve performance when dealing with complex referrer graphs.
538
+
539
+
```bash
540
+
oras discover localhost:5000/kubernetes/kubectl@sha256:bece4f4746a39cb39e38451c70fa5a1e5ea4fa20d4cca40136b51d9557918b01 --format tree --depth 3
**Q:** Why choose to use `--format` flag to enable JSON formatted output instead of extending the existing `--output` flag?
562
+
385
563
**A:** ORAS follows [GNU](https://www.gnu.org/prep/standards/html_node/Option-Table.html#Option-Table) design principles. ORAS uses `--output` to specify a file or directory content should be created within and `--format` to format the output into JSON or using the given Go template. Popular tools, like Docker, Podman, and Skopeo also follow this design principle within their formatted output feature.
**A:** Go template is a powerful method to allow users to manipulate and customize output you want. It provides access to data objects and additional functions that are passed into the template engine programmatically. It also has some useful libraries that have strong functions for Go’s template language to manipulate the output data, such as [Sprig](https://masterminds.github.io/sprig/). The basic usage of Go template functions are easy to use.
566
+
567
+
**A:** Go template is a powerful method to allow users to manipulate and customize output you want. It provides access to data objects and additional functions that are passed into the template engine programmatically. It also has some useful libraries that have strong functions for Go’s template language to manipulate the output data, such as [Sprig](https://masterminds.github.io/sprig/). The basic usage of Go template functions are easy to use.
0 commit comments