expose input_blob fields needed to generate crash reports (#551)

This commit is contained in:
bmc-msft
2021-02-16 13:16:54 -05:00
committed by GitHub
parent f64a0dcc05
commit c160088998
3 changed files with 33 additions and 1 deletions

View File

@ -129,7 +129,16 @@ pub async fn run_tool(input: impl AsRef<Path>, config: &Config) -> Result<()> {
.tools_dir(&config.tools.path)
.setup_dir(&config.common.setup_dir)
.job_id(&config.common.job_id)
.task_id(&config.common.task_id);
.task_id(&config.common.task_id)
.set_optional_ref(&config.crashes, |tester, crashes| {
if let Some(url) = &crashes.url {
tester
.crashes_account(&url.account())
.crashes_container(&url.container())
} else {
tester
}
});
let analyzer_path = expand.evaluate_value(&config.analyzer_exe)?;

View File

@ -192,6 +192,11 @@ async fn start_supervisor(
})
.set_optional_ref(&config.target_options, |expand, target_options| {
expand.target_options(target_options)
})
.set_optional_ref(&config.crashes.url, |tester, url| {
tester
.crashes_account(&url.account())
.crashes_container(&url.container())
});
let supervisor_path = expand.evaluate_value(&config.supervisor_exe)?;

View File

@ -38,6 +38,8 @@ pub enum PlaceHolder {
ReportsDir,
JobId,
TaskId,
CrashesContainer,
CrashesAccount,
}
impl PlaceHolder {
@ -64,6 +66,8 @@ impl PlaceHolder {
Self::ReportsDir => "{reports_dir}",
Self::JobId => "{job_id}",
Self::TaskId => "{task_id}",
Self::CrashesContainer => "{crashes_container}",
Self::CrashesAccount => "{crashes_account}",
}
.to_string()
}
@ -251,6 +255,20 @@ impl<'a> Expand<'a> {
self.set_value(PlaceHolder::JobId, ExpandedValue::Scalar(value))
}
pub fn crashes_account(self, arg: &str) -> Self {
self.set_value(
PlaceHolder::CrashesAccount,
ExpandedValue::Scalar(String::from(arg)),
)
}
pub fn crashes_container(self, arg: &str) -> Self {
self.set_value(
PlaceHolder::CrashesContainer,
ExpandedValue::Scalar(String::from(arg)),
)
}
fn replace_value(
&self,
fmtstr: &str,