Compare commits

..

6 commits

Author SHA1 Message Date
1135d48c97 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:30:46 +01:00
0f8320f425 WIP: server: ??? 2024-06-19 07:29:52 +01:00
eb28a2b690 WIP: repo-actor: ??? 2024-06-19 07:26:46 +01:00
bd3fb7cff2 WIP: forgejo: ??? 2024-06-19 07:08:13 +01:00
8f786abe60 WIP: git: use newtype 2024-06-19 07:08:13 +01:00
e82c2804dc WIP: config: use newtype 2024-06-19 07:07:55 +01:00
2 changed files with 13 additions and 26 deletions

View file

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

View file

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