Compare commits

..

3 commits

Author SHA1 Message Date
Renovate Bot
8dfbab2a98 chore(deps): update rust crate gix to 0.66
All checks were successful
ci/woodpecker/push/cron-docker-builder Pipeline was successful
ci/woodpecker/push/push-next Pipeline was successful
ci/woodpecker/push/tag-created Pipeline was successful
ci/woodpecker/pr/cron-docker-builder Pipeline was successful
ci/woodpecker/pr/push-next Pipeline was successful
ci/woodpecker/pr/tag-created Pipeline was successful
ci/woodpecker/pull_request_closed/cron-docker-builder Pipeline was successful
ci/woodpecker/pull_request_closed/push-next Pipeline was successful
ci/woodpecker/pull_request_closed/tag-created Pipeline was successful
2024-08-22 20:01:29 +00:00
bd6b0b2d31 WIP: feat(tui): update state model from server messages
All checks were successful
ci/woodpecker/push/cron-docker-builder Pipeline was successful
ci/woodpecker/push/push-next Pipeline was successful
ci/woodpecker/push/tag-created Pipeline was successful
2024-08-22 19:55:32 +01:00
7a4f9a45a6 fix(github): register webhook with valid callback url
All checks were successful
Rust / build (push) Successful in 8m58s
ci/woodpecker/push/cron-docker-builder Pipeline was successful
ci/woodpecker/push/push-next Pipeline was successful
ci/woodpecker/push/tag-created Pipeline was successful
Release Please / Release-plz (push) Successful in 1m33s
2024-08-22 19:55:32 +01:00
8 changed files with 68 additions and 59 deletions

96
Cargo.lock generated
View file

@ -1140,9 +1140,9 @@ dependencies = [
[[package]] [[package]]
name = "gix" name = "gix"
version = "0.65.0" version = "0.66.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb1e7d5c8cf04f07a23cf820f3dfb73b4f39661b8a7a3788c0cddd3a62275470" checksum = "9048b8d1ae2104f045cb37e5c450fc49d5d8af22609386bfc739c11ba88995eb"
dependencies = [ dependencies = [
"gix-actor", "gix-actor",
"gix-archive", "gix-archive",
@ -1200,9 +1200,9 @@ dependencies = [
[[package]] [[package]]
name = "gix-actor" name = "gix-actor"
version = "0.31.6" version = "0.32.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cbe658f16ec1f0d13030387dd24fbfc65d8ed150c31c29c4b5f8c144266130fe" checksum = "fc19e312cd45c4a66cd003f909163dc2f8e1623e30a0c0c6df3776e89b308665"
dependencies = [ dependencies = [
"bstr", "bstr",
"gix-date", "gix-date",
@ -1214,9 +1214,9 @@ dependencies = [
[[package]] [[package]]
name = "gix-archive" name = "gix-archive"
version = "0.14.0" version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e314d364e37fc8c5a16035267790c4bf85e02ba600c37f92145102a7b2fe6d42" checksum = "9147c08a55c1398b755539e2cdd63ff690ffe4a2e5e5e0780ee6ef2b49b0a60a"
dependencies = [ dependencies = [
"bstr", "bstr",
"gix-date", "gix-date",
@ -1289,9 +1289,9 @@ dependencies = [
[[package]] [[package]]
name = "gix-config" name = "gix-config"
version = "0.39.0" version = "0.40.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa1c5461ad7c83cf44df0383938c9b7cdd68ce6b72a97557c35e79243fff9134" checksum = "78e797487e6ca3552491de1131b4f72202f282fb33f198b1c34406d765b42bb0"
dependencies = [ dependencies = [
"bstr", "bstr",
"gix-config-value", "gix-config-value",
@ -1352,9 +1352,9 @@ dependencies = [
[[package]] [[package]]
name = "gix-diff" name = "gix-diff"
version = "0.45.0" version = "0.46.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c9903cd89d3d8b8a6eb5f7670068edb4bbdbb0d4d35692953fb3f536540d18a" checksum = "92c9afd80fff00f8b38b1c1928442feb4cd6d2232a6ed806b6b193151a3d336c"
dependencies = [ dependencies = [
"bstr", "bstr",
"gix-command", "gix-command",
@ -1372,9 +1372,9 @@ dependencies = [
[[package]] [[package]]
name = "gix-dir" name = "gix-dir"
version = "0.7.0" version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "136b5ce3f00ca1e1762ae7fe3e4310ec4aaa9a2cc476253528fc7552ad9871be" checksum = "0ed3a9076661359a1c5a27c12ad6c3ebe2dd96b8b3c0af6488ab7c128b7bdd98"
dependencies = [ dependencies = [
"bstr", "bstr",
"gix-discover", "gix-discover",
@ -1392,9 +1392,9 @@ dependencies = [
[[package]] [[package]]
name = "gix-discover" name = "gix-discover"
version = "0.34.0" version = "0.35.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2161c72d1ed53d48de5f3b5cfc5eeb12128155d28a4ebc669682d790b7688d85" checksum = "0577366b9567376bc26e815fd74451ebd0e6218814e242f8e5b7072c58d956d2"
dependencies = [ dependencies = [
"bstr", "bstr",
"dunce", "dunce",
@ -1431,9 +1431,9 @@ dependencies = [
[[package]] [[package]]
name = "gix-filter" name = "gix-filter"
version = "0.12.0" version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6e25a07487c4fa82ced7c447d2dd50e5564e4cfcc2067d56f5eff256668c686" checksum = "4121790ae140066e5b953becc72e7496278138d19239be2e63b5067b0843119e"
dependencies = [ dependencies = [
"bstr", "bstr",
"encoding_rs", "encoding_rs",
@ -1509,9 +1509,9 @@ dependencies = [
[[package]] [[package]]
name = "gix-index" name = "gix-index"
version = "0.34.0" version = "0.35.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc49026fe0bf66199ac34dcf62188d11ec58010b47e99ea17b9afcfbcbbce5f6" checksum = "0cd4203244444017682176e65fd0180be9298e58ed90bd4a8489a357795ed22d"
dependencies = [ dependencies = [
"bitflags 2.5.0", "bitflags 2.5.0",
"bstr", "bstr",
@ -1548,9 +1548,9 @@ dependencies = [
[[package]] [[package]]
name = "gix-mailmap" name = "gix-mailmap"
version = "0.23.6" version = "0.24.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ccae7d8b2ac7c9841e480a93fb6bedef373f589c4d2af7a1baf473696257f49" checksum = "d7d522c8ec2501e1a5b2b4cb54e83cb5d9a52471c9d23b3a1e8dadaf063752f7"
dependencies = [ dependencies = [
"bstr", "bstr",
"gix-actor", "gix-actor",
@ -1560,9 +1560,9 @@ dependencies = [
[[package]] [[package]]
name = "gix-negotiate" name = "gix-negotiate"
version = "0.14.0" version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69f9fb6d2c086176a1a4477932fa21ea722a65c1bd8b160a21d98a9f649c9666" checksum = "b4063bf329a191a9e24b6f948a17ccf6698c0380297f5e169cee4f1d2ab9475b"
dependencies = [ dependencies = [
"bitflags 2.5.0", "bitflags 2.5.0",
"gix-commitgraph", "gix-commitgraph",
@ -1576,9 +1576,9 @@ dependencies = [
[[package]] [[package]]
name = "gix-object" name = "gix-object"
version = "0.43.0" version = "0.44.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d93ebbb1f8bce952842512b13c13524aeda849790422d3a6ea5b85252fb74f35" checksum = "2f5b801834f1de7640731820c2df6ba88d95480dc4ab166a5882f8ff12b88efa"
dependencies = [ dependencies = [
"bstr", "bstr",
"gix-actor", "gix-actor",
@ -1595,9 +1595,9 @@ dependencies = [
[[package]] [[package]]
name = "gix-odb" name = "gix-odb"
version = "0.62.0" version = "0.63.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c74c9519d081cee9f61988b9296a14a70dda1d67a325c10a5319bcd2ac09507a" checksum = "a3158068701c17df54f0ab2adda527f5a6aca38fd5fd80ceb7e3c0a2717ec747"
dependencies = [ dependencies = [
"arc-swap", "arc-swap",
"gix-date", "gix-date",
@ -1615,9 +1615,9 @@ dependencies = [
[[package]] [[package]]
name = "gix-pack" name = "gix-pack"
version = "0.52.0" version = "0.53.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9bc6aaa19d59fa90c3c330b241757fd70eb6a3d9686869b6827f92c0494c1460" checksum = "3223aa342eee21e1e0e403cad8ae9caf9edca55ef84c347738d10681676fd954"
dependencies = [ dependencies = [
"clru", "clru",
"gix-chunk", "gix-chunk",
@ -1730,9 +1730,9 @@ dependencies = [
[[package]] [[package]]
name = "gix-ref" name = "gix-ref"
version = "0.46.0" version = "0.47.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "76a6ee8accf461c3facdf11af5b72c2e9705518fa679ad32835988d21605b836" checksum = "ae0d8406ebf9aaa91f55a57f053c5a1ad1a39f60fdf0303142b7be7ea44311e5"
dependencies = [ dependencies = [
"gix-actor", "gix-actor",
"gix-features", "gix-features",
@ -1751,9 +1751,9 @@ dependencies = [
[[package]] [[package]]
name = "gix-refspec" name = "gix-refspec"
version = "0.24.0" version = "0.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "759589a6650e178061ad2891f46e393782319042c5cc9f6575045584ab8f91dd" checksum = "ebb005f82341ba67615ffdd9f7742c87787544441c88090878393d0682869ca6"
dependencies = [ dependencies = [
"bstr", "bstr",
"gix-hash", "gix-hash",
@ -1765,9 +1765,9 @@ dependencies = [
[[package]] [[package]]
name = "gix-revision" name = "gix-revision"
version = "0.28.0" version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd9601e5f2008c794a011502419e5b7a5c3b069477bcde88566be17682ad9201" checksum = "ba4621b219ac0cdb9256883030c3d56a6c64a6deaa829a92da73b9a576825e1e"
dependencies = [ dependencies = [
"bstr", "bstr",
"gix-date", "gix-date",
@ -1781,9 +1781,9 @@ dependencies = [
[[package]] [[package]]
name = "gix-revwalk" name = "gix-revwalk"
version = "0.14.0" version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c9383f0b593f26c6137b3c15ec137efbe3e6edf1f200b4cfaba62c01d8efde0" checksum = "b41e72544b93084ee682ef3d5b31b1ba4d8fa27a017482900e5e044d5b1b3984"
dependencies = [ dependencies = [
"gix-commitgraph", "gix-commitgraph",
"gix-date", "gix-date",
@ -1808,9 +1808,9 @@ dependencies = [
[[package]] [[package]]
name = "gix-status" name = "gix-status"
version = "0.12.0" version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b7dcedb122d21c79ef70882b67f52d1ae7b88ee67c02d1c7bb5ed2ae405054c" checksum = "f70d35ba639f0c16a6e4cca81aa374a05f07b23fa36ee8beb72c100d98b4ffea"
dependencies = [ dependencies = [
"bstr", "bstr",
"filetime", "filetime",
@ -1831,9 +1831,9 @@ dependencies = [
[[package]] [[package]]
name = "gix-submodule" name = "gix-submodule"
version = "0.13.0" version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf6dea7eb19aeea81b2e62d9234774d98ee00e0b4514ac5a54aa87a41b9b2185" checksum = "529d0af78cc2f372b3218f15eb1e3d1635a21c8937c12e2dd0b6fc80c2ca874b"
dependencies = [ dependencies = [
"bstr", "bstr",
"gix-config", "gix-config",
@ -1887,9 +1887,9 @@ dependencies = [
[[package]] [[package]]
name = "gix-traverse" name = "gix-traverse"
version = "0.40.0" version = "0.41.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f9f4e2fbc50a17acd761c11fbb7ad4f6989e86c33198b4d0c100b621fd7eb68" checksum = "030da39af94e4df35472e9318228f36530989327906f38e27807df305fccb780"
dependencies = [ dependencies = [
"bitflags 2.5.0", "bitflags 2.5.0",
"gix-commitgraph", "gix-commitgraph",
@ -1939,9 +1939,9 @@ dependencies = [
[[package]] [[package]]
name = "gix-worktree" name = "gix-worktree"
version = "0.35.0" version = "0.36.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "227063bbb4f6433c6d99d5d0159ce9629130af2d8290eca32af4844647dc0b8b" checksum = "c312ad76a3f2ba8e865b360d5cb3aa04660971d16dec6dd0ce717938d903149a"
dependencies = [ dependencies = [
"bstr", "bstr",
"gix-attributes", "gix-attributes",
@ -1958,9 +1958,9 @@ dependencies = [
[[package]] [[package]]
name = "gix-worktree-state" name = "gix-worktree-state"
version = "0.12.0" version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e642abb27238df9d43c1f00f8f45b060abd81881187fc67adb09999d4b1a8fe4" checksum = "7b05c4b313fa702c0bacd5068dd3e01671da73b938fade97676859fee286de43"
dependencies = [ dependencies = [
"bstr", "bstr",
"gix-features", "gix-features",
@ -1978,9 +1978,9 @@ dependencies = [
[[package]] [[package]]
name = "gix-worktree-stream" name = "gix-worktree-stream"
version = "0.14.0" version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "71fba7618d140b6a7b679da90d492b49f906fcdec8199e36a845164656421ede" checksum = "68e81b87c1a3ece22a54b682d6fdc37fbb3977132da972cafe5ec07175fddbca"
dependencies = [ dependencies = [
"gix-attributes", "gix-attributes",
"gix-features", "gix-features",

View file

@ -50,7 +50,7 @@ hex = "0.4"
# git # git
# gix = "0.62" # gix = "0.62"
gix = { version = "0.65", features = [ gix = { version = "0.66", features = [
"dirwalk", "dirwalk",
"blocking-http-transport-reqwest-rust-tls", "blocking-http-transport-reqwest-rust-tls",
] } ] }

View file

@ -18,22 +18,26 @@ impl Handler<CloneRepo> for RepoActor {
#[instrument(name = "RepoActor::CloneRepo", skip_all, fields(repo = %self.repo_details))] #[instrument(name = "RepoActor::CloneRepo", skip_all, fields(repo = %self.repo_details))]
fn handle(&mut self, _msg: CloneRepo, ctx: &mut Self::Context) -> Self::Result { fn handle(&mut self, _msg: CloneRepo, ctx: &mut Self::Context) -> Self::Result {
logger(self.log.as_ref(), "Handler: CloneRepo: start"); logger(self.log.as_ref(), "Handler: CloneRepo: start");
self.update_tui(RepoUpdate::Cloning); self.update_tui(RepoUpdate::Opening);
debug!("Handler: CloneRepo: start"); debug!("Handler: CloneRepo: start");
match git::repository::open(&*self.repository_factory, &self.repo_details) { match git::repository::open(&*self.repository_factory, &self.repo_details) {
Ok(repository) => { Ok(repository) => {
logger(self.log.as_ref(), "open okay"); logger(self.log.as_ref(), "open okay");
debug!("open okay"); debug!("open okay");
self.update_tui(RepoUpdate::Opened);
self.open_repository.replace(repository); self.open_repository.replace(repository);
if self.repo_details.repo_config.is_none() { if self.repo_details.repo_config.is_none() {
self.update_tui(RepoUpdate::LoadingConfigFromRepo);
do_send(&ctx.address(), LoadConfigFromRepo, self.log.as_ref()); do_send(&ctx.address(), LoadConfigFromRepo, self.log.as_ref());
} else { } else {
self.update_tui(RepoUpdate::RegisteringWebhook);
do_send(&ctx.address(), RegisterWebhook::new(), self.log.as_ref()); do_send(&ctx.address(), RegisterWebhook::new(), self.log.as_ref());
} }
} }
Err(err) => { Err(err) => {
logger(self.log.as_ref(), "open failed"); logger(self.log.as_ref(), "open failed");
warn!("Could not open repo: {err:?}"); warn!("Could not open repo: {err:?}");
self.alert_tui(err.to_string());
} }
} }
debug!("Handler: CloneRepo: finish"); debug!("Handler: CloneRepo: finish");

View file

@ -1,7 +1,7 @@
// //
use actix::prelude::*; use actix::prelude::*;
use tracing::{debug, Instrument as _}; use tracing::{debug, error, Instrument as _};
use crate::{ use crate::{
repo::{ repo::{
@ -33,7 +33,7 @@ impl Handler<RegisterWebhook> for RepoActor {
async move { async move {
match forge.register_webhook(&repo_listen_url).await { match forge.register_webhook(&repo_listen_url).await {
Ok(registered_webhook) => { Ok(registered_webhook) => {
debug!(?registered_webhook, ""); debug!(?registered_webhook, "webhook registered");
do_send( do_send(
&addr, &addr,
WebhookRegistered::from(registered_webhook), WebhookRegistered::from(registered_webhook),
@ -41,6 +41,7 @@ impl Handler<RegisterWebhook> for RepoActor {
); );
} }
Err(err) => { Err(err) => {
error!(?err, "failed to register webhook");
notify_user( notify_user(
notify_user_recipient.as_ref(), notify_user_recipient.as_ref(),
UserNotification::WebhookRegistration { UserNotification::WebhookRegistration {
@ -56,6 +57,8 @@ impl Handler<RegisterWebhook> for RepoActor {
.in_current_span() .in_current_span()
.into_actor(self) .into_actor(self)
.wait(ctx); .wait(ctx);
} else {
self.alert_tui("already have a webhook id - cant register webhook");
} }
} }
} }

View file

@ -73,7 +73,7 @@ pub enum RepoUpdate {
AdvancingMain { AdvancingMain {
commit: git::Commit, commit: git::Commit,
}, },
Cloning, Opening,
LoadingConfigFromRepo, LoadingConfigFromRepo,
ReceiveCIStatus { ReceiveCIStatus {
status: Status, status: Status,
@ -88,6 +88,7 @@ pub enum RepoUpdate {
push: Push, push: Push,
}, },
RegisteredWebhook, RegisteredWebhook,
Opened,
} }
message!( message!(

View file

@ -56,8 +56,11 @@ impl Handler<ServerUpdate> for Tui {
RepoUpdate::AdvancingMain { commit } => { RepoUpdate::AdvancingMain { commit } => {
repo_state.update_message(format!("advancing main to {commit}")); repo_state.update_message(format!("advancing main to {commit}"));
} }
RepoUpdate::Cloning => { RepoUpdate::Opening => {
repo_state.update_message("cloning..."); repo_state.update_message("opening...");
}
RepoUpdate::Opened => {
repo_state.update_message("opened");
} }
RepoUpdate::LoadingConfigFromRepo => { RepoUpdate::LoadingConfigFromRepo => {
repo_state.update_message("loading config from repo..."); repo_state.update_message("loading config from repo...");

View file

@ -5,11 +5,9 @@ use ratatui::{
buffer::Buffer, buffer::Buffer,
layout::{Constraint, Direction, Layout, Rect}, layout::{Constraint, Direction, Layout, Rect},
text::{Line, Text}, text::{Line, Text},
widgets::{Paragraph, Widget}, widgets::Widget,
}; };
use crate::trace_dbg;
pub struct ConfiguredRepoWidget<'a> { pub struct ConfiguredRepoWidget<'a> {
pub repo_alias: &'a RepoAlias, pub repo_alias: &'a RepoAlias,
pub message: &'a str, pub message: &'a str,

View file

@ -35,7 +35,7 @@ pub async fn register(
"active": true, "active": true,
"events": ["push"], "events": ["push"],
"config": { "config": {
"url": repo_listen_url.as_ref(), "url": repo_listen_url.to_string(),
"content_type": "json", "content_type": "json",
"secret": authorisation.to_string(), "secret": authorisation.to_string(),
"insecure_ssl": "0", "insecure_ssl": "0",