Replace oras with native OCI registry client and add login
- Talk to OCI Distribution v2 registries directly over HTTP/TLS; oras is no longer required on PATH - Add `orbit login <host>` and `orbit logout <host>`; credentials go to $ORBIT_ROOT/auth.json (mode 0600) - Fall back to Docker config (credHelpers and credsStore) when no Orbit credentials exist - Verify layer downloads with streaming SHA-256 - Fall back to the next channel only on HTTP 404 instead of matching oras error text - Update README and moon.mod to drop oras references
This commit is contained in:
1 parent
f8c9b99ee3
commit
0919ce105c
13 files changed
+2652
-184
No files matched your search
+8
-13
@@ -230,7 +230,7 @@ async fn link_bins(
|
||||
dir : String,
|
||||
bins : Array[String],
|
||||
) -> Unit raise OrbitError {
|
||||
@fs.mkdir(bin_dir(ctx), recursive=true) catch {
|
||||
@fs.mkdir(bin_dir(ctx), recursive=true, allow_exist=true) catch {
|
||||
e => raise OrbitError("cannot create bin dir: " + e.to_string())
|
||||
}
|
||||
for b in bins {
|
||||
@@ -681,18 +681,16 @@ fn orbit_info(text : String) -> RepoInfo? {
|
||||
/// Any failure counts as "not an Orbit package", so one broken repo can't hide
|
||||
/// the others.
|
||||
async fn orbit_repo_info(ch : Channel, repo : String) -> RepoInfo? noraise {
|
||||
let tags = lines(capture(oras(ch, "repo tags " + sq(repo_of(ch, repo))))) catch {
|
||||
_ => return None
|
||||
let tags = match
|
||||
(list_tags_quiet(ch, repo) catch { _ => return None }) {
|
||||
Some(ts) => ts
|
||||
None => return None
|
||||
}
|
||||
if tags.length() == 0 {
|
||||
return None
|
||||
}
|
||||
let tag = if tags.contains("latest") { "latest" } else { tags[0] }
|
||||
let text = capture(
|
||||
oras(ch, "manifest fetch " + sq(repo_of(ch, repo) + ":" + tag)),
|
||||
) catch {
|
||||
_ => return None
|
||||
}
|
||||
let text = fetch_raw_manifest(ch, repo, tag) catch { _ => return None }
|
||||
orbit_info(text)
|
||||
}
|
||||
|
||||
@@ -789,10 +787,7 @@ async fn cmd_search(ctx : Ctx, term : String) -> Unit raise OrbitError {
|
||||
]
|
||||
let mut listed = 0
|
||||
for ch in ctx.channels {
|
||||
let out = capture(
|
||||
oras(ch, "repo ls " + sq(ch.url)),
|
||||
progress="Listing packages in \{ch.name}",
|
||||
) catch {
|
||||
let repos = list_repos(ch) catch {
|
||||
_ => {
|
||||
println("warning: channel '\{ch.name}' does not allow listing packages")
|
||||
continue
|
||||
@@ -800,7 +795,7 @@ async fn cmd_search(ctx : Ctx, term : String) -> Unit raise OrbitError {
|
||||
}
|
||||
listed = listed + 1
|
||||
let candidates : Array[String] = []
|
||||
for r in lines(out) {
|
||||
for r in repos {
|
||||
// A name with "/" is a nested channel namespace (e.g. example/greet under
|
||||
// main), not a package name that `orbit install` could use.
|
||||
if valid_name(r) && contains_str(r, term) {
|
||||
|
||||
Reference in new issue
Block a user