monrun sync work

This commit is contained in:
mbecker20
2024-03-26 04:42:24 -07:00
parent f1c9d05abc
commit 48ff1ebefa
2 changed files with 14 additions and 4 deletions
+11 -1
View File
@@ -44,9 +44,9 @@ pub async fn run_sync(path: &Path) -> anyhow::Result<()> {
wait_for_enter("CONTINUE")?;
// Run these first, which require no name -> id replacement
Alerter::run_updates(alerter_updates, alerter_creates).await;
Builder::run_updates(builder_updates, builder_creates).await;
Server::run_updates(server_updates, server_creates).await;
Alerter::run_updates(alerter_updates, alerter_creates).await;
Build::run_updates(build_updates, build_creates).await;
Deployment::run_updates(deployment_updates, deployment_creates)
@@ -147,6 +147,8 @@ pub trait ResourceSync {
let ext_lookup = Self::init_lookup_data().await;
let log_after = !to_update.is_empty() || !to_create.is_empty();
for (id, resource) in to_update {
// Update resource
let name = resource.name.clone();
@@ -165,6 +167,7 @@ pub trait ResourceSync {
)
.await;
Self::update_description(id, description).await;
info!("{} {name} updated", Self::display());
}
for resource in to_create {
@@ -189,6 +192,13 @@ pub trait ResourceSync {
)
.await;
Self::update_description(id, description).await;
info!("{} {name} created", Self::display());
}
if log_after {
info!(
"============ {}s synced ✅ ============",
Self::display()
);
}
}
+3 -3
View File
@@ -18,11 +18,11 @@ pub struct ResourceFile {
pub builds: Vec<Resource<PartialBuildConfig>>,
#[serde(default, rename = "deployment")]
pub deployments: Vec<Resource<PartialDeploymentConfig>>,
#[serde(rename = "builder")]
#[serde(default, rename = "builder")]
pub builders: Vec<Resource<PartialBuilderConfig>>,
#[serde(rename = "repo")]
#[serde(default, rename = "repo")]
pub repos: Vec<Resource<PartialRepoConfig>>,
#[serde(rename = "alerter")]
#[serde(default, rename = "alerter")]
pub alerters: Vec<Resource<PartialAlerterConfig>>,
}