Compare commits

..

7 commits

Author SHA1 Message Date
0796af1485 WIP: cli: ???
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-06-19 07:03:25 +01:00
2851059fd6 WIP: server: ??? 2024-06-19 07:03:17 +01:00
bc338d7703 WIP: repo-actor: ??? 2024-06-19 07:03:08 +01:00
a9b35bdac5 WIP: forgejo: ??? 2024-06-19 07:03:01 +01:00
74cf9a5d53 WIP: forgejo: ??? 2024-06-19 07:02:49 +01:00
ac1baf8db0 WIP: git: use newtype 2024-06-19 07:02:35 +01:00
28c8f6ebdf WIP: config: use newtype 2024-06-19 07:02:18 +01:00
2 changed files with 26 additions and 13 deletions

View file

@ -716,7 +716,7 @@ pub mod given {
pub fn a_git_dir(fs: &kxio::fs::FileSystem) -> GitDir {
let dir_name = a_name();
let dir = fs.base().join(dir_name);
GitDir::new(dir)
GitDir::new(&dir)
}
pub fn a_forge_config() -> ForgeConfig {
@ -730,9 +730,9 @@ pub mod given {
}
pub fn a_server_repo_config() -> ServerRepoConfig {
let main = a_branch_name().to_string();
let next = a_branch_name().to_string();
let dev = a_branch_name().to_string();
let main = a_branch_name().into_string();
let next = a_branch_name().into_string();
let dev = a_branch_name().into_string();
ServerRepoConfig::new(
format!("{}/{}", a_name(), a_name()),
main.clone(),

View file

@ -101,13 +101,19 @@ impl Handler<ServerConfig> for Server {
// Forge Actors
for (forge_alias, forge_config) in server_config.forges() {
self.create_forge_repos(forge_config, forge_alias.clone(), server_storage, webhook)
.into_iter()
.map(|a| self.start_actor(a))
.map(|(repo_alias, addr)| {
AddWebhookRecipient::new(forge_alias.clone(), repo_alias, addr.recipient())
})
.for_each(|msg| webhook_router.do_send(msg));
self.create_forge_repos(
forge_config,
forge_alias.clone(),
server_storage,
webhook,
self.sleep_duration,
)
.into_iter()
.map(|a| self.start_actor(a))
.map(|(repo_alias, addr)| {
AddWebhookRecipient::new(forge_alias.clone(), repo_alias, addr.recipient())
})
.for_each(|msg| webhook_router.do_send(msg));
}
let webhook = WebhookActor::new(socket_addr, webhook_router.recipient()).start();
@ -158,6 +164,7 @@ impl Server {
forge_name: ForgeAlias,
server_storage: &ServerStorage,
webhook: &Webhook,
sleep_duration: std::time::Duration,
) -> Vec<(ForgeAlias, RepoAlias, repo_actor::RepoActor)> {
let span =
tracing::info_span!("create_forge_repos", name = %forge_name, config = %forge_config);
@ -165,7 +172,13 @@ impl Server {
let _guard = span.enter();
info!("Creating Forge");
let mut repos = vec![];
let creator = self.create_actor(forge_name, forge_config.clone(), server_storage, webhook);
let creator = self.create_actor(
forge_name,
forge_config.clone(),
server_storage,
webhook,
sleep_duration,
);
for (repo_alias, server_repo_config) in forge_config.repos() {
let forge_repo = creator((repo_alias, server_repo_config));
info!(
@ -183,6 +196,7 @@ impl Server {
forge_config: ForgeConfig,
server_storage: &ServerStorage,
webhook: &Webhook,
sleep_duration: std::time::Duration,
) -> impl Fn((RepoAlias, &ServerRepoConfig)) -> (ForgeAlias, RepoAlias, repo_actor::RepoActor)
{
let server_storage = server_storage.clone();
@ -190,7 +204,6 @@ impl Server {
let net = self.net.clone();
let repo = self.repo.clone();
let generation = self.generation;
let sleep_duration = self.sleep_duration;
move |(repo_alias, server_repo_config)| {
let span = tracing::info_span!("create_actor", alias = %repo_alias, config = %server_repo_config);
let _guard = span.enter();