From 4525398c2c6c1503eb78ab0ac33d374741465727 Mon Sep 17 00:00:00 2001 From: Billy Zha Date: Mon, 27 May 2024 13:55:33 +0800 Subject: [PATCH] doc: verify local files (#1386) 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.