Skip to content

Commit 376127d

Browse files
authored
Try #10:
2 parents f2eebed + 9a6bc29 commit 376127d

File tree

5 files changed

+42
-22
lines changed

5 files changed

+42
-22
lines changed

Cargo.lock

Lines changed: 29 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build-env/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,13 @@ ENV PYTHONUNBUFFERED=1
88
RUN python3 ./build-env/make.py --out /build-env
99

1010
FROM rust:slim as build-pps
11+
ARG BUILD_DATE=''
12+
ARG GIT_HASH=''
1113
COPY . /pps
1214
WORKDIR /pps
15+
ENV JJS_BUILD_INFO_VERIFY_FULL=1
16+
ENV JJS_BUILD_INFO_DATE=${BUILD_DATE}
17+
ENV JJS_BUILD_INFO_GIT_COMMIT=${GIT_HASH}}
1318
RUN cargo install --path cli
1419

1520
FROM ubuntu:focal

ci/publish-build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
set -euxo pipefail
22
export DOCKER_BUILDKIT=1
3-
docker build -f build-env/Dockerfile -t pps-cli .
3+
docker build -f build-env/Dockerfile -t pps-cli --build-arg "BUILD_DATE=$(date)" --build-arg "GIT_HASH=$(git rev-parse HEAD)" .

cli/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ authors = ["Mikail Bagishov <[email protected]>"]
55
edition = "2018"
66

77
[dependencies]
8-
serde = { version = "1.0.125", features = ["derive"] }
8+
serde = { version = "1.0.126", features = ["derive"] }
99
serde_json = "1.0.64"
1010
anyhow = "1.0.40"
1111
tokio = { version = "1.5.0", features = ["process", "macros", "rt-multi-thread", "fs"] }
1212
clap = "3.0.0-beta.2"
1313
pps-engine = { path = "../engine" }
1414
tracing = "0.1.25"
1515
tracing-subscriber = "0.2.17"
16+
buildinfo = { git = "https://github.com/jjs-dev/commons" }

cli/src/main.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ mod import;
33
mod progress_notifier;
44

55
use anyhow::Context as _;
6-
use clap::Clap;
6+
use clap::{Clap, FromArgMatches, IntoApp};
77
use std::path::Path;
88

99
#[derive(Clap, Debug)]
@@ -31,7 +31,10 @@ async fn main() -> anyhow::Result<()> {
3131
tracing_subscriber::fmt()
3232
.with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
3333
.init();
34-
let args = Args::parse();
34+
let args = Args::into_app();
35+
let args = buildinfo::BuildInfo::wrap_clap(args);
36+
let args = args.get_matches();
37+
let args = Args::from_arg_matches(&args);
3538
process_args(args).await.context("failed to process args")?;
3639
Ok(())
3740
}

0 commit comments

Comments
 (0)