feat(server): Don't load config from repo if repo config is in server config
Some checks failed
ci/woodpecker/push/cron-docker-builder Pipeline was successful
ci/woodpecker/push/tag-created Pipeline was successful
ci/woodpecker/push/push-next Pipeline failed

Closes kemitix/git-next#77
This commit is contained in:
Paul Campbell 2024-05-08 07:14:14 +01:00
parent 6d147efe32
commit ec2ebe70cf

View file

@ -100,7 +100,15 @@ impl Handler<CloneRepo> for RepoActor {
info!("Message Received"); info!("Message Received");
let gitdir = self.details.gitdir.clone(); let gitdir = self.details.gitdir.clone();
match self.forge.repo_clone(gitdir) { match self.forge.repo_clone(gitdir) {
Ok(_) => ctx.address().do_send(LoadConfigFromRepo), Ok(_) => {
if self.details.repo_config.is_none() {
ctx.address().do_send(LoadConfigFromRepo);
} else {
ctx.address().do_send(ValidateRepo {
message_token: self.message_token,
});
}
}
Err(err) => warn!("Could not Clone repo: {err}"), Err(err) => warn!("Could not Clone repo: {err}"),
} }
} }
@ -134,17 +142,7 @@ impl Handler<LoadedConfig> for RepoActor {
info!("Message Received"); info!("Message Received");
let repo_config = msg.0; let repo_config = msg.0;
self.details.repo_config.replace(repo_config); self.details.repo_config.replace(repo_config);
if self.webhook_id.is_none() {
webhook::register(
self.details.clone(),
self.webhook.clone(),
ctx.address(),
self.net.clone(),
)
.in_current_span()
.into_actor(self)
.wait(ctx);
}
ctx.address().do_send(ValidateRepo { ctx.address().do_send(ValidateRepo {
message_token: self.message_token, message_token: self.message_token,
}); });
@ -179,6 +177,17 @@ impl Handler<ValidateRepo> for RepoActor {
} }
} }
info!("Message Received"); info!("Message Received");
if self.webhook_id.is_none() {
webhook::register(
self.details.clone(),
self.webhook.clone(),
ctx.address(),
self.net.clone(),
)
.in_current_span()
.into_actor(self)
.wait(ctx);
}
if let Some(repo_config) = self.details.repo_config.clone() { if let Some(repo_config) = self.details.repo_config.clone() {
let forge = self.forge.clone(); let forge = self.forge.clone();
let addr = ctx.address(); let addr = ctx.address();