Skip to content

Commit

Permalink
chore(oci): api updates per oci-distribution crate rev
Browse files Browse the repository at this point in the history
Signed-off-by: Vaughn Dice <[email protected]>
  • Loading branch information
vdice committed Apr 2, 2024
1 parent 3871196 commit dd0978b
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 30 deletions.
105 changes: 83 additions & 22 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions crates/oci/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ docker_credential = "1.0"
dirs = "4.0"
futures-util = "0.3"
itertools = "0.12.1"
# TODO: use commit from fermyon/oci-distribution once required changes are in
oci-distribution = { git = "https://github.com/vdice/oci-distribution", rev = "36b987cf433d25d968a717294fd07f3d6087869c" }
oci-distribution = { git = "https://github.com/fermyon/oci-distribution", rev = "7e4ce9be9bcd22e78a28f06204931f10c44402ba" }
reqwest = "0.11"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
Expand Down
10 changes: 4 additions & 6 deletions crates/oci/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ impl Client {
// Assume that these bytes may represent the locked app config and write it as such.
let mut cfg_bytes = Vec::new();
self.oci
.pull_blob(&reference, &manifest.config.digest, &mut cfg_bytes)
.pull_blob(&reference, &manifest.config, &mut cfg_bytes)
.await?;
self.write_locked_app_config(&reference.to_string(), &cfg_bytes)
.await
Expand All @@ -391,9 +391,7 @@ impl Client {

tracing::debug!("Pulling layer {}", &layer.digest);
let mut bytes = Vec::with_capacity(layer.size.try_into()?);
this.oci
.pull_blob(&reference, &layer.digest, &mut bytes)
.await?;
this.oci.pull_blob(&reference, &layer, &mut bytes).await?;
match layer.media_type.as_str() {
SPIN_APPLICATION_MEDIA_TYPE => {
this.write_locked_app_config(&reference.to_string(), &bytes)
Expand Down Expand Up @@ -569,13 +567,13 @@ impl Client {
}

/// Insert a token in the OCI client token cache.
pub fn insert_token(
pub async fn insert_token(
&mut self,
reference: &Reference,
op: RegistryOperation,
token: RegistryTokenType,
) {
self.oci.tokens.insert(reference, op, token);
self.oci.tokens.insert(reference, op, token).await;
}

/// Validate the credentials by attempting to send an authenticated request to the registry.
Expand Down

0 comments on commit dd0978b

Please sign in to comment.