From 6e8438216ad4a6984c098fad021a40adfd1efdce Mon Sep 17 00:00:00 2001 From: Clint J Edwards Date: Sat, 28 Dec 2024 06:30:54 -0500 Subject: [PATCH] fix: Added more debug statements for 'gofer run' Fleshing out some better error messages for the 'gofer run' command and other small messages --- Cargo.lock | 6 +- Makefile | 3 +- TODO.md | 15 +- dogfood/run_tests/Cargo.toml | 2 +- dogfood/run_tests/src/main.rs | 4 +- gofer/public/css/main.css | 258 ++++++++++++++++------------------ gofer/src/api/event_utils.rs | 3 +- gofer/src/cli/pipeline/mod.rs | 2 +- gofer/src/cli/run/mod.rs | 7 + gofer/src/scheduler/docker.rs | 3 +- 10 files changed, 154 insertions(+), 149 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a58542a0..62f089f3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -903,7 +903,7 @@ dependencies = [ name = "dogfood" version = "0.1.0" dependencies = [ - "gofer_sdk 0.8.1", + "gofer_sdk 0.8.3 (git+https://github.com/clintjedwards/gofer?tag=v0.8.3)", ] [[package]] @@ -1400,8 +1400,7 @@ dependencies = [ [[package]] name = "gofer_sdk" -version = "0.8.1" -source = "git+https://github.com/clintjedwards/gofer?tag=v0.8.2#fda843f6238a1de42ecd73efa382b7f7286097d9" +version = "0.8.3" dependencies = [ "anyhow", "async-trait", @@ -1429,6 +1428,7 @@ dependencies = [ [[package]] name = "gofer_sdk" version = "0.8.3" +source = "git+https://github.com/clintjedwards/gofer?tag=v0.8.3#e2a723ee8a62b83cd22454e638e27348644fbe56" dependencies = [ "anyhow", "async-trait", diff --git a/Makefile b/Makefile index 39878f6a..1640c390 100644 --- a/Makefile +++ b/Makefile @@ -49,7 +49,7 @@ run: run-backend: > cd gofer -> export GOFER_WEB_API__LOG_LEVEL=debug +> export GOFER_WEB_API__LOG_LEVEL=trace > cargo run --bin gofer -- service start ## build-release: build Gofer for release. @@ -92,7 +92,6 @@ run-hurl-tests: > echo "--------------------------------" > hurl --color --test *.hurl --variable secret=$$SECRET --error-format long - ## cleanup-integration-tests: Clean up the background gofer process. cleanup-integration-tests: > @pkill -9 gofer diff --git a/TODO.md b/TODO.md index 3ca72535..9f243e4f 100644 --- a/TODO.md +++ b/TODO.md @@ -15,8 +15,21 @@ thought into this feature that it can become a game changer for Gofer as a whole # Small things I want to keep track of that I definitely need to do. +* When the user asks for a log and there is no log, we should say so. +* There is a bug for only run-tests for some reason. + 2024-12-28T10:41:53.458112Z TRACE new event id="01940cdb-b731-7d60-a3e6-c23922f1d76d" kind=started_run emitted=1735382513457 +2024-12-28T10:41:53.562772Z TRACE new event id="01940cdb-b79a-7662-85b3-f0eec44a19cb" kind=completed_task_execution emitted=1735382513562 +* When creating the container name, we used to lean on the fact that the names for things used underscore, now + we use hypens, we should up the container name generation to match. +* When the user tries to get a run and the status if failed, we should automaticallly print the failed reasonings and + then tell the user how to go about finding more information. +* For the up command it should grab the current size of the terminal and then truncate the output, instead of having a hard + truncate like it does now. +* The UX for writing the pipelines needs more work. It should feel natural to write in commands like they're written in a bash script. + * We should also just pretty-print the json by default so people can take a look at it. * Think about a `context` command that allows users to examine the current settings for their CLI. This is helpful - when double checking what environment you're working within. + when double checking what environment you're working within. The context command could also dump the server's systeminfo. + Maybe make that under a --full? * When you insert a new pipeline it should show you a diff on what you're changing. * We need to productionalize and offer the container that builds repo containers. The test for this is build_repo_container directory. Think more about how the UX should be handled here. diff --git a/dogfood/run_tests/Cargo.toml b/dogfood/run_tests/Cargo.toml index e8a64ccc..4b4fcf85 100644 --- a/dogfood/run_tests/Cargo.toml +++ b/dogfood/run_tests/Cargo.toml @@ -6,4 +6,4 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -gofer_sdk = { git = "https://github.com/clintjedwards/gofer", tag = "v0.8.2" } +gofer_sdk = { git = "https://github.com/clintjedwards/gofer", tag = "v0.8.3" } diff --git a/dogfood/run_tests/src/main.rs b/dogfood/run_tests/src/main.rs index 24d0b956..914f0312 100644 --- a/dogfood/run_tests/src/main.rs +++ b/dogfood/run_tests/src/main.rs @@ -1,10 +1,10 @@ use gofer_sdk::config::{Pipeline, Task}; fn main() { - Pipeline::new("run_tests", "Run Project Tests") + Pipeline::new("run-tests", "Run Project Tests") .description("Runs all cargo tests for the overall Gofer workspace.") .tasks(vec![Task::new( - "run_cargo_test", + "run-cargo-test", "ghcr.io/clintjedwards/gofer-repo:latest", ) .description("Run cargo test command for workspace") diff --git a/gofer/public/css/main.css b/gofer/public/css/main.css index dde88386..678130e9 100644 --- a/gofer/public/css/main.css +++ b/gofer/public/css/main.css @@ -1,5 +1,113 @@ +*, ::before, ::after { + --tw-border-spacing-x: 0; + --tw-border-spacing-y: 0; + --tw-translate-x: 0; + --tw-translate-y: 0; + --tw-rotate: 0; + --tw-skew-x: 0; + --tw-skew-y: 0; + --tw-scale-x: 1; + --tw-scale-y: 1; + --tw-pan-x: ; + --tw-pan-y: ; + --tw-pinch-zoom: ; + --tw-scroll-snap-strictness: proximity; + --tw-gradient-from-position: ; + --tw-gradient-via-position: ; + --tw-gradient-to-position: ; + --tw-ordinal: ; + --tw-slashed-zero: ; + --tw-numeric-figure: ; + --tw-numeric-spacing: ; + --tw-numeric-fraction: ; + --tw-ring-inset: ; + --tw-ring-offset-width: 0px; + --tw-ring-offset-color: #fff; + --tw-ring-color: rgb(59 130 246 / 0.5); + --tw-ring-offset-shadow: 0 0 #0000; + --tw-ring-shadow: 0 0 #0000; + --tw-shadow: 0 0 #0000; + --tw-shadow-colored: 0 0 #0000; + --tw-blur: ; + --tw-brightness: ; + --tw-contrast: ; + --tw-grayscale: ; + --tw-hue-rotate: ; + --tw-invert: ; + --tw-saturate: ; + --tw-sepia: ; + --tw-drop-shadow: ; + --tw-backdrop-blur: ; + --tw-backdrop-brightness: ; + --tw-backdrop-contrast: ; + --tw-backdrop-grayscale: ; + --tw-backdrop-hue-rotate: ; + --tw-backdrop-invert: ; + --tw-backdrop-opacity: ; + --tw-backdrop-saturate: ; + --tw-backdrop-sepia: ; + --tw-contain-size: ; + --tw-contain-layout: ; + --tw-contain-paint: ; + --tw-contain-style: ; +} + +::backdrop { + --tw-border-spacing-x: 0; + --tw-border-spacing-y: 0; + --tw-translate-x: 0; + --tw-translate-y: 0; + --tw-rotate: 0; + --tw-skew-x: 0; + --tw-skew-y: 0; + --tw-scale-x: 1; + --tw-scale-y: 1; + --tw-pan-x: ; + --tw-pan-y: ; + --tw-pinch-zoom: ; + --tw-scroll-snap-strictness: proximity; + --tw-gradient-from-position: ; + --tw-gradient-via-position: ; + --tw-gradient-to-position: ; + --tw-ordinal: ; + --tw-slashed-zero: ; + --tw-numeric-figure: ; + --tw-numeric-spacing: ; + --tw-numeric-fraction: ; + --tw-ring-inset: ; + --tw-ring-offset-width: 0px; + --tw-ring-offset-color: #fff; + --tw-ring-color: rgb(59 130 246 / 0.5); + --tw-ring-offset-shadow: 0 0 #0000; + --tw-ring-shadow: 0 0 #0000; + --tw-shadow: 0 0 #0000; + --tw-shadow-colored: 0 0 #0000; + --tw-blur: ; + --tw-brightness: ; + --tw-contrast: ; + --tw-grayscale: ; + --tw-hue-rotate: ; + --tw-invert: ; + --tw-saturate: ; + --tw-sepia: ; + --tw-drop-shadow: ; + --tw-backdrop-blur: ; + --tw-backdrop-brightness: ; + --tw-backdrop-contrast: ; + --tw-backdrop-grayscale: ; + --tw-backdrop-hue-rotate: ; + --tw-backdrop-invert: ; + --tw-backdrop-opacity: ; + --tw-backdrop-saturate: ; + --tw-backdrop-sepia: ; + --tw-contain-size: ; + --tw-contain-layout: ; + --tw-contain-paint: ; + --tw-contain-style: ; +} + /* -! tailwindcss v3.4.9 | MIT License | https://tailwindcss.com +! tailwindcss v3.4.17 | MIT License | https://tailwindcss.com */ /* @@ -442,118 +550,10 @@ video { /* Make elements with the HTML hidden attribute stay hidden by default */ -[hidden] { +[hidden]:where(:not([hidden="until-found"])) { display: none; } -*, ::before, ::after { - --tw-border-spacing-x: 0; - --tw-border-spacing-y: 0; - --tw-translate-x: 0; - --tw-translate-y: 0; - --tw-rotate: 0; - --tw-skew-x: 0; - --tw-skew-y: 0; - --tw-scale-x: 1; - --tw-scale-y: 1; - --tw-pan-x: ; - --tw-pan-y: ; - --tw-pinch-zoom: ; - --tw-scroll-snap-strictness: proximity; - --tw-gradient-from-position: ; - --tw-gradient-via-position: ; - --tw-gradient-to-position: ; - --tw-ordinal: ; - --tw-slashed-zero: ; - --tw-numeric-figure: ; - --tw-numeric-spacing: ; - --tw-numeric-fraction: ; - --tw-ring-inset: ; - --tw-ring-offset-width: 0px; - --tw-ring-offset-color: #fff; - --tw-ring-color: rgb(59 130 246 / 0.5); - --tw-ring-offset-shadow: 0 0 #0000; - --tw-ring-shadow: 0 0 #0000; - --tw-shadow: 0 0 #0000; - --tw-shadow-colored: 0 0 #0000; - --tw-blur: ; - --tw-brightness: ; - --tw-contrast: ; - --tw-grayscale: ; - --tw-hue-rotate: ; - --tw-invert: ; - --tw-saturate: ; - --tw-sepia: ; - --tw-drop-shadow: ; - --tw-backdrop-blur: ; - --tw-backdrop-brightness: ; - --tw-backdrop-contrast: ; - --tw-backdrop-grayscale: ; - --tw-backdrop-hue-rotate: ; - --tw-backdrop-invert: ; - --tw-backdrop-opacity: ; - --tw-backdrop-saturate: ; - --tw-backdrop-sepia: ; - --tw-contain-size: ; - --tw-contain-layout: ; - --tw-contain-paint: ; - --tw-contain-style: ; -} - -::backdrop { - --tw-border-spacing-x: 0; - --tw-border-spacing-y: 0; - --tw-translate-x: 0; - --tw-translate-y: 0; - --tw-rotate: 0; - --tw-skew-x: 0; - --tw-skew-y: 0; - --tw-scale-x: 1; - --tw-scale-y: 1; - --tw-pan-x: ; - --tw-pan-y: ; - --tw-pinch-zoom: ; - --tw-scroll-snap-strictness: proximity; - --tw-gradient-from-position: ; - --tw-gradient-via-position: ; - --tw-gradient-to-position: ; - --tw-ordinal: ; - --tw-slashed-zero: ; - --tw-numeric-figure: ; - --tw-numeric-spacing: ; - --tw-numeric-fraction: ; - --tw-ring-inset: ; - --tw-ring-offset-width: 0px; - --tw-ring-offset-color: #fff; - --tw-ring-color: rgb(59 130 246 / 0.5); - --tw-ring-offset-shadow: 0 0 #0000; - --tw-ring-shadow: 0 0 #0000; - --tw-shadow: 0 0 #0000; - --tw-shadow-colored: 0 0 #0000; - --tw-blur: ; - --tw-brightness: ; - --tw-contrast: ; - --tw-grayscale: ; - --tw-hue-rotate: ; - --tw-invert: ; - --tw-saturate: ; - --tw-sepia: ; - --tw-drop-shadow: ; - --tw-backdrop-blur: ; - --tw-backdrop-brightness: ; - --tw-backdrop-contrast: ; - --tw-backdrop-grayscale: ; - --tw-backdrop-hue-rotate: ; - --tw-backdrop-invert: ; - --tw-backdrop-opacity: ; - --tw-backdrop-saturate: ; - --tw-backdrop-sepia: ; - --tw-contain-size: ; - --tw-contain-layout: ; - --tw-contain-paint: ; - --tw-contain-style: ; -} - .container { width: 100%; } @@ -600,10 +600,6 @@ video { display: none; } -.h-5 { - height: 1.25rem; -} - .w-24 { width: 6rem; } @@ -628,10 +624,6 @@ video { align-items: center; } -.justify-center { - justify-content: center; -} - .justify-between { justify-content: space-between; } @@ -652,10 +644,6 @@ video { overflow: hidden; } -.rounded-sm { - border-radius: 0.125rem; -} - .border-0 { border-width: 0px; } @@ -670,12 +658,12 @@ video { .border-emerald-400 { --tw-border-opacity: 1; - border-color: rgb(52 211 153 / var(--tw-border-opacity)); + border-color: rgb(52 211 153 / var(--tw-border-opacity, 1)); } .border-gray-600 { --tw-border-opacity: 1; - border-color: rgb(75 85 99 / var(--tw-border-opacity)); + border-color: rgb(75 85 99 / var(--tw-border-opacity, 1)); } .bg-emerald-500\/70 { @@ -802,26 +790,22 @@ video { .text-gray-700 { --tw-text-opacity: 1; - color: rgb(55 65 81 / var(--tw-text-opacity)); + color: rgb(55 65 81 / var(--tw-text-opacity, 1)); } .text-gray-900 { --tw-text-opacity: 1; - color: rgb(17 24 39 / var(--tw-text-opacity)); + color: rgb(17 24 39 / var(--tw-text-opacity, 1)); } .text-slate-500 { --tw-text-opacity: 1; - color: rgb(100 116 139 / var(--tw-text-opacity)); -} - -.text-slate-500\/40 { - color: rgb(100 116 139 / 0.4); + color: rgb(100 116 139 / var(--tw-text-opacity, 1)); } .text-slate-800 { --tw-text-opacity: 1; - color: rgb(30 41 59 / var(--tw-text-opacity)); + color: rgb(30 41 59 / var(--tw-text-opacity, 1)); } .text-transparent { @@ -830,7 +814,7 @@ video { .text-white { --tw-text-opacity: 1; - color: rgb(255 255 255 / var(--tw-text-opacity)); + color: rgb(255 255 255 / var(--tw-text-opacity, 1)); } .shadow-sm { @@ -851,17 +835,17 @@ video { .ring-gray-300 { --tw-ring-opacity: 1; - --tw-ring-color: rgb(209 213 219 / var(--tw-ring-opacity)); + --tw-ring-color: rgb(209 213 219 / var(--tw-ring-opacity, 1)); } .placeholder\:text-gray-400::-moz-placeholder { --tw-text-opacity: 1; - color: rgb(156 163 175 / var(--tw-text-opacity)); + color: rgb(156 163 175 / var(--tw-text-opacity, 1)); } .placeholder\:text-gray-400::placeholder { --tw-text-opacity: 1; - color: rgb(156 163 175 / var(--tw-text-opacity)); + color: rgb(156 163 175 / var(--tw-text-opacity, 1)); } .focus\:ring-2:focus { @@ -876,7 +860,7 @@ video { .focus\:ring-emerald-400:focus { --tw-ring-opacity: 1; - --tw-ring-color: rgb(52 211 153 / var(--tw-ring-opacity)); + --tw-ring-color: rgb(52 211 153 / var(--tw-ring-opacity, 1)); } @media (min-width: 640px) { diff --git a/gofer/src/api/event_utils.rs b/gofer/src/api/event_utils.rs index 619bab6b..f69586d8 100644 --- a/gofer/src/api/event_utils.rs +++ b/gofer/src/api/event_utils.rs @@ -508,7 +508,8 @@ impl EventBus { Err(err) => { trace!( error = %err, - "No receivers available to receive published message", + "No receivers available to receive published message; This is not an actual error unless events\ + are being missed by known subscribed listeners.", ); } }; diff --git a/gofer/src/cli/pipeline/mod.rs b/gofer/src/cli/pipeline/mod.rs index 8fa3936b..7b13a83f 100644 --- a/gofer/src/cli/pipeline/mod.rs +++ b/gofer/src/cli/pipeline/mod.rs @@ -397,7 +397,7 @@ impl Cli { colorize_status_text(pipeline_metadata.state) ); print!("\n"); - print!("{}", &pipeline_config.description); + print!("{}\n", &pipeline_config.description); print!("{}", content); Ok(()) } diff --git a/gofer/src/cli/run/mod.rs b/gofer/src/cli/run/mod.rs index 4a5c6012..1e52d0f2 100644 --- a/gofer/src/cli/run/mod.rs +++ b/gofer/src/cli/run/mod.rs @@ -270,6 +270,11 @@ impl Cli { Initiated by {{ initiator_name }} {{ started }} and ran for {{ duration }} {%- if task_executions is defined and task_executions | length > 0 %} + {%- if status_reason %} + + {{status_message}}: {{ status_reason.reason }}: {{ status_reason.description }} + {%- endif %} + 🗒 Task Executions {%- for task in task_executions %} {{ task.line }} @@ -297,6 +302,8 @@ impl Cli { context.insert("duration", &duration(run.started as i64, run.ended as i64)); context.insert("objects_expired", &run.store_objects_expired); context.insert("task_executions", &task_data); + context.insert("status_reason", &run.status_reason); + context.insert("status_message", &"Failure".red().to_string()); let content = tera.render("main", &context)?; println!( diff --git a/gofer/src/scheduler/docker.rs b/gofer/src/scheduler/docker.rs index dd55be5d..32432b22 100644 --- a/gofer/src/scheduler/docker.rs +++ b/gofer/src/scheduler/docker.rs @@ -165,7 +165,8 @@ impl super::Scheduler for Scheduler { ) .await { - trace!(container_name = &request.id, err = ?e, "could not remove previous container"); + trace!(container_name = &request.id, err = ?e, "could not remove previous container; \ + This is not an actual error unless there was a failure because of container names"); } let mut container_config = bollard::container::Config {