fix git commit logic to work on gcloud (#1442)
This commit is contained in:
parent
c0bbac89b3
commit
90f944709b
|
@ -45,7 +45,12 @@ pub struct ZebradApp {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ZebradApp {
|
impl ZebradApp {
|
||||||
pub const GIT_COMMIT: &'static str = env!("VERGEN_SHA_SHORT");
|
pub fn git_commit() -> &'static str {
|
||||||
|
const GIT_COMMIT_VERGEN: &str = env!("VERGEN_SHA_SHORT");
|
||||||
|
const GIT_COMMIT_GCLOUD: Option<&str> = option_env!("SHORT_SHA");
|
||||||
|
|
||||||
|
GIT_COMMIT_GCLOUD.unwrap_or(GIT_COMMIT_VERGEN)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Initialize a new application instance.
|
/// Initialize a new application instance.
|
||||||
|
@ -118,7 +123,7 @@ impl Application for ZebradApp {
|
||||||
color_eyre::config::HookBuilder::default()
|
color_eyre::config::HookBuilder::default()
|
||||||
.issue_url(concat!(env!("CARGO_PKG_REPOSITORY"), "/issues/new"))
|
.issue_url(concat!(env!("CARGO_PKG_REPOSITORY"), "/issues/new"))
|
||||||
.add_issue_metadata("version", env!("CARGO_PKG_VERSION"))
|
.add_issue_metadata("version", env!("CARGO_PKG_VERSION"))
|
||||||
.add_issue_metadata("git commit", Self::GIT_COMMIT)
|
.add_issue_metadata("git commit", Self::git_commit())
|
||||||
.issue_filter(|kind| match kind {
|
.issue_filter(|kind| match kind {
|
||||||
color_eyre::ErrorKind::NonRecoverable(_) => true,
|
color_eyre::ErrorKind::NonRecoverable(_) => true,
|
||||||
color_eyre::ErrorKind::Recoverable(error) => {
|
color_eyre::ErrorKind::Recoverable(error) => {
|
||||||
|
|
|
@ -53,7 +53,7 @@ impl ZebradCmd {
|
||||||
|
|
||||||
impl Runnable for ZebradCmd {
|
impl Runnable for ZebradCmd {
|
||||||
fn run(&self) {
|
fn run(&self) {
|
||||||
let span = error_span!("", zebrad = ZebradApp::GIT_COMMIT);
|
let span = error_span!("", zebrad = ZebradApp::git_commit());
|
||||||
let _guard = span.enter();
|
let _guard = span.enter();
|
||||||
match self {
|
match self {
|
||||||
Generate(cmd) => cmd.run(),
|
Generate(cmd) => cmd.run(),
|
||||||
|
|
Loading…
Reference in New Issue