Skip to content

Commit 42788bf

Browse files
authored
Merge pull request #98562 from FeynmanZhou/main
Update container-registry-oras-artifacts.md according to the latest version of ORAS CLI
2 parents 84f8685 + 864c342 commit 42788bf

File tree

1 file changed

+32
-37
lines changed

1 file changed

+32
-37
lines changed

articles/container-registry/container-registry-oras-artifacts.md

Lines changed: 32 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
title: Push and pull supply chain artifacts
3-
description: Push and pull supply chain artifacts using Azure Registry (Preview)
2+
title: Attach, push, and pull supply chain artifacts
3+
description: Attach, push, and pull supply chain artifacts using Azure Registry (Preview)
44
author: SteveLasker
55
manager: gwallace
66
ms.topic: article
@@ -21,7 +21,7 @@ ORAS Artifacts support is a preview feature and subject to [limitations](#previe
2121

2222
## Prerequisites
2323

24-
* **ORAS CLI** - The ORAS CLI enables push, discover, pull of artifacts to an ORAS Artifacts enabled registry.
24+
* **ORAS CLI** - The ORAS CLI enables attach, copy, push, discover, pull of artifacts to an ORAS Artifacts enabled registry.
2525
* **Azure CLI** - To create an identity, list and delete repositories, you need a local installation of the Azure CLI. Version 2.29.1 or later is recommended. Run `az --version `to find the version. If you need to install or upgrade, see [Install Azure CLI](/cli/azure/install-azure-cli).
2626
* **Docker (optional)** - To complete the walkthrough, a container image is referenced. You can use Docker installed locally to build and push a container image, or reference an existing container image. Docker provides packages that easily configure Docker on any [macOS][docker-mac], [Windows][docker-windows], or [Linux][docker-linux] system.
2727

@@ -31,11 +31,11 @@ ORAS Artifacts support is not available in the government or China clouds, but a
3131

3232
## ORAS installation
3333

34-
Download and install a preview ORAS release for your operating system. See [ORAS Install instructions][oras-install-docs] for how to extract and install the file for your operating system, referencing an Alpha.1 preview build from the [ORAS GitHub repo][oras-preview-install]
34+
Download and install a preview ORAS release for your operating system. See [ORAS installation instructions][oras-install-docs] for how to extract and install the file for your operating system. This article uses ORAS CLI 0.14.1 to demonstrate how to manage supply chain artifacts in ACR.
3535

3636
## Configure a registry
3737

38-
Configure environment variables to easily copy/paste commands into your shell. The commands can be run in the [Azure Cloud Shell](https://shell.azure.com/)
38+
Configure environment variables to easily copy/paste commands into your shell. The commands can be run in the [Azure Cloud Shell](https://shell.azure.com/).
3939

4040
```console
4141
ACR_NAME=myregistry
@@ -65,7 +65,7 @@ az acr create \
6565
--output jsonc
6666
```
6767

68-
In the command output, note the `zoneRedundancy` property for the registry. When enabled, the registry is zone redundant, and ORAS Artifact enabled:
68+
In the command output, note the `zoneRedundancy` property for the registry. When enabled, the registry is zone redundant, and ORAS Artifact enabled.
6969

7070
```output
7171
{
@@ -151,49 +151,47 @@ docker push $IMAGE
151151
echo '{"artifact": "'${IMAGE}'", "signature": "pat hancock"}' > signature.json
152152
```
153153

154-
### Push a signature to the registry, as a reference to the container image
154+
### Attach a signature to the registry, as a reference to the container image
155155

156-
The ORAS command pushes the signature to a repository, referencing another artifact through the `subject` parameter. The `--artifact-type` provides for differentiating artifacts, similar to file extensions that enable different file types. One or more files can be pushed by specifying `file:mediaType`
156+
The ORAS command attaches the signature to a repository, referencing another artifact. The `--artifact-type` provides for differentiating artifacts, similar to file extensions that enable different file types. One or more files can be attached by specifying `file:mediaType`.
157157

158158
```bash
159-
oras push $REGISTRY/$REPO \
160-
--artifact-type 'signature/example' \
161-
--subject $IMAGE \
162-
./signature.json:application/json
159+
oras attach $IMAGE \
160+
./signature.json:application/json \
161+
--artifact-type signature/example
163162
```
164163

165-
For more information on oras push, see [ORAS documentation][oras-push-docs].
164+
For more information on oras attach, see [ORAS documentation][oras-docs].
166165

167-
## Push a multi-file artifact as a reference
166+
## Attach a multi-file artifact as a reference
168167

169-
Create some documentation around an artifact
168+
Create some documentation around an artifact.
170169

171170
```bash
172171
echo 'Readme Content' > readme.md
173172
echo 'Detailed Content' > readme-details.md
174173
```
175174

176-
Push the multi-file artifact as a reference
175+
Attach the multi-file artifact as a reference.
177176

178177
```bash
179-
oras push $REGISTRY/$REPO \
180-
--artifact-type 'readme/example' \
181-
--subject $IMAGE \
178+
oras attach $IMAGE \
182179
./readme.md:application/markdown \
183180
./readme-details.md:application/markdown
181+
--artifact-type readme/example
184182
```
185183

186184
## Discovering artifact references
187185

188186
The ORAS Artifacts Specification defines a [referrers API][oras-artifacts-referrers] for discovering references to a `subject` artifact. The `oras discover` command can show the list of references to the container image.
189187

190-
Using `oras discover`, view the graph of artifacts now stored in the registry
188+
Using `oras discover`, view the graph of artifacts now stored in the registry.
191189

192190
```bash
193191
oras discover -o tree $IMAGE
194192
```
195193

196-
The output shows the beginning of a graph of artifacts, where the signature and docs are viewed as children of the container image
194+
The output shows the beginning of a graph of artifacts, where the signature and docs are viewed as children of the container image.
197195

198196
```output
199197
myregistry.azurecr.io/net-monitor:v1
@@ -213,13 +211,12 @@ The ORAS Artifacts specification enables deep graphs, enabling signed software b
213211
echo '{"version": "0.0.0.0", "artifact": "'${IMAGE}'", "contents": "good"}' > sbom.json
214212
```
215213

216-
### Push a sample SBoM to the registry
214+
### Attach a sample SBoM to the image in the registry
217215

218216
```bash
219-
oras push $REGISTRY/$REPO \
220-
--artifact-type 'sbom/example' \
221-
--subject $IMAGE \
222-
./sbom.json:application/json
217+
oras attach $IMAGE \
218+
./sbom.json:application/json \
219+
--artifact-type sbom/example
223220
```
224221

225222
### Sign the SBoM
@@ -229,21 +226,20 @@ Artifacts that are pushed as references, typically do not have tags as they are
229226
```bash
230227
SBOM_DIGEST=$(oras discover -o json \
231228
--artifact-type sbom/example \
232-
$IMAGE | jq -r ".references[0].digest")
229+
$IMAGE | jq -r ".referrers[0].digest")
233230
```
234231

235232
Create a signature of an SBoM
236233

237234
```bash
238-
echo '{"artifact": "'$REGISTRY/${REPO}@$SBOM_DIGEST'", "signature": "pat hancock"}' > sbom-signature.json
235+
echo '{"artifact": "'$IMAGE@$SBOM_DIGEST'", "signature": "pat hancock"}' > sbom-signature.json
239236
```
240237

241-
### Push the SBoM signature
238+
### Attach the SBoM signature
242239

243240
```bash
244-
oras push $REGISTRY/$REPO \
241+
oras attach $IMAGE@$SBOM_DIGEST \
245242
--artifact-type 'signature/example' \
246-
--subject $REGISTRY/$REPO@$SBOM_DIGEST \
247243
./sbom-signature.json:application/json
248244
```
249245

@@ -274,7 +270,7 @@ To pull a referenced type, the digest of reference is discovered with the `oras
274270
```bash
275271
DOC_DIGEST=$(oras discover -o json \
276272
--artifact-type 'readme/example' \
277-
$IMAGE | jq -r ".references[0].digest")
273+
$IMAGE | jq -r ".referrers[0].digest")
278274
```
279275

280276
### Create a clean directory for downloading
@@ -285,7 +281,7 @@ mkdir ./download
285281

286282
### Pull the docs into the download directory
287283
```bash
288-
oras pull -a -o ./download $REGISTRY/$REPO@$DOC_DIGEST
284+
oras pull -o ./download $REGISTRY/$REPO@$DOC_DIGEST
289285
```
290286
### View the docs
291287

@@ -313,7 +309,7 @@ A repository can have a list of manifests that are both tagged and untagged
313309
```azurecli
314310
az acr manifest list-metadata \
315311
--name $REPO \
316-
--repository $ACR_NAME \
312+
--registry $ACR_NAME \
317313
--output jsonc
318314
```
319315

@@ -379,16 +375,15 @@ az acr manifest list-metadata \
379375

380376
## Next steps
381377

382-
* Learn more about [the ORAS CLI](https://oras.land)
378+
* Learn more about [the ORAS CLI](https://oras.land/cli/)
383379
* Learn more about [ORAS Artifacts][oras-artifacts] for how to push, discover, pull, copy a graph of supply chain artifacts
384380

385381
<!-- LINKS - external -->
386382
[docker-linux]: https://docs.docker.com/engine/installation/#supported-platforms
387383
[docker-mac]: https://docs.docker.com/docker-for-mac/
388384
[docker-windows]: https://docs.docker.com/docker-for-windows/
389385
[oras-install-docs]: https://oras.land/cli/
390-
[oras-preview-install]: https://github.com/oras-project/oras/releases/tag/v0.2.1-alpha.1
391-
[oras-push-docs]: https://oras.land/cli/1_pushing/
386+
[oras-docs]: https://oras.land/
392387
[oras-artifacts]: https://github.com/oras-project/artifacts-spec/
393388
<!-- LINKS - internal -->
394389
[az-acr-repository-show]: /cli/azure/acr/repository?#az_acr_repository_show

0 commit comments

Comments
 (0)