mirror of
https://github.com/moghtech/komodo.git
synced 2026-09-08 16:01:18 +00:00
monrun sync work
This commit is contained in:
@@ -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()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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>>,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user