pub struct EvidenceProvenance {
pub producer: Option<EvidenceProducer>,
pub commit: String,
pub working_tree: TreeState,
pub excluded: Vec<String>,
pub measured_at: Option<String>,
pub toolchain: Option<EvidenceToolchain>,
pub recorder: Option<String>,
pub report: Option<EvidenceReportArtifact>,
pub host: Option<EvidenceHost>,
pub run: Option<RunRef>,
}Expand description
What a run measured about its own checkout when it ended.
Only commit and working_tree are required: a producing job’s tree file
({"commit","working_tree","excluded"}) is a valid, minimal measurement. It names no
report, so it is accepted only for a CI recording.
use majordomus_cli::evidence::{EvidenceProvenance, TreeState};
let head = "0123456789abcdef0123456789abcdef01234567";
let p: EvidenceProvenance = serde_json::from_value(serde_json::json!({
"commit": head, "working_tree": "clean", "excluded": ["suite.tsv"]
})).unwrap();
assert_eq!(p.working_tree, TreeState::Clean);
assert!(p.report.is_none());Fields§
§producer: Option<EvidenceProducer>Which report this measures, when named.
commit: StringThe full commit the checkout was at.
working_tree: TreeStateThe tree, the evidence ledger ignored and the run’s own untracked outputs excluded.
excluded: Vec<String>The run’s own untracked outputs that were excluded, the report among them when it is inside the checkout. The ledger is always ignored and not listed.
measured_at: Option<String>When it was measured, RFC 3339 UTC.
toolchain: Option<EvidenceToolchain>The producer’s toolchain.
recorder: Option<String>The version of the executable that measured.
report: Option<EvidenceReportArtifact>The report measured.
host: Option<EvidenceHost>The machine.
run: Option<RunRef>The CI run, when there was one.
Implementations§
Source§impl EvidenceProvenance
impl EvidenceProvenance
Sourcepub fn read(path: &Path) -> Result<EvidenceProvenance, String>
pub fn read(path: &Path) -> Result<EvidenceProvenance, String>
The measurement a file holds, or why it holds none: an unreadable file, bad JSON, an unknown field or a tree word that is not one, each naming the file.
use majordomus_cli::evidence::EvidenceProvenance;
let dir = tempfile::tempdir().unwrap();
let f = dir.path().join("p.json");
std::fs::write(&f, r#"{"commit":"c","working_tree":"clean","extra":1}"#).unwrap();
assert!(EvidenceProvenance::read(&f).unwrap_err().contains("p.json"));Sourcepub fn resolve(
values: &[String],
given: &[EvidenceProducer],
) -> Result<BTreeMap<EvidenceProducer, EvidenceProvenance>, String>
pub fn resolve( values: &[String], given: &[EvidenceProducer], ) -> Result<BTreeMap<EvidenceProducer, EvidenceProvenance>, String>
The measurement of each report, from --provenance values (<file> or
<producer>=<file>) and the producers whose reports were given.
A value’s producer is its key, else the file’s own, else the only report given; refused when none of those names one, when a key and the file disagree, and when a producer is given two measurements.
use majordomus_cli::evidence::{EvidenceProducer, EvidenceProvenance};
let dir = tempfile::tempdir().unwrap();
let f = dir.path().join("p.json");
std::fs::write(&f, r#"{"commit":"c","working_tree":"clean"}"#).unwrap();
let v = vec![f.display().to_string()];
let got = EvidenceProvenance::resolve(&v, &[EvidenceProducer::Suite]).unwrap();
assert_eq!(got[&EvidenceProducer::Suite].producer, Some(EvidenceProducer::Suite));
let two = [EvidenceProducer::Suite, EvidenceProducer::Crate];
assert!(EvidenceProvenance::resolve(&v, &two).unwrap_err().contains("<producer>=<file>"));Trait Implementations§
Source§impl Clone for EvidenceProvenance
impl Clone for EvidenceProvenance
Source§fn clone(&self) -> EvidenceProvenance
fn clone(&self) -> EvidenceProvenance
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for EvidenceProvenance
impl Debug for EvidenceProvenance
Source§impl<'de> Deserialize<'de> for EvidenceProvenance
impl<'de> Deserialize<'de> for EvidenceProvenance
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for EvidenceProvenance
Source§impl JsonSchema for EvidenceProvenance
impl JsonSchema for EvidenceProvenance
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl PartialEq for EvidenceProvenance
impl PartialEq for EvidenceProvenance
Source§fn eq(&self, other: &EvidenceProvenance) -> bool
fn eq(&self, other: &EvidenceProvenance) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for EvidenceProvenance
impl Serialize for EvidenceProvenance
impl StructuralPartialEq for EvidenceProvenance
Auto Trait Implementations§
impl Freeze for EvidenceProvenance
impl RefUnwindSafe for EvidenceProvenance
impl Send for EvidenceProvenance
impl Sync for EvidenceProvenance
impl Unpin for EvidenceProvenance
impl UnsafeUnpin for EvidenceProvenance
impl UnwindSafe for EvidenceProvenance
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.