Skip to content

Commit 42c88ad

Browse files
committed
Draft updates
Signed-off-by: Steve Lasker <[email protected]>
1 parent de3a32d commit 42c88ad

File tree

2 files changed

+57
-63
lines changed

2 files changed

+57
-63
lines changed

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

Lines changed: 52 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Push and pull OCI artifact
2+
title: Push and pull OCI artifact references
33
description: Push and pull Open Container Initiative (OCI) artifacts using a container registry in Azure
44
author: SteveLasker
55
manager: gwallace
@@ -8,7 +8,7 @@ ms.date: 01/03/2023
88
ms.author: stevelas
99
---
1010

11-
# Push and pull an OCI artifact using an Azure container registry
11+
# Push and pull OCI artifacts using an Azure container registry
1212

1313
You can use an Azure container registry to store and manage [Open Container Initiative (OCI) artifacts](container-registry-image-formats.md#oci-artifacts) as well as Docker and OCI container images.
1414

@@ -29,7 +29,7 @@ ACR_NAME=myregistry
2929
REGISTRY=$ACR_NAME.azurecr.io
3030
```
3131

32-
To create a new registry, see [Quickstart: Create a container registry using the Azure CLI][acr-create]
32+
To create a new registry, see [Quickstart: Create a container registry using the Azure CLI][az-acr-create]
3333
## Sign in to a registry
3434

3535
Authenticate with your [individual Azure AD identity](container-registry-authentication.md?tabs=azure-cli#individual-login-with-azure-ad) using an AD token. Always use "000..." for the `USER_NAME` as the token is parsed through the `PASSWORD` variable.
@@ -56,63 +56,26 @@ Provide the credentials to `oras login`.
5656
--password $PASSWORD
5757
```
5858

59-
### Sign in with ORAS
60-
61-
This section shows options to sign into the registry. Choose one method below appropriate for your environment.
62-
63-
Run `oras login` to authenticate with the registry. You may pass [registry credentials](container-registry-authentication.md) appropriate for your scenario, such as service principal credentials, user identity, or a repository-scoped token (preview).
59+
## Push a root artifact
6460

65-
- Authenticate with your [individual Azure AD identity](container-registry-authentication.md?tabs=azure-cli#individual-login-with-azure-ad) to use an AD token. Always use "000..." as the token is parsed through the `PASSWORD` variable.
61+
A root artifact is an artifact that has no `subject` parent. Root artifacts can be anything from a container image, a helm chart, a readme file for the repository. Reference artifacts, described later are artifacts that refer to another artifact. These can also be anything from a signature, software bill of materials, scan report or other evolving types.
6662

67-
```azurecli
68-
USER_NAME="00000000-0000-0000-0000-000000000000"
69-
PASSWORD=$(az acr login --name $ACR_NAME --expose-token --output tsv --query accessToken)
70-
```
71-
72-
- Authenticate with a [repository scoped token](container-registry-repository-scoped-permissions.md) (Preview) to use non-AD based tokens.
73-
74-
```azurecli
75-
USER_NAME="oras-token"
76-
PASSWORD=$(az acr token create -n $USER_NAME \
77-
-r $ACR_NAME \
78-
--repository $REPO content/write \
79-
--only-show-errors \
80-
--query "credentials.passwords[0].value" -o tsv)
81-
```
82-
83-
- Authenticate with an Azure Active Directory [service principal with pull and push permissions](container-registry-auth-service-principal.md#create-a-service-principal) (AcrPush role) to the registry.
84-
85-
```azurecli
86-
SERVICE_PRINCIPAL_NAME="oras-sp"
87-
ACR_REGISTRY_ID=$(az acr show --name $ACR_NAME --query id --output tsv)
88-
PASSWORD=$(az ad sp create-for-rbac --name $SERVICE_PRINCIPAL_NAME \
89-
--scopes $(az acr show --name $ACR_NAME --query id --output tsv) \
90-
--role acrpush \
91-
--query "password" --output tsv)
92-
USER_NAME=$(az ad sp list --display-name $SERVICE_PRINCIPAL_NAME --query "[].appId" --output tsv)
93-
```
94-
95-
Supply the credentials to `oras login` after authentication configured.
96-
97-
```bash
98-
oras login $REGISTRY \
99-
--username $USER_NAME \
100-
--password $PASSWORD
101-
```
102-
103-
To read the password from Stdin, use `--password-stdin`.
104-
105-
## Push an artifact
106-
107-
Create content that represents a markdown file:
63+
For this example, create content that represents a markdown file:
10864

10965
```bash
11066
echo 'Readme Content' > readme.md
11167
```
11268

113-
Use the `oras push` command to push the file to your registry.
69+
The following step pushes the `readme.md` file to `<myregistry>.azurecr.io/samples/artifact:readme`.
70+
- The registry is identified with the fully qualified registry name `<myregistry>.azurecr.io` (all lowercase) with the namespace and repo following: `/samples/artifact`.
71+
- The artifact is tagged `:readme`, to identify it uniquely from other artifacts listed in the repo (`:latest, :v1, :v1.0.1`).
72+
- The root artifact, an artifact that doesn't reference another, sets the type through the `-config` parameter.
73+
- `/dev/null` represents an empty config object, where the value `:readme/example` identifies the artifact type.
74+
- `:readme/example` differentiates it from a container images which use `application/vnd.oci.image.config.v1+json`.
75+
- The `./readme.md` identifies the file uploaded, and the `:application/markdown` represents the [IANA `mediaType`][iana-mediatypes] of the file.
76+
See [OCI Artifact Authors Guidance](https://github.com/opencontainers/artifacts/blob/main/artifact-authors.md) for additional information.
11477

115-
The following example pushes the `readme.md` file to the `samples/artifact` repo. The registry is identified with the fully qualified registry name `myregistry.azurecr.io` (all lowercase) with the namespace and repo following. The artifact is tagged `readme`, to identify it uniquely from other artifacts listed in the repo (`latest, v1, v1.0.1`). The type is set through the `-config` parameter. `/dev/null` represents an empty config object, where the `:readme/example` identifies the artifact type, differentiating it from a container images which use `application/vnd.oci.image.config.v1+json`. The `./readme.md` identifies the file uploaded, and the `:application/markdown` represents the IANA `mediaType` of the file. See [OCI Artifacts](https://github.com/opencontainers/artifacts/blob/main/artifact-authors.md) for additional information.
78+
Use the `oras push` command to push the file to your registry.
11679

11780
**Linux, WSL2 or macOS**
11881

@@ -125,7 +88,7 @@ oras push $REGISTRY/samples/artifact:readme \
12588
**Windows**
12689

12790
```cmd
128-
.\oras.exe push $REGISTRY/samples/artifact:1.0 ^
91+
.\oras.exe push $REGISTRY/samples/artifact:readme ^
12992
--config NUL:readme/example ^
13093
.\readme.md:application/markdown
13194
```
@@ -135,11 +98,40 @@ Output for a successful push is similar to the following:
13598
```console
13699
Uploading 2fdeac43552b readme.md
137100
Uploaded 2fdeac43552b readme.md
138-
Pushed demo42.azurecr.io/samples/artifact:readme
101+
Pushed <myregistry>.azurecr.io/samples/artifact:readme
139102
Digest: sha256:e2d60d1b171f08bd10e2ed171d56092e39c7bac1aec5d9dcf7748dd702682d53
140103
```
141104

142-
## Pull an artifact
105+
## Push a multi-file root artifact
106+
107+
Create some documentation around an artifact.
108+
109+
```bash
110+
echo 'Readme Content' > readme.md
111+
echo 'Detailed Content' > readme-details.md
112+
```
113+
114+
Attach the multi-file artifact as a reference.
115+
116+
**Linux, WSL2 or macOS**
117+
118+
```bash
119+
oras push $REGISTRY/samples/artifact:readme \
120+
--config /dev/null:readme/example\
121+
./readme.md:application/markdown\
122+
./readme-details.md:application/markdown
123+
```
124+
125+
**Windows**
126+
127+
```cmd
128+
.\oras.exe push $REGISTRY/samples/artifact:readme ^
129+
--config NUL:readme/example ^
130+
.\readme.md:application/markdown ^
131+
.\readme-details.md:application/markdown
132+
```
133+
134+
## Pull a root artifact
143135

144136
Create a clean directory for downloading
145137

@@ -171,13 +163,13 @@ az acr repository delete \
171163

172164
## Next steps
173165

174-
* Learn more about [the ORAS Library](https://github.com/deislabs/oras), including how to configure a manifest for an artifact
166+
* Learn more about [the ORAS Project](https://oras.land/), including how to configure a manifest for an artifact
175167
* Visit the [OCI Artifacts](https://github.com/opencontainers/artifacts) repo for reference information about new artifact types
176168

177169
<!-- LINKS - external -->
178-
170+
[iana-mediatypes]: https://www.rfc-editor.org/rfc/rfc6838
179171
<!-- LINKS - internal -->
180-
[acr-authentication]: /articles/container-registry/container-registry-authentication.md?tabs=azure-cli
181-
[az-acr-repository-show]: /cli/azure/acr/repository?#az_acr_repository_show
172+
[acr-authentication]: /articles/container-registry/container-registry-authentication.md?tabs=azure-cli
173+
[az-acr-create]: /container-registry/container-registry-get-started-azure-cli
174+
[az-acr-repository-show]: /cli/azure/acr/repository?#az_acr_repository_show
182175
[az-acr-repository-delete]: /cli/azure/acr/repository#az_acr_repository_delete
183-
[acr-create]: /container-registry/container-registry-get-started-azure-cli

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ TAG=v1
4242
IMAGE=$REGISTRY/${REPO}:$TAG
4343
```
4444

45-
To create a new registry, see [Quickstart: Create a container registry using the Azure CLI][acr-create]
45+
To create a new registry, see [Quickstart: Create a container registry using the Azure CLI][az-acr-create]
4646

4747
Authenticate with your [individual Azure AD identity](container-registry-authentication.md?tabs=azure-cli#individual-login-with-azure-ad) using an AD token. Always use "000..." for the `USER_NAME` as the token is parsed through the `PASSWORD` variable.
4848

@@ -319,6 +319,8 @@ az acr manifest list-metadata \
319319
[oci-1_1-spec]: https://github.com/opencontainers/distribution-spec/releases/tag/v1.1.0-rc1
320320

321321
<!-- LINKS - internal -->
322-
[az-acr-build]: /cli/azure/acr#az_acr_build
323-
[az-acr-repository-show]: /cli/azure/acr/repository?#az_acr_repository_show
322+
[acr-authentication]: /articles/container-registry/container-registry-authentication.md?tabs=azure-cli
323+
[az-acr-create]: /container-registry/container-registry-get-started-azure-cli
324+
[az-acr-build]: /cli/azure/acr#az_acr_build
325+
[az-acr-repository-show]: /cli/azure/acr/repository?#az_acr_repository_show
324326
[az-acr-repository-delete]: /cli/azure/acr/repository#az_acr_repository_delete

0 commit comments

Comments
 (0)