-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add HAB_FUNC_TEST end to end overrides for builder-worker #1735
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -315,26 +315,29 @@ impl Runner { | |
self.check_cancel(tx).await?; | ||
let mut section = streamer.start_section(Section::PublishPackage)?; | ||
|
||
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); | ||
if env::var_os("HAB_FUNC_TEST").is_some() { | ||
// 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); | ||
} | ||
} | ||
} | ||
|
||
section.end()?; | ||
Ok(()) | ||
} | ||
|
@@ -399,11 +402,18 @@ impl Runner { | |
async fn fetch_origin_secret_key( | ||
&self) | ||
-> std::result::Result<std::path::PathBuf, builder_core::Error> { | ||
let res = self.depot_cli | ||
.fetch_origin_secret_key(self.job().origin(), | ||
&self.bldr_token, | ||
self.workspace.key_path()) | ||
.await; | ||
let bldr_token = if env::var_os("HAB_FUNC_TEST").is_some() { | ||
"bobo".to_string() | ||
} else { | ||
self.bldr_token.to_string() | ||
}; | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you can avoid all of this repetitive code by creating a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. updated |
||
let res = | ||
self.depot_cli | ||
.fetch_origin_secret_key(self.job().origin(), | ||
&bldr_token, | ||
self.workspace.key_path()) | ||
.await; | ||
if res.is_err() { | ||
debug!("Failed to fetch origin secret key, err={:?}", res); | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You want to use
is_none()
to avoid theelse
and emptyif
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep - missed that