Skip to content

Commit

Permalink
feat(reference): Add clone_with_digest() function
Browse files Browse the repository at this point in the history
This allows to create a copy of the reference but setting a new digest.
This also copies the registry_mirror, so the digest also gets pulled
from the same mirror.

Signed-off-by: Benjamin Neff <[email protected]>
Signed-off-by: Colin Walters <[email protected]>
  • Loading branch information
SuperTux88 authored and cgwalters committed Aug 30, 2024
1 parent bc1f58c commit 1d5d17e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/distribution/reference.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,17 @@ impl Reference {
}
}

/// Clone the Reference for the same image with a new digest.
pub fn clone_with_digest(&self, digest: String) -> Self {
Self {
registry: self.registry.clone(),
mirror_registry: self.mirror_registry.clone(),
repository: self.repository.clone(),
tag: None,
digest: Some(digest),
}
}

/// Set a pull mirror registry for this reference.
///
/// The mirror registry will be used to resolve the image, the original registry
Expand Down

0 comments on commit 1d5d17e

Please sign in to comment.