diff --git a/backend/src/catalog/controllers.rs b/backend/src/catalog/controllers.rs index 2d7aca2..f6b8de4 100644 --- a/backend/src/catalog/controllers.rs +++ b/backend/src/catalog/controllers.rs @@ -127,16 +127,6 @@ pub async fn exec_catalog_service_post_validate_scripts( Err(err) => return err }; - // execute validate scripts - for cmd in service.validate.as_ref().unwrap_or(&vec![]) { - let _ = match execute_command(cmd, req.payload.to_string().as_str()).await { - Ok(_) => (), - Err(err) => return (StatusCode::BAD_REQUEST, Json(JobResponse { - message: Some(err), - })) - }; - } - let ces = match insert_catalog_run( &pg_pool, &catalog_slug, diff --git a/backend/src/catalog/services.rs b/backend/src/catalog/services.rs index ac61897..d8bdbbe 100644 --- a/backend/src/catalog/services.rs +++ b/backend/src/catalog/services.rs @@ -54,6 +54,8 @@ pub async fn background_worker(mut rx: Receiver, pg_pool: let mut tasks = Vec::::new(); + let mut last_task_value = serde_json::Value::Array(vec![]); + for cmd in task.catalog_service_yaml_config.post_validate.as_ref().unwrap_or(&vec![]) { let job_output_result = match execute_command(cmd, task.req.payload.to_string().as_str()).await { Ok(job_output_result) => job_output_result, @@ -89,12 +91,21 @@ pub async fn background_worker(mut rx: Receiver, pg_pool: let _ = tasks.push(task_payload); + last_task_value = serde_json::to_value(tasks.clone()).unwrap(); + let _ = update_catalog_run( &pg_pool, task.catalog_execution_status_id.as_str(), - Status::Success, - &serde_json::to_value(tasks.clone()).unwrap(), + Status::Running, + &last_task_value, ).await; } + + let _ = update_catalog_run( + &pg_pool, + task.catalog_execution_status_id.as_str(), + Status::Success, + &last_task_value, + ).await; } }