Skip to content

Commit

Permalink
feat: Reduce the clutter of build logs
Browse files Browse the repository at this point in the history
  • Loading branch information
gmpinder committed Sep 17, 2024
1 parent fbf57e5 commit 287aff2
Show file tree
Hide file tree
Showing 12 changed files with 13,487 additions and 118 deletions.
27 changes: 27 additions & 0 deletions Cargo.lock

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

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ categories = ["command-line-utilities"]
version = "0.8.17"

[workspace.dependencies]
base64 = "0.22"
bon = "2"
chrono = "0.4"
clap = "4"
colored = "2"
Expand All @@ -23,6 +25,7 @@ serde = { version = "1", features = ["derive"] }
serde_json = "1"
serde_yaml = "0.9"
tempdir = "0.3"
tempfile = "3"
typed-builder = "0.18"
users = "0.11"
uuid = { version = "1", features = ["v4"] }
Expand Down
4 changes: 4 additions & 0 deletions process/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,15 @@ nix = { version = "0.29", features = ["signal"] }
once_cell = "1"
os_pipe = { version = "1", features = ["io_safety"] }
rand = "0.8"
regex = "1.10.6"
semver = { version = "1", features = ["serde"] }
signal-hook = { version = "0.3", features = ["extended-siginfo"] }
sigstore = { version = "0.10", features = ["full-rustls-tls", "cached-client", "sigstore-trust-root", "sign"], default-features = false, optional = true }
tokio = { version = "1.39.2", features = ["rt", "rt-multi-thread"], optional = true }
zeroize = { version = "1", features = ["aarch64", "derive", "serde"] }

base64.workspace = true
bon.workspace = true
chrono.workspace = true
clap = { workspace = true, features = ["derive", "env"] }
colored.workspace = true
Expand All @@ -39,6 +42,7 @@ oci-distribution.workspace = true
serde.workspace = true
serde_json.workspace = true
tempdir.workspace = true
tempfile.workspace = true
typed-builder.workspace = true
users.workspace = true
uuid.workspace = true
Expand Down
10 changes: 5 additions & 5 deletions process/drivers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,23 +247,23 @@ impl Driver {
Ok(os_version)
}

fn get_build_driver() -> BuildDriverType {
pub fn get_build_driver() -> BuildDriverType {
impl_driver_type!(SELECTED_BUILD_DRIVER)
}

fn get_inspect_driver() -> InspectDriverType {
pub fn get_inspect_driver() -> InspectDriverType {
impl_driver_type!(SELECTED_INSPECT_DRIVER)
}

fn get_signing_driver() -> SigningDriverType {
pub fn get_signing_driver() -> SigningDriverType {
impl_driver_type!(SELECTED_SIGNING_DRIVER)
}

fn get_run_driver() -> RunDriverType {
pub fn get_run_driver() -> RunDriverType {
impl_driver_type!(SELECTED_RUN_DRIVER)
}

fn get_ci_driver() -> CiDriverType {
pub fn get_ci_driver() -> CiDriverType {
impl_driver_type!(SELECTED_CI_DRIVER)
}
}
Expand Down
26 changes: 12 additions & 14 deletions process/drivers/docker_driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use tempdir::TempDir;

use crate::{
drivers::image_metadata::ImageMetadata,
logging::{CommandLogging, Logger},
logging::{CommandLogging, DockerLogging, Logger},
signal_handler::{add_cid, remove_cid, ContainerId, ContainerRuntime},
};

Expand Down Expand Up @@ -231,6 +231,7 @@ impl BuildDriver for DockerDriver {
},
"build",
"--pull",
"--progress=rawjson",
"-f",
&*opts.containerfile,
// https://github.com/moby/buildkit?tab=readme-ov-file#github-actions-cache-experimental
Expand Down Expand Up @@ -285,20 +286,17 @@ impl BuildDriver for DockerDriver {
cmd!(command, ".");

trace!("{command:?}");
if command
.status_image_ref_progress(display_image, "Building Image")
.into_diagnostic()?
.success()
{
if opts.push {
info!("Successfully built and pushed image {}", display_image);
} else {
info!("Successfully built image {}", display_image);
}
} else {
bail!("Failed to build image {}", display_image);
}
command.docker_log(display_image)?;
Ok(final_images)

// let status = command
// .status_image_ref_progress(display_image, "Building image")
// .into_diagnostic()?;

// if !status.success() {
// bail!("Failed to build image {display_image}");
// }
// Ok(final_images)
}
}

Expand Down
Loading

0 comments on commit 287aff2

Please sign in to comment.