Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
Signed-off-by: pozsgaic <[email protected]>
  • Loading branch information
pozsgaic committed Jun 10, 2022
1 parent 160902d commit 453b184
Showing 1 changed file with 24 additions and 37 deletions.
61 changes: 24 additions & 37 deletions components/builder-worker/src/runner/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,30 +316,28 @@ impl Runner {
let mut section = streamer.start_section(Section::PublishPackage)?;

if env::var_os("HAB_FUNC_TEST").is_some() {
section.end()?;
return Ok(());
}

match post_process(&mut archive,
&self.workspace,
&self.config,
&self.bldr_token,
&mut self.logger).await
{
Ok(_) => (),
Err(err) => {
let msg = format!("Failed post processing for {}, err={:?}",
// Skip post process
} else {
match post_process(&mut archive,
&self.workspace,
&self.config,
&self.bldr_token,
&mut self.logger).await
{
Ok(_) => (),
Err(err) => {
let msg = format!("Failed post processing for {}, err={:?}",
self.workspace.job.get_project().get_name(),
err);
streamer.println_stderr(msg)?;
self.fail(net::err(ErrCode::POST_PROCESSOR, "wk:run:postprocess"));
tx.send(self.job().clone())
.await
.map_err(Error::MpscAsync)?;
return Err(err);
streamer.println_stderr(msg)?;
self.fail(net::err(ErrCode::POST_PROCESSOR, "wk:run:postprocess"));
tx.send(self.job().clone())
.await
.map_err(Error::MpscAsync)?;
return Err(err);
}
}
}

section.end()?;
Ok(())
}
Expand Down Expand Up @@ -404,26 +402,15 @@ impl Runner {
async fn fetch_origin_secret_key(
&self)
-> std::result::Result<std::path::PathBuf, builder_core::Error> {
if env::var_os("HAB_FUNC_TEST").is_some() {
let test_key = "bobo".to_string();
let res =
self.depot_cli
.fetch_origin_secret_key(self.job().origin(),
&test_key,
self.workspace.key_path())
.await;
if res.is_err() {
debug!("Failed to fetch origin secret key, err={:?}, path={:?}",
res,
self.workspace.key_path());
};

return res;
}
let bldr_token = if env::var_os("HAB_FUNC_TEST").is_some() {
"bobo".to_string()
} else {
self.bldr_token.to_string()
};

let res = self.depot_cli
.fetch_origin_secret_key(self.job().origin(),
&self.bldr_token,
&bldr_token,
self.workspace.key_path())
.await;
if res.is_err() {
Expand Down

0 comments on commit 453b184

Please sign in to comment.