-
Notifications
You must be signed in to change notification settings - Fork 122
Orion integrated with Scorpio. Added support for MR. #1252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,5 +1,6 @@ | ||||||||||
| use crate::ws::WSMessage; | ||||||||||
| use once_cell::sync::Lazy; | ||||||||||
| use serde_json::json; | ||||||||||
| use std::io; | ||||||||||
| use std::process::{ExitStatus, Stdio}; | ||||||||||
| use tokio::io::AsyncBufReadExt; | ||||||||||
|
|
@@ -9,13 +10,55 @@ use tokio::sync::mpsc::UnboundedSender; | |||||||||
| static PROJECT_ROOT: Lazy<String> = | ||||||||||
| Lazy::new(|| std::env::var("BUCK_PROJECT_ROOT").expect("BUCK_PROJECT_ROOT must be set")); | ||||||||||
|
|
||||||||||
|
|
||||||||||
| /// Sends a filesystem mount request to the specified API endpoint | ||||||||||
| /// Parameters: | ||||||||||
| /// - repo: Repository path to mount | ||||||||||
| /// - mr: Merge request number | ||||||||||
| /// Returns: Result containing the response body string on success, or an error on failure | ||||||||||
| pub async fn mount_fs(repo: &str, mr: &str) -> Result<String, reqwest::Error> { | ||||||||||
| // Create HTTP client | ||||||||||
| let client = reqwest::Client::new(); | ||||||||||
|
|
||||||||||
| // Construct JSON request payload | ||||||||||
| let payload = json!({ | ||||||||||
| "path": repo, | ||||||||||
| "mr": mr, | ||||||||||
| }); | ||||||||||
|
|
||||||||||
| // Send POST request | ||||||||||
| let res = client | ||||||||||
| .post("http://localhost:2725/api/fs/mount") | ||||||||||
| .header("Content-Type", "application/json") | ||||||||||
| .body(payload.to_string()) | ||||||||||
| .send() | ||||||||||
| .await?; | ||||||||||
|
|
||||||||||
| // Print status code | ||||||||||
| println!("Mount request status: {}", res.status()); | ||||||||||
|
|
||||||||||
| // Get and return response body | ||||||||||
| let body = res.text().await?; | ||||||||||
| println!("Mount response body: {body}"); | ||||||||||
|
|
||||||||||
| Ok(body) | ||||||||||
| } | ||||||||||
|
|
||||||||||
| pub async fn build( | ||||||||||
| id: String, | ||||||||||
| repo: String, | ||||||||||
| target: String, | ||||||||||
| args: Vec<String>, | ||||||||||
| mr: String, | ||||||||||
| sender: UnboundedSender<WSMessage>, | ||||||||||
| ) -> io::Result<ExitStatus> { | ||||||||||
|
|
||||||||||
| tracing::info!("Building {} in repo {} with target {}", id, repo, target); | ||||||||||
| // Prepare the command to run | ||||||||||
| // Note: `args` is a list of additional arguments to pass to the `buck | ||||||||||
|
||||||||||
| // Note: `args` is a list of additional arguments to pass to the `buck | |
| // Note: `args` is a list of additional arguments to pass to the `buck` command, | |
| // which is used to build the specified target in the given repository. |
Copilot
AI
Jul 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Silently ignoring the result of mount_fs could hide important errors. Consider handling the error appropriately, either by logging it or propagating it to the caller.
| let _ = mount_fs(&repo, &mr).await; | |
| if let Err(e) = mount_fs(&repo, &mr).await { | |
| tracing::error!("Failed to mount filesystem for repo {} and MR {}: {}", repo, mr, e); | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The hardcoded URL 'http://localhost:2725/api/fs/mount' should be configurable through environment variables or configuration files to support different deployment environments.