Skip to content

Commit

Permalink
Clients: log git commit info at start time - try to fix for CI (#968)
Browse files Browse the repository at this point in the history
(cherry picked from commit 2149106)
  • Loading branch information
farnyser committed May 28, 2024
1 parent 2968ed3 commit 9be3949
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci-docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,5 @@ jobs:
${{ env.REGISTRY }}/blockworks-foundation/${{ env.IMAGE }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
"GITHUB_SHA=${{ github.sha }}"
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ COPY . .
RUN cargo chef prepare --recipe-path recipe.json

FROM base as build
ARG GITHUB_SHA
ENV GITHUB_SHA ${GITHUB_SHA}
COPY --from=plan /app/recipe.json .
RUN cargo chef cook --release --recipe-path recipe.json
COPY . .
Expand Down
25 changes: 16 additions & 9 deletions lib/client/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,23 @@ pub fn tracing_subscriber_init() {
}

pub fn print_git_version() {
info!(
"version is {}[{}{}]",
env!("VERGEN_GIT_SHA"),
env!("VERGEN_GIT_COMMIT_DATE"),
if env!("VERGEN_GIT_DIRTY") == "true" {
"-dirty"
} else {
""
match option_env!("GITHUB_SHA") {
Some(sha) => {
info!("version is {}[github]", sha,);
}
);
None => {
info!(
"version is {}[{}{}]",
env!("VERGEN_GIT_SHA"),
env!("VERGEN_GIT_COMMIT_DATE"),
if env!("VERGEN_GIT_DIRTY") == "true" {
"-dirty"
} else {
""
}
);
}
}
}

pub async fn http_error_handling<T: serde::de::DeserializeOwned>(
Expand Down

0 comments on commit 9be3949

Please sign in to comment.