Skip to content

Commit fe953a9

Browse files
committed
Complete draft
Signed-off-by: Steve Lasker <[email protected]>
1 parent 76e60e1 commit fe953a9

File tree

2 files changed

+69
-30
lines changed

2 files changed

+69
-30
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ To demonstrate this capability, this article shows how to use the [OCI Registry
1616

1717
## Prerequisites
1818

19-
* **Azure container registry** - Create a container registry in your Azure subscription. For example, use the [Azure portal](container-registry-get-started-portal.md) or the [Azure CLI](container-registry-get-started-azure-cli.md).
19+
* **Azure container registry** - Create a container registry in your Azure subscription. For example, use the [Azure portal](container-registry-get-started-portal.md) or the [Azure CLI][az-acr-create].
2020
* **Azure CLI** - Version `2.29.1` or later is recommended. Run `az --version `to find the required. If you need to install or upgrade, see [Install Azure CLI](/cli/azure/install-azure-cli).
2121
* **ORAS CLI** - Download and install the ORAS CLI `v0.16.0` for your operating system from the [ORAS installation guide](https://oras.land/cli/).
22-
* **Docker** - ORAS leverages the Docker desktop credential store for authentication. You can use [Docker installed locally][docker-install] to build and push a container image, reference an existing container image or use [ACR Build][az-acr-build] to build remotely, in Azure.
22+
* **Docker** - ORAS optionally leverages the Docker desktop credential store for authentication.
23+
If Docker Desktop is installed, it must be running.
24+
You can use [Docker installed locally][docker-install] to build and push a container image, reference an existing container image or use [ACR Build][az-acr-build] to build remotely, in Azure.
2325

2426
## Configure a registry
2527

@@ -108,7 +110,7 @@ Digest: sha256:e2d60d1b171f08bd10e2ed171d56092e39c7bac1aec5d9dcf7748dd702682d53
108110
When OCI artifacts are pushed to a registry with ORAS, each file reference is pushed as a blob. To push separate blobs, reference the files individually, or collection of files by referencing a directory.
109111
For more information how to push a collection of files, see [Pushing artifacts with multiple files][oras-push-multifiles]
110112

111-
Create some documentation around an artifact.
113+
Create some documentation for the repository:
112114

113115
```bash
114116
echo 'Readme Content' > readme.md
@@ -199,8 +201,7 @@ oras pull -o ./download $REGISTRY/samples/artifact:readme
199201
### View the pulled files
200202

201203
```bash
202-
ls ./download
203-
ls ./download/details
204+
tree ./download
204205
```
205206

206207
## Remove the artifact (optional)
@@ -226,5 +227,4 @@ az acr repository delete \
226227
[acr-landing]: https://aka.ms/acr
227228
[acr-authentication]: /azure/container-registry/container-registry-authentication?tabs=azure-cli
228229
[az-acr-create]: /container-registry/container-registry-get-started-azure-cli
229-
[az-acr-repository-show]: /cli/azure/acr/repository?#az_acr_repository_show
230230
[az-acr-repository-delete]: /cli/azure/acr/repository#az_acr_repository_delete

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

Lines changed: 63 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,22 @@ Use an Azure container registry to store and manage a graph of supply chain arti
1515

1616
![Graph of artifacts, including a container image, signature and signed software bill of materials](./media/container-registry-artifacts/oras-artifact-graph.svg)
1717

18-
To demonstrate this capability, this article shows how to use the [OCI Registry as Storage (ORAS)](https://oras.land) CLI to push and pull a graph of supply chain artifacts to an Azure container registry.
18+
To demonstrate this capability, this article shows how to use the [OCI Registry as Storage (ORAS)](https://oras.land) CLI to `push`, `discover` and `pull` a graph of supply chain artifacts to an Azure container registry.
1919

20-
Storing individual OCI Artifacts are covered in [Push and pull OCI artifact](container-registry-oci-artifacts.md). To store a graph of artifacts, a reference to a `subject` artifact is defined using the [OCI Artifact Manifest][oci-artifact-manifest], which is part of the [pre-release OCI 1.1 Distribution specification][oci-1_1-spec]. OCI Artifact Manifest support is a preview feature and subject to [limitations](#preview-limitations).
20+
Storing individual (root) OCI Artifacts are covered in [Push and pull OCI artifact](container-registry-oci-artifacts.md).
21+
To store a graph of artifacts, a reference to a `subject` artifact is defined using the [OCI Artifact Manifest][oci-artifact-manifest], which is part of the [pre-release OCI 1.1 Distribution specification][oci-1_1-spec].
22+
OCI 1.1 Artifact Manifest support is a preview feature and subject to [limitations](#preview-limitations).
2123

2224
## Prerequisites
2325

24-
* **Azure container registry** - Create a container registry in your Azure subscription. For example, use the [Azure portal](container-registry-get-started-portal.md) or the [Azure CLI](container-registry-get-started-azure-cli.md).
26+
* **Azure container registry** - Create a container registry in your Azure subscription. For example, use the [Azure portal](container-registry-get-started-portal.md) or the [Azure CLI][az-acr-create].
2527
* **Azure CLI** - Version `2.29.1` or later is recommended. Run `az --version `to find the required. If you need to install or upgrade, see [Install Azure CLI](/cli/azure/install-azure-cli).
26-
* **ORAS CLI** - Download and install the ORAS CLI `v0.16.0` for your operating system from the [ORAS installation guide](https://oras.land/cli/).
27-
* **Docker (optional)** - To complete the walkthrough, a container image is referenced. You can use [Docker installed locally][docker-install] to build and push a container image, reference an existing container image or use [ACR Build][az-acr-build] to build remotely, in Azure.
28+
* **ORAS CLI** - Download and install the ORAS CLI `v0.16.0` for your operating system from the [ORAS installation guide][oras-install-docs].
29+
* **Docker** - ORAS optionally leverages the Docker desktop credential store for authentication.
30+
If Docker Desktop is installed, it must be running.
31+
To complete the walkthrough, a container image is referenced.
32+
You can use [Docker installed locally][docker-install] to build and push a container image, reference an existing container image or use [ACR Build][az-acr-build] to build remotely, in Azure.
33+
You can use [Docker installed locally][docker-install] to build and push a container image, reference an existing container image or use [ACR Build][az-acr-build] to build remotely, in Azure.
2834

2935
## Preview limitations
3036

@@ -68,7 +74,9 @@ Provide the credentials to `oras login`.
6874

6975
## Push a container image
7076

71-
This example associates a graph of artifacts to a container image. Build and push a container image, or reference an existing image in the registry.
77+
This example associates a graph of artifacts to a container image.
78+
79+
Build and push a container image, or skip this step if `$IMAGE` references an existing image in the registry.
7280

7381
```bash
7482
az acr build -r $ACR_NAME -t $IMAGE https://github.com/wabbit-networks/net-monitor.git#main
@@ -82,37 +90,42 @@ echo '{"artifact": "'${IMAGE}'", "signature": "pat hancock"}' > signature.json
8290

8391
### Attach a signature to the registry, as a reference to the container image
8492

85-
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`.
93+
The `oras attach` command creates a reference between the file (`./signature.json`) to the `$IMAGE`. 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]`.
8694

8795
```bash
8896
oras attach $IMAGE \
89-
./signature.json:application/json \
90-
--artifact-type signature/example
97+
--artifact-type signature/example \
98+
./signature.json:application/json
9199
```
92100

93101
For more information on oras attach, see [ORAS documentation][oras-docs].
94102

95103
## Attach a multi-file artifact as a reference
96104

97-
Create some documentation around an artifact.
105+
When OCI artifacts are pushed to a registry with ORAS, each file reference is pushed as a blob. To push separate blobs, reference the files individually, or collection of files by referencing a directory.
106+
For more information how to push a collection of files, see [Pushing artifacts with multiple files][oras-push-multifiles]
107+
108+
Create some documentation around an artifact:
98109

99110
```bash
100111
echo 'Readme Content' > readme.md
101-
echo 'Detailed Content' > readme-details.md
112+
mkdir details/
113+
echo 'Detailed Content' > details/readme-details.md
114+
echo 'More detailed Content' > details/readme-more-details.md
102115
```
103116

104-
Attach the multi-file artifact as a reference.
117+
Attach the multi-file artifact as a reference to `$IMAGE`:
105118

106119
```bash
107120
oras attach $IMAGE \
121+
--artifact-type readme/example\
108122
./readme.md:application/markdown \
109-
./readme-details.md:application/markdown \
110-
--artifact-type readme/example
123+
./details
111124
```
112125

113126
## Discovering artifact references
114127

115-
The [OCI v1.1 Specification][oci-spec] defines a [referrers API][oci-artifacts-referrers] for discovering references to a `subject` artifact. The `oras discover` command can show the list of references to the container image.
128+
The [OCI v1.1 Specification][oci-spec] defines a [referrers API][oci-artifact-referrers] for discovering references to a `subject` artifact. The `oras discover` command can show the list of references to the container image.
116129

117130
Using `oras discover`, view the graph of artifacts now stored in the registry.
118131

@@ -192,14 +205,34 @@ myregistry.azurecr.io/net-monitor:v1
192205
└── sha256:a31ab875d37eee1cca68dbb14b2009979d05594d44a075bdd7...
193206
```
194207

208+
## Promote the graph
209+
210+
Workflows promote artifacts from `dev` through staging, to production environment, or consume public content to privately secured environments.
211+
In either case you'll want to promote the signatures, SBOMs, scan results and other related artifact with the root artifact.
212+
213+
Using the `oras copy` command, users can promote the graph or filtered artifacts across registries or across repos within the same registry.
214+
215+
Copy the `sample/net-monitor:v1` image, and it's related artifacts to `sample-staging/net-monitor:v1`:
216+
217+
```bash
218+
TARGET_REPO=$REGISTRY/sample-staging/$REPO
219+
oras copy -r $IMAGE $TARGET_REPO:$TAG
220+
```
221+
222+
## Discover the promoted artifact graph
223+
224+
```bash
225+
oras discover -o tree $TARGET_REPO:$TAG
226+
```
227+
195228
## Pull a referenced artifact
196229

197230
To pull a referenced type, the digest of reference is discovered with the `oras discover` command
198231

199232
```bash
200233
DOC_DIGEST=$(oras discover -o json \
201234
--artifact-type 'readme/example' \
202-
$IMAGE | jq -r ".manifests[0].digest")
235+
$TARGET | jq -r ".manifests[0].digest")
203236
```
204237

205238
### Create a clean directory for downloading
@@ -209,13 +242,15 @@ mkdir ./download
209242
```
210243

211244
### Pull the docs into the download directory
245+
212246
```bash
213-
oras pull -o ./download $REGISTRY/$REPO@$DOC_DIGEST
247+
oras pull -o ./download $TARGET_REPO@$DOC_DIGEST
214248
```
249+
215250
### View the docs
216251

217252
```bash
218-
ls ./download
253+
tree ./download
219254
```
220255

221256
## View the repository and tag listing
@@ -283,6 +318,7 @@ The signature is untagged, but tracked as a `oras.artifact.manifest` reference t
283318
"mediaType": "application/vnd.cncf.oras.artifact.manifest.v1+json"
284319
}
285320
```
321+
286322
## Delete all artifacts in the graph
287323

288324
Support for the OCI v1.1 Specification enables deleting the graph of artifacts associated with the root artifact. Use the [az acr repository delete][az-acr-repository-delete] command to delete the signature, SBoM and the signature of the SBoM.
@@ -291,15 +327,18 @@ Support for the OCI v1.1 Specification enables deleting the graph of artifacts a
291327
az acr repository delete \
292328
-n $ACR_NAME \
293329
-t ${REPO}:$TAG -y
330+
331+
az acr repository delete \
332+
-n $ACR_NAME \
333+
-t sample-staging/${REPO}:$TAG -y
294334
```
295335

296336
### View the remaining manifests
297337

298338
```azurecli
299339
az acr manifest list-metadata \
300340
--name $REPO \
301-
--registry $ACR_NAME \
302-
--detail -o jsonc
341+
--registry $ACR_NAME -o jsonc
303342
```
304343

305344
## Next steps
@@ -309,16 +348,16 @@ az acr manifest list-metadata \
309348

310349
<!-- LINKS - external -->
311350
[docker-install]: https://www.docker.com/get-started/
312-
[oras-install-docs]: https://oras.land/cli/
313-
[oras-docs]: https://oras.land/
314-
[oci-artifacts-referrers]: https://github.com/opencontainers/distribution-spec/blob/main/spec.md#listing-referrers/
315351
[oci-artifact-manifest]: https://github.com/opencontainers/image-spec/blob/main/artifact.md/
352+
[oci-artifact-referrers]: https://github.com/opencontainers/distribution-spec/blob/main/spec.md#listing-referrers/
316353
[oci-spec]: https://github.com/opencontainers/distribution-spec/blob/main/spec.md/
317354
[oci-1_1-spec]: https://github.com/opencontainers/distribution-spec/releases/tag/v1.1.0-rc1
355+
[oras-docs]: https://oras.land/
356+
[oras-install-docs]: https://oras.land/cli/
357+
[oras-push-multifiles]: https://oras.land/cli/1_pushing/#pushing-artifacts-with-multiple-files
318358

319359
<!-- LINKS - internal -->
320360
[acr-authentication]: /azure/container-registry/container-registry-authentication?tabs=azure-cli
321361
[az-acr-create]: /container-registry/container-registry-get-started-azure-cli
322362
[az-acr-build]: /cli/azure/acr#az_acr_build
323-
[az-acr-repository-show]: /cli/azure/acr/repository?#az_acr_repository_show
324363
[az-acr-repository-delete]: /cli/azure/acr/repository#az_acr_repository_delete

0 commit comments

Comments
 (0)