Add Orbit package channels #2
No files matched your search
@@ -47,8 +47,7 @@ Because these are ordinary OCI artifacts, you can sign them with `cosign` or `no
|
||||
## Usage
|
||||
|
||||
```sh
|
||||
oras login git.site.latha.org # once, with a Gitea token
|
||||
orbit init git.site.latha.org/<owner> # Gitea: registry is <host>/<owner>
|
||||
oras login git.site.latha.org # once, with a Gitea token (needed to publish)
|
||||
eval "$(orbit env)"
|
||||
|
||||
orbit publish examples/hello
|
||||
@@ -59,6 +58,8 @@ orbit rollback hello
|
||||
orbit remove hello
|
||||
```
|
||||
|
||||
The default registry is `git.site.latha.org/nandi`, so no setup is needed. Override it for one command or shell with `ORBIT_REGISTRY=<host>/<owner>`, or save another one with `orbit init <registry>`. The order is `ORBIT_REGISTRY`, then the saved config, then the default. Orbit doesn't record which registry a package came from, so `upgrade` looks in whichever one is active.
|
||||
|
||||
Use `--plain-http` (or `ORBIT_PLAIN_HTTP=1`) for a local `registry:2` without TLS:
|
||||
|
||||
```sh
|
||||
@@ -88,8 +89,8 @@ package_dir=$(sh scripts/package-orbit.sh) &&
|
||||
_build/native/release/build/main/main.exe publish "$package_dir"
|
||||
```
|
||||
|
||||
This publishes to the configured registry, so run `orbit init <registry>` (or
|
||||
set `ORBIT_REGISTRY`) first and log in with `oras login <host>` if needed. The
|
||||
This publishes to the active registry (set `ORBIT_REGISTRY` to override the
|
||||
default), so log in with `oras login <host>` first if needed. The
|
||||
package contains a native Linux binary for the build machine's architecture.
|
||||
Use the same architecture on the install machine. `oras` and `tar` are still
|
||||
system prerequisites; the package does not bundle them.
|
||||
|
||||
+2
-1
@@ -5,7 +5,7 @@ let usage : String =
|
||||
#|orbit - packages as OCI artifacts (via oras)
|
||||
#|
|
||||
#|usage:
|
||||
#| orbit init <registry> [--plain-http] set registry, e.g. git.example.org/owner
|
||||
#| orbit init <registry> [--plain-http] save a different default registry
|
||||
#| orbit publish <dir> [--no-latest] push <dir>/orbit.json + <dir>/files/
|
||||
#| orbit install <name>[@constraint]... install with dependencies
|
||||
#| orbit remove <name>... [--force] remove, then drop unused dependencies
|
||||
@@ -20,6 +20,7 @@ let usage : String =
|
||||
#|
|
||||
#|constraints: 1.2.3 =1.2.3 1.2 ^1.2.0 ~1.2.0 >=1.2 *
|
||||
#|environment: ORBIT_ROOT (default ~/.orbit), ORBIT_REGISTRY, ORBIT_PLAIN_HTTP=1
|
||||
#|default registry: git.site.latha.org/nandi
|
||||
#|authentication: run `oras login <registry-host>` once.
|
||||
|
||||
///|
|
||||
|
||||
+23
-11
@@ -3,6 +3,9 @@
|
||||
///|
|
||||
const CONFIG_MEDIA_TYPE : String = "application/vnd.latha.orbit.config.v1+json"
|
||||
|
||||
///|
|
||||
const DEFAULT_REGISTRY : String = "git.site.latha.org/nandi"
|
||||
|
||||
///|
|
||||
const LAYER_MEDIA_TYPE : String = "application/vnd.latha.orbit.layer.v1.tar+gzip"
|
||||
|
||||
@@ -324,6 +327,18 @@ fn orbit_root() -> String {
|
||||
}
|
||||
}
|
||||
|
||||
///|
|
||||
/// ORBIT_REGISTRY wins, then config.json, then the built-in default.
|
||||
fn pick_registry(env : String, file : String) -> String {
|
||||
if env != "" {
|
||||
env
|
||||
} else if file != "" {
|
||||
file
|
||||
} else {
|
||||
DEFAULT_REGISTRY
|
||||
}
|
||||
}
|
||||
|
||||
///|
|
||||
/// Load config and state. ORBIT_REGISTRY / ORBIT_PLAIN_HTTP override the file.
|
||||
fn load_ctx() -> Ctx raise OrbitError {
|
||||
@@ -332,20 +347,10 @@ fn load_ctx() -> Ctx raise OrbitError {
|
||||
Some(t) => config_from_text(t)
|
||||
None => Config::{ registry: "", plain_http: false, }
|
||||
}
|
||||
let env_reg = getenv("ORBIT_REGISTRY")
|
||||
let cfg = Config::{
|
||||
registry: if env_reg != "" {
|
||||
env_reg
|
||||
} else {
|
||||
file_cfg.registry
|
||||
},
|
||||
registry: pick_registry(getenv("ORBIT_REGISTRY"), file_cfg.registry),
|
||||
plain_http: file_cfg.plain_http || getenv("ORBIT_PLAIN_HTTP") == "1",
|
||||
}
|
||||
if cfg.registry == "" {
|
||||
raise OrbitError(
|
||||
"no registry configured; run `orbit init <registry>` or set ORBIT_REGISTRY",
|
||||
)
|
||||
}
|
||||
let state = match read_text(root + "/state.json") {
|
||||
Some(t) => state_from_text(t)
|
||||
None => Map([])
|
||||
@@ -388,3 +393,10 @@ test "manifest roundtrip" {
|
||||
assert_true(!(valid_rel_path("/bin/sh")))
|
||||
assert_eq(store_id("sha256:0123456789abcdef0123"), "0123456789abcdef")
|
||||
}
|
||||
|
||||
///|
|
||||
test "registry precedence" {
|
||||
assert_eq(pick_registry("env/r", "file/r"), "env/r")
|
||||
assert_eq(pick_registry("", "file/r"), "file/r")
|
||||
assert_eq(pick_registry("", ""), DEFAULT_REGISTRY)
|
||||
}
|
||||
Reference in new issue
Block a user