termoshtt / ocipkg

An OCI registry client for Rust desiged to use distribute static library as a "container"
Apache License 2.0
48 stars 8 forks source link

Anonymous pull from ghcr.io #41

Closed termoshtt closed 2 years ago

termoshtt commented 2 years ago

Build of examples/rust-exe fails:

Caused by:
  process didn't exit successfully: `/home/user/github.com/termoshtt/ocipkg/examples/rust-exe/target/debug/build/ocipkg-exe-example-8b1f8b360a9de191/build-script-build` (exit status: 101)
  --- stderr
  thread 'main' panicked at 'Failed to get image: RegistryError(ErrorResponse { errors: [ErrorInfo { code: Unauthorized, message: Some("authentication required"), detail: None }] })', /home/user/github.com/termoshtt/ocipkg/src/lib.rs:29:18
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

This will be resolved by #18, but it should be able to pull the container anonymously.

termoshtt commented 2 years ago

ghcr.io returns www-authebticate header, which requests to client(ocipkg) to get token based on OAuth protocol.

termoshtt commented 2 years ago

Authentication issue will be tackled in #18. This issue focuses on anonymous pull

termoshtt commented 2 years ago

Token for pulling ghcr.io/termoshtt/ocipkg/dynamic/rust:6f9b7aa image can be obtained by following:

curl -sfL "https://ghcr.io/token?service=ghcr.io&scope=repository:termoshtt/ocipkg/dynamic/rust:pull"

Current (0.2.5) implementation does not set scope correctly.