-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
554 additions
and
341 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stderr", | ||
"output_type": "stream", | ||
"text": [ | ||
"DEBUG:oras.logger:Preparing layer {'mediaType': 'application/vnd.oci.image.layer.v1.tar', 'size': 164, 'digest': 'sha256:7f52942f815315896486adb3dd78f80d31a3269292eea67cf09d49ec3593c516', 'annotations': {'org.opencontainers.image.title': 'artifact.txt'}}\n", | ||
"DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): ghcr.io:443\n", | ||
"DEBUG:urllib3.connectionpool:https://ghcr.io:443 \"POST /v2/tarilabs/demo20240629-oras147/blobs/uploads/ HTTP/11\" 401 120\n", | ||
"DEBUG:oras.logger:requesting auth token\n", | ||
"DEBUG:oras.logger:Service: ghcr.io\n", | ||
"DEBUG:oras.logger:Scope: repository:tarilabs/demo20240629-oras147:pull\n", | ||
"DEBUG:urllib3.connectionpool:https://ghcr.io:443 \"GET /token?service=ghcr.io&scope=repository%3Atarilabs%2Fdemo20240629-oras147%3Apull HTTP/11\" 200 69\n", | ||
"DEBUG:urllib3.connectionpool:https://ghcr.io:443 \"POST /v2/tarilabs/demo20240629-oras147/blobs/uploads/ HTTP/11\" 202 0\n", | ||
"DEBUG:urllib3.connectionpool:https://ghcr.io:443 \"PUT /v2/tarilabs/demo20240629-oras147/blobs/upload/81249a9b-be05-4403-a8d0-a29e1f1873c0?digest=sha256%3A7f52942f815315896486adb3dd78f80d31a3269292eea67cf09d49ec3593c516 HTTP/11\" 201 0\n", | ||
"DEBUG:oras.logger:Preparing config {'mediaType': 'application/vnd.unknown.config.v1+json', 'size': 2, 'digest': 'sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a'}\n", | ||
"DEBUG:urllib3.connectionpool:https://ghcr.io:443 \"POST /v2/tarilabs/demo20240629-oras147/blobs/uploads/ HTTP/11\" 202 0\n", | ||
"DEBUG:urllib3.connectionpool:https://ghcr.io:443 \"PUT /v2/tarilabs/demo20240629-oras147/blobs/upload/6dd58b23-7cd9-42fc-8630-4fe3551b0b61?digest=sha256%3A44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a HTTP/11\" 201 0\n", | ||
"DEBUG:urllib3.connectionpool:https://ghcr.io:443 \"PUT /v2/tarilabs/demo20240629-oras147/manifests/latest HTTP/11\" 201 0\n" | ||
] | ||
}, | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"Successfully pushed ghcr.io/tarilabs/demo20240629-oras147:latest\n" | ||
] | ||
}, | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"<Response [201]>" | ||
] | ||
}, | ||
"execution_count": 1, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"import requests\n", | ||
"import logging\n", | ||
"\n", | ||
"TRACE=False\n", | ||
"if TRACE:\n", | ||
" import http.client as http_client\n", | ||
" http_client.HTTPConnection.debuglevel = 1\n", | ||
"\n", | ||
"logging.basicConfig()\n", | ||
"logging.getLogger().setLevel(logging.DEBUG)\n", | ||
"requests_log = logging.getLogger(\"requests.packages.urllib3\")\n", | ||
"requests_log.setLevel(logging.DEBUG)\n", | ||
"requests_log.propagate = True\n", | ||
"\n", | ||
"import oras.client\n", | ||
"\n", | ||
"client = oras.client.OrasClient()\n", | ||
"# skipping client.login() for my ...: using already-stored credentials from ~/.docker/config.json\n", | ||
"client.push(files=[\"artifact.txt\"], target=\"ghcr.io/tarilabs/demo20240629-oras147\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stderr", | ||
"output_type": "stream", | ||
"text": [ | ||
"DEBUG:urllib3.connectionpool:https://ghcr.io:443 \"GET /v2/tarilabs/demo20240629-oras147/manifests/latest HTTP/11\" 200 495\n", | ||
"DEBUG:urllib3.connectionpool:https://ghcr.io:443 \"GET /v2/tarilabs/demo20240629-oras147/blobs/sha256:7f52942f815315896486adb3dd78f80d31a3269292eea67cf09d49ec3593c516 HTTP/11\" 307 0\n", | ||
"DEBUG:urllib3.connectionpool:https://pkg-containers.githubusercontent.com:443 \"GET /ghcr1/blobs/sha256:7f52942f815315896486adb3dd78f80d31a3269292eea67cf09d49ec3593c516?se=2024-09-23T10%3A45%3A00Z&sig=R9fkb8mRtd9NfFlcvBOmfMP7VG23sTDkTkRkv2GhKAo%3D&sp=r&spr=https&sr=b&sv=2019-12-12 HTTP/11\" 200 164\n", | ||
"INFO:oras.logger:Successfully pulled /Users/mmortari/git/demo20240629-oras147-testregistries/tmp/ghcrio/artifact.txt.\n" | ||
] | ||
}, | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"This is the content of the file artifact.txt\n", | ||
"\n", | ||
"Using this file just to store some asset as OCI artifact\n", | ||
"\n", | ||
"If you are seeing this, this is the content of artifact.txt\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"!rm -rf tmp/ghcrio\n", | ||
"client.pull(\"ghcr.io/tarilabs/demo20240629-oras147\", outdir=\"tmp/ghcrio\")\n", | ||
"!cat tmp/ghcrio/artifact.txt" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "demo20240629-oras147-testregistries-Ja2Z1fe0-py3.10", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.10.13" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.