From 8776da5455ac23260bc347e51304c95f9bd5d75f Mon Sep 17 00:00:00 2001 From: Billy Zha Date: Tue, 21 May 2024 07:31:25 +0000 Subject: [PATCH] doc: verify local files Signed-off-by: Billy Zha --- docs/proposals/formatted-output.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/proposals/formatted-output.md b/docs/proposals/formatted-output.md index 673868653..a692c439f 100644 --- a/docs/proposals/formatted-output.md +++ b/docs/proposals/formatted-output.md @@ -75,6 +75,14 @@ jobs: cat $PATH ``` +### Verify local files + +Carol is a build engineer who needs to check whether some locally copied files are identical to the remote artifact content. she can utilize `oras manifest fetch` to generate a checksum file based on the manifest without pulling the whole artifact. (See related issue [here](https://github.com/oras-project/oras/issues/1368)). + +```bash +oras manifest fetch $REGISTRY/$REPO:$TAG --format go-template='{{range .content.layers}}{{if index .annotations "org.opencontainers.image.title"}}{{(split ":" .digest)._1}} {{index .annotations "org.opencontainers.image.title"}}{{println}}{{end}}{{end}}' | shasum -c +``` + ## Proposal and desired user experience Enable users to use the `--format` flag to format metadata output into structured data (e.g. JSON) and optionally use the `--template` with the [Go template](https://pkg.go.dev/text/template) to manipulate the output data.