Skip to content
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

Show build information #10

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 29 additions & 18 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions build-env/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,15 @@ ENV PYTHONUNBUFFERED=1
RUN python3 ./build-env/make.py --out /build-env

FROM rust:slim as build-pps
ARG BUILD_DATE=''
ARG GIT_HASH=''
ARG VERSION=''
COPY . /pps
WORKDIR /pps
ENV JJS_BUILD_INFO_VERIFY_FULL=1
ENV JJS_BUILD_INFO_DATE=${BUILD_DATE}
ENV JJS_BUILD_INFO_COMMIT=${GIT_HASH}
ENV JJS_BUILD_INFO_VERSION=${VERSION}
RUN cargo install --path cli

FROM ubuntu:focal
Expand Down
2 changes: 1 addition & 1 deletion ci/publish-build.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
set -euxo pipefail
export DOCKER_BUILDKIT=1
docker build -f build-env/Dockerfile -t pps-cli .
docker build -f build-env/Dockerfile -t pps-cli --build-arg "BUILD_DATE=$(date)" --build-arg "GIT_HASH=$(git rev-parse HEAD)" --build-arg "VERSION=todo" .
3 changes: 2 additions & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ authors = ["Mikail Bagishov <[email protected]>"]
edition = "2018"

[dependencies]
serde = { version = "1.0.125", features = ["derive"] }
serde = { version = "1.0.126", features = ["derive"] }
serde_json = "1.0.64"
anyhow = "1.0.40"
tokio = { version = "1.5.0", features = ["process", "macros", "rt-multi-thread", "fs"] }
clap = "3.0.0-beta.2"
pps-engine = { path = "../engine" }
tracing = "0.1.25"
tracing-subscriber = "0.2.17"
buildinfo = { git = "https://github.com/jjs-dev/commons" }
7 changes: 5 additions & 2 deletions cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ mod import;
mod progress_notifier;

use anyhow::Context as _;
use clap::Clap;
use clap::{Clap, FromArgMatches, IntoApp};
use std::path::Path;

#[derive(Clap, Debug)]
Expand Down Expand Up @@ -31,7 +31,10 @@ async fn main() -> anyhow::Result<()> {
tracing_subscriber::fmt()
.with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
.init();
let args = Args::parse();
let args = Args::into_app();
let args = buildinfo::BuildInfo::wrap_clap(args);
let args = args.get_matches();
let args = Args::from_arg_matches(&args);
process_args(args).await.context("failed to process args")?;
Ok(())
}
Expand Down