Skip to content

Commit e577bbb

Browse files
committed
[orion]FIX: update branch and fix conflicts
1 parent 4cf84d9 commit e577bbb

12 files changed

Lines changed: 244 additions & 240 deletions

File tree

api-model/src/buck2/api.rs

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@ use crate::buck2::{status::Status, types::ProjectRelativePath};
1515

1616
/// Parameters required to build a task.
1717
#[allow(dead_code)]
18-
#[derive(Debug, Deserialize, Serialize)]
18+
#[derive(Debug, Deserialize, Serialize, ToSchema)]
1919
pub struct TaskBuildRequest {
2020
/// The repository base path
2121
pub repo: String,
2222
/// The change list link (URL)
2323
pub cl_link: String,
24+
//TODO: for old database only, delete after updated
25+
pub cl_id: i64,
2426
/// The list of file diff changes
2527
pub changes: Vec<Status<ProjectRelativePath>>,
2628
/// Buck2 target path (e.g. //app:server). Optional for backward compatibility.
@@ -39,21 +41,26 @@ impl TaskBuildRequest {
3941
pub struct RetryBuildRequest {
4042
pub build_id: String,
4143
pub cl_link: String,
42-
pub cl: i64,
44+
pub cl_id: i64,
4345
pub changes: Vec<Status<ProjectRelativePath>>,
46+
pub targets: Option<Vec<String>>,
4447
}
4548

4649
/// Result of a task build operation containing status and metadata. Used by Orion-Server
4750
#[allow(dead_code)]
48-
#[derive(Debug, Deserialize, Serialize)]
49-
pub struct TaskBuildResult {
50-
/// Whether the build operation was successful
51-
pub success: bool,
51+
#[derive(Debug, Deserialize, Serialize, ToSchema)]
52+
pub struct OrionBuildResult {
5253
/// Unique identifier for the build task
53-
pub id: String,
54-
/// Process exit code (None if not yet completed)
55-
#[serde(skip_serializing_if = "Option::is_none")]
56-
pub exit_code: Option<i32>,
54+
pub build_id: String,
55+
/// Current status of the build (e.g., "queued", "running", "success", "failure")
56+
pub status: String,
5757
/// Human-readable status or error message
5858
pub message: String,
5959
}
60+
61+
/// Response structure for build-related API endpoints in Orion-Server
62+
#[derive(Debug, Deserialize, Serialize, ToSchema)]
63+
pub struct OrionServerResponse {
64+
pub task_id: String,
65+
pub results: Vec<OrionBuildResult>,
66+
}

api-model/src/buck2/ws.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ use crate::buck2::{
1313
#[serde(tag = "type")]
1414
pub enum WSMessage {
1515
// Server -> Worker messages
16-
Task {
17-
id: String,
16+
TaskBuild {
17+
build_id: String,
1818
repo: String,
1919
cl_link: String,
2020
changes: Vec<Status<ProjectRelativePath>>,
2121
},
2222

23-
TaskWithTargets {
24-
id: String,
23+
TaskBuildWithTargets {
24+
build_id: String,
2525
repo: String,
2626
cl_link: String,
2727
// targets: Vec<Target>,
@@ -38,23 +38,23 @@ pub enum WSMessage {
3838
Heartbeat,
3939

4040
TaskPhaseUpdate {
41-
id: String,
41+
build_id: String,
4242
phase: TaskPhase,
4343
},
4444

4545
TaskAck {
46-
id: String,
46+
build_id: String,
4747
success: bool,
4848
message: String,
4949
},
5050

5151
TaskBuildOutput {
52-
id: String,
52+
build_id: String,
5353
output: String,
5454
},
5555

5656
TaskBuildComplete {
57-
id: String,
57+
build_id: String,
5858
success: bool,
5959
exit_code: Option<i32>,
6060
message: String,

jupiter/callisto/src/build_events.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,24 @@ pub struct Model {
2020
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
2121
pub enum Relation {
2222
#[sea_orm(
23-
belongs_to = "super::tasks::Entity",
23+
belongs_to = "super::orion_tasks::Entity",
2424
from = "Column::TaskId",
25-
to = "super::tasks::Column::Id",
25+
to = "super::orion_tasks::Column::Id",
2626
on_update = "Cascade",
2727
on_delete = "Cascade"
2828
)]
29-
Tasks,
29+
OrionTasks,
3030
}
3131

32-
impl Related<super::tasks::Entity> for Entity {
32+
impl Related<super::orion_tasks::Entity> for Entity {
3333
fn to() -> RelationDef {
34-
Relation::Tasks.def()
34+
Relation::OrionTasks.def()
3535
}
3636
}
3737

3838
impl ActiveModelBehavior for ActiveModel {}
3939

40+
#[allow(dead_code)]
4041
trait BuildModel {
4142
/// Crete a new build event ActiveModel for database insertion
4243
fn create_build_event(

jupiter/callisto/src/builds.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,18 @@ pub struct Model {
2424
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
2525
pub enum Relation {
2626
#[sea_orm(
27-
belongs_to = "super::tasks::Entity",
27+
belongs_to = "super::orion_tasks::Entity",
2828
from = "Column::TaskId",
29-
to = "super::tasks::Column::Id",
29+
to = "super::orion_tasks::Column::Id",
3030
on_update = "NoAction",
3131
on_delete = "Cascade"
3232
)]
33-
Tasks,
33+
OrionTasks,
3434
}
3535

36-
impl Related<super::tasks::Entity> for Entity {
36+
impl Related<super::orion_tasks::Entity> for Entity {
3737
fn to() -> RelationDef {
38-
Relation::Tasks.def()
38+
Relation::OrionTasks.def()
3939
}
4040
}
4141

jupiter/callisto/src/mega_code_review_thread.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use sea_orm::entity::prelude::*;
44
use serde::{Deserialize, Serialize};
55

6-
use super::sea_orm_active_enums::{ThreadStatusEnum};
6+
use super::sea_orm_active_enums::ThreadStatusEnum;
77

88
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
99
#[sea_orm(table_name = "mega_code_review_thread")]

0 commit comments

Comments
 (0)