Repository: trunk-io/analytics-cli
Pull request #498: Add ability to hide flaky tests banner
Author: login: gnalh
Created: 2025-03-26T17:33:00Z | Merged: 2025-03-26T18:19:54Z



Diff:
diff --git a/cli/src/main.rs b/cli/src/main.rs
index 9bc9fe2e..9fc7c92e 100644
--- a/cli/src/main.rs
+++ b/cli/src/main.rs
@@ -60,6 +60,15 @@ impl Cli {
         }
     }
 
+    pub fn hide_banner(&self) -> bool {
+        match &self.command {
+            Commands::Quarantine(args) => args.hide_banner(),
+            Commands::Test(args) => args.hide_banner(),
+            Commands::Upload(args) => args.hide_banner,
+            Commands::Validate(args) => args.hide_banner(),
+        }
+    }
+
     pub fn repo_root(&self) -> String {
         let explicit_root = match &self.command {
             Commands::Quarantine(args) => args.repo_root(),
@@ -107,7 +116,9 @@ fn main() -> anyhow::Result<()> {
                 cli.org_url_slug(),
                 cli.repo_root(),
             )?;
-            tracing::info!("{}", TITLE_CARD);
+            if !cli.hide_banner() {
+                tracing::info!("{}", TITLE_CARD);
+            }
             tracing::info!(
                 command = cli.debug_props(),
                 "Trunk Flaky Test running command"
diff --git a/cli/src/quarantine_command.rs b/cli/src/quarantine_command.rs
index b6c353ce..3e21f601 100644
--- a/cli/src/quarantine_command.rs
+++ b/cli/src/quarantine_command.rs
@@ -23,6 +23,10 @@ impl QuarantineArgs {
     pub fn repo_root(&self) -> Option<String> {
         self.upload_args.repo_root.clone()
     }
+
+    pub fn hide_banner(&self) -> bool {
+        self.upload_args.hide_banner
+    }
 }
 
 // This is an alias to `run_upload`, but does not exit on upload failure
diff --git a/cli/src/test_command.rs b/cli/src/test_command.rs
index 6bcd4d8f..7f70f9d4 100644
--- a/cli/src/test_command.rs
+++ b/cli/src/test_command.rs
@@ -38,6 +38,10 @@ impl TestArgs {
     pub fn repo_root(&self) -> Option<String> {
         self.upload_args.repo_root.clone()
     }
+
+    pub fn hide_banner(&self) -> bool {
+        self.upload_args.hide_banner
+    }
 }
 
 #[derive(Debug, Clone)]
diff --git a/cli/src/upload_command.rs b/cli/src/upload_command.rs
index 73536f85..f0a182cb 100644
--- a/cli/src/upload_command.rs
+++ b/cli/src/upload_command.rs
@@ -117,6 +117,17 @@ pub struct UploadArgs {
         default_missing_value = "true",
     )]
     pub allow_empty_test_results: bool,
+    #[arg(
+        long,
+        help = "Hide the top-level flaky tests banner",
+        action = ArgAction::Set,
+        required = false,
+        require_equals = true,
+        num_args = 0..=1,
+        default_value = "false",
+        default_missing_value = "true",
+    )]
+    pub hide_banner: bool,
 }
 
 impl UploadArgs {
diff --git a/cli/src/validate_command.rs b/cli/src/validate_command.rs
index 1ffd828e..36f510d4 100644
--- a/cli/src/validate_command.rs
+++ b/cli/src/validate_command.rs
@@ -1,7 +1,7 @@
 use std::{collections::BTreeMap, io::BufReader};
 
 use bundle::{FileSet, FileSetBuilder};
-use clap::{arg, Args};
+use clap::{arg, ArgAction, Args};
 use codeowners::CodeOwners;
 use colored::{ColoredString, Colorize};
 use console::Emoji;
@@ -43,6 +43,23 @@ pub struct ValidateArgs {
     show_warnings: bool,
     #[arg(long, help = "Value to override CODEOWNERS file or directory path.")]
     pub codeowners_path: Option<String>,
+    #[arg(
+        long,
+        help = "Hide the top-level flaky tests banner",
+        action = ArgAction::Set,
+        required = false,
+        require_equals = true,
+        num_args = 0..=1,
+        default_value = "false",
+        default_missing_value = "true",
+    )]
+    pub hide_banner: bool,
+}
+
+impl ValidateArgs {
+    pub fn hide_banner(&self) -> bool {
+        self.hide_banner
+    }
 }
 
 pub async fn run_validate(validate_args: ValidateArgs) -> anyhow::Result<i32> {
@@ -51,6 +68,7 @@ pub async fn run_validate(validate_args: ValidateArgs) -> anyhow::Result<i32> {
         bazel_bep_path,
         show_warnings: _,
         codeowners_path,
+        hide_banner: _,
     } = validate_args;
 
     let junit_file_paths = match bazel_bep_path {


Reviews:
user: login: cmillar-trunk
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-03-26T17:38:28Z
user: login: gnalh
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-26T17:50:28Z

Review comments:
diff_hunk: @@ -117,6 +117,17 @@ pub struct UploadArgs {
         default_missing_value = "true",
     )]
     pub allow_empty_test_results: bool,
+    #[arg(
+        long,
+        help = "Hide the top-level flaky tests banner",
+        action = ArgAction::Set,
+        required = false,
+        require_equals = true,
+        num_args = 0..=1,
+        default_value = "false",
+        default_missing_value = "true",
+    )]
+    pub hide_banner: bool,
path: cli/src/upload_command.rs
user: login: cmillar-trunk
body: nit: should this be global so that it can apply to validate commands as well?
created_at: 2025-03-26T17:38:25Z
author_association: CONTRIBUTOR
diff_hunk: @@ -117,6 +117,17 @@ pub struct UploadArgs {
         default_missing_value = "true",
     )]
     pub allow_empty_test_results: bool,
+    #[arg(
+        long,
+        help = "Hide the top-level flaky tests banner",
+        action = ArgAction::Set,
+        required = false,
+        require_equals = true,
+        num_args = 0..=1,
+        default_value = "false",
+        default_missing_value = "true",
+    )]
+    pub hide_banner: bool,
path: cli/src/upload_command.rs
user: login: gnalh
body: Skipped validate since it is only run in local contexts, but I'll add it as well.
created_at: 2025-03-26T17:50:27Z
author_association: CONTRIBUTOR

PR comments:
user: login: trunk-io[bot]
created_at: 2025-03-26T17:33:04Z
body: 😎 Merged successfully - [details](https://app.trunk.io/gh/trunk-io/analytics-cli/merge-queue/main/498).
author_association: NONE
user: login: trunk-staging-io[bot]
created_at: 2025-03-26T18:10:04Z
body: <!-- Trunk Test Analytics -->


[![Static Badge](https://img.shields.io/badge/774_tests-cc919049-purple)](https://app.trunk-staging.io/trunk-staging-org/flaky-tests/pr/498?repo=trunk-io/analytics-cli&commitHash=cc919049cbf1c864f4707841b2047fd21d5dd3af&utm_source=gh-comment) &ensp; [![Static Badge](https://img.shields.io/badge/0-failed-crimson)](https://app.trunk-staging.io/trunk-staging-org/flaky-tests/pr/498?repo=trunk-io/analytics-cli&commitHash=cc919049cbf1c864f4707841b2047fd21d5dd3af&utm_source=gh-comment&runConclusion=FAILURE) &ensp; [![Static Badge](https://img.shields.io/badge/0-flaky-red)](https://app.trunk-staging.io/trunk-staging-org/flaky-tests/pr/498?repo=trunk-io/analytics-cli&commitHash=cc919049cbf1c864f4707841b2047fd21d5dd3af&utm_source=gh-comment&runConclusion=FAILURE) &ensp; [![Static Badge](https://img.shields.io/badge/0-quarantined-yellow)](https://app.trunk-staging.io/trunk-staging-org/flaky-tests/pr/498?repo=trunk-io/analytics-cli&commitHash=cc919049cbf1c864f4707841b2047fd21d5dd3af&utm_source=gh-comment&runConclusion=QUARANTINED)


<sub>

[View Full Report ↗︎](https://app.trunk-staging.io/trunk-staging-org/flaky-tests/pr/498?repo=trunk-io/analytics-cli&commitHash=cc919049cbf1c864f4707841b2047fd21d5dd3af&utm_source=gh-comment) ⋅ [Docs](https://docs.trunk.io/flaky-tests?utm_source=gh-comment)

</sub>
author_association: NONE
user: login: trunk-io[bot]
created_at: 2025-03-26T19:09:11Z
body: <!-- Trunk Test Analytics -->


[![Static Badge](https://img.shields.io/badge/768_tests-cc919049-purple)](https://app.trunk.io/trunk/flaky-tests/pr/498?repo=trunk-io/analytics-cli&commitHash=cc919049cbf1c864f4707841b2047fd21d5dd3af&utm_source=gh-comment) &ensp; [![Static Badge](https://img.shields.io/badge/0-failed-crimson)](https://app.trunk.io/trunk/flaky-tests/pr/498?repo=trunk-io/analytics-cli&commitHash=cc919049cbf1c864f4707841b2047fd21d5dd3af&utm_source=gh-comment&runConclusion=FAILURE) &ensp; [![Static Badge](https://img.shields.io/badge/0-flaky-red)](https://app.trunk.io/trunk/flaky-tests/pr/498?repo=trunk-io/analytics-cli&commitHash=cc919049cbf1c864f4707841b2047fd21d5dd3af&utm_source=gh-comment&runConclusion=FAILURE) &ensp; [![Static Badge](https://img.shields.io/badge/0-quarantined-yellow)](https://app.trunk.io/trunk/flaky-tests/pr/498?repo=trunk-io/analytics-cli&commitHash=cc919049cbf1c864f4707841b2047fd21d5dd3af&utm_source=gh-comment&runConclusion=QUARANTINED)


<sub>

[View Full Report ↗︎](https://app.trunk.io/trunk/flaky-tests/pr/498?repo=trunk-io/analytics-cli&commitHash=cc919049cbf1c864f4707841b2047fd21d5dd3af&utm_source=gh-comment) ⋅ [Docs](https://docs.trunk.io/flaky-tests?utm_source=gh-comment)

</sub>
author_association: NONE