From 9aec305c06cd14ded339377c8be883d8c45c2f08 Mon Sep 17 00:00:00 2001 From: Chris Date: Wed, 22 Apr 2026 15:12:47 -0500 Subject: [PATCH] added better logging for builds & deploys --- app/avo/resources/build.rb | 9 +++++++++ app/avo/resources/deployment.rb | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/app/avo/resources/build.rb b/app/avo/resources/build.rb index b18cba15..60f05bf4 100644 --- a/app/avo/resources/build.rb +++ b/app/avo/resources/build.rb @@ -16,5 +16,14 @@ class Avo::Resources::Build < Avo::BaseResource field :git_sha, as: :text field :commit_sha, as: :text field :commit_message, as: :text, format_using: -> { value.truncate 30 } + + field :logs, as: :code, language: "shell", theme: "dracula" do + lines = record.log_outputs.order(:created_at).pluck(:output).map { |o| o.gsub(/\e\[\d+m/, "") } + if view == :show + lines.join("\n") + else + lines.last(20).join("\n") + end + end end end diff --git a/app/avo/resources/deployment.rb b/app/avo/resources/deployment.rb index 680cb0d8..58dd1310 100644 --- a/app/avo/resources/deployment.rb +++ b/app/avo/resources/deployment.rb @@ -6,5 +6,14 @@ class Avo::Resources::Deployment < Avo::BaseResource field :created_at, as: :date_time field :updated_at, as: :date_time field :project, as: :belongs_to + + field :logs, as: :code, language: "shell", theme: "dracula" do + lines = record.log_outputs.order(:created_at).pluck(:output).map { |o| o.gsub(/\e\[\d+m/, "") } + if view == :show + lines.join("\n") + else + lines.last(20).join("\n") + end + end end end