This also includes a new `login` command. The signing and CI logic is now using the Driver trait system along with a new experimental sigstore signing driver. New static macros have also been created to make implementation management easier for `Command` usage and `Driver` trait implementation calls. --------- Co-authored-by: xyny <60004820+xynydev@users.noreply.github.com>
26 lines
622 B
Rust
26 lines
622 B
Rust
use blue_build_utils::constants::IMAGE_VERSION_LABEL;
|
|
use serde::Deserialize;
|
|
use serde_json::Value;
|
|
use std::collections::HashMap;
|
|
|
|
#[derive(Deserialize, Debug, Clone)]
|
|
pub struct ImageMetadata {
|
|
#[serde(alias = "Labels")]
|
|
pub labels: HashMap<String, Value>,
|
|
|
|
#[serde(alias = "Digest")]
|
|
pub digest: String,
|
|
}
|
|
|
|
impl ImageMetadata {
|
|
#[must_use]
|
|
pub fn get_version(&self) -> Option<u64> {
|
|
Some(
|
|
self.labels
|
|
.get(IMAGE_VERSION_LABEL)?
|
|
.as_str()
|
|
.and_then(|v| lenient_semver::parse(v).ok())?
|
|
.major,
|
|
)
|
|
}
|
|
}
|