Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions helix-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ dotenvy = "0.15.7"
tokio-tungstenite = "0.28.0"
futures-util = "0.3.31"
regex = "1.11.2"
sha2 = "0.10"
reqwest-eventsource = "0.6"
indicatif = "0.18.3"
webbrowser = "1.0"
Expand Down
15 changes: 12 additions & 3 deletions helix-cli/src/commands/add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,12 @@ async fn run_add_inner(
// Authenticate and run workspace/project/cluster flow
let credentials = crate::commands::auth::require_auth().await?;
let project_name = &project_context.config.project.name;
let flow_result =
workspace_flow::run_workspace_project_cluster_flow(project_name, &credentials)
.await?;
let flow_result = workspace_flow::run_workspace_project_cluster_flow(
project_name,
project_context.config.project.id.as_deref(),
&credentials,
)
.await?;

if flow_result.resolved_project_name != project_context.config.project.name {
crate::output::info(&format!(
Expand All @@ -118,6 +121,12 @@ async fn run_add_inner(
project_context.config.project.name = flow_result.resolved_project_name;
}

if project_context.config.project.id.as_deref()
!= Some(flow_result.resolved_project_id.as_str())
{
project_context.config.project.id = Some(flow_result.resolved_project_id.clone());
}

match flow_result.cluster {
ClusterResult::Standard(std_result) => {
let cloud_config = CloudInstanceConfig {
Expand Down
2 changes: 2 additions & 0 deletions helix-cli/src/commands/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,13 @@ async fn run_init_inner(
let credentials = crate::commands::auth::require_auth().await?;
let result = workspace_flow::run_workspace_project_cluster_flow(
project_name,
config.project.id.as_deref(),
&credentials,
)
.await?;

config.project.name = result.resolved_project_name;
config.project.id = Some(result.resolved_project_id);

// Backup config before saving
cleanup_tracker.backup_config(&config, config_path.clone());
Expand Down
41 changes: 38 additions & 3 deletions helix-cli/src/commands/integrations/helix.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::commands::auth::require_auth;
use crate::config::{BuildMode, CloudInstanceConfig, DbConfig, InstanceInfo};
use crate::config::{BuildMode, CloudConfig, CloudInstanceConfig, DbConfig, InstanceInfo};
use crate::output;
use crate::project::ProjectContext;
use crate::sse_client::{SseEvent, SseProgressHandler, parse_sse_event};
Expand Down Expand Up @@ -289,7 +289,10 @@ impl<'a> HelixManager<'a> {
let sse_event: SseEvent = match parse_sse_event(&message.data) {
Ok(event) => event,
Err(e) => {
progress.println(&format!("Failed to parse event: {}", e));
output::verbose(&format!(
"Ignoring unrecognized deploy SSE payload: {}",
e
));
continue;
}
};
Expand Down Expand Up @@ -485,6 +488,35 @@ impl<'a> HelixManager<'a> {
Ok(())
}

pub(crate) async fn deploy_by_cluster_id(
&self,
path: Option<String>,
cluster_id: &str,
cluster_name_hint: &str,
build_mode_override: Option<BuildMode>,
) -> Result<()> {
if let Some(instance_name) =
self.project
.config
.cloud
.iter()
.find_map(|(instance_name, cloud_config)| match cloud_config {
CloudConfig::Helix(config) if config.cluster_id == cluster_id => {
Some(instance_name.clone())
}
_ => None,
})
{
return self.deploy(path, instance_name, build_mode_override).await;
}

Err(eyre!(
"Cluster '{}' is not configured in helix.toml. Run 'helix sync' to refresh cluster metadata, then retry syncing cluster '{}'.",
cluster_id,
cluster_name_hint
))
}

/// Deploy .rs files to an enterprise cluster
pub(crate) async fn deploy_enterprise(
&self,
Expand Down Expand Up @@ -574,7 +606,10 @@ impl<'a> HelixManager<'a> {
let sse_event: SseEvent = match parse_sse_event(&message.data) {
Ok(event) => event,
Err(e) => {
progress.println(&format!("Failed to parse event: {}", e));
output::verbose(&format!(
"Ignoring unrecognized deploy SSE payload: {}",
e
));
continue;
}
};
Expand Down
1 change: 1 addition & 0 deletions helix-cli/src/commands/migrate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,7 @@ fn create_v2_config(ctx: &MigrationContext) -> Result<()> {

// Create project config
let project_config = ProjectConfig {
id: None,
name: ctx.project_name.clone(),
queries: PathBuf::from(&ctx.queries_dir),
container_runtime: ContainerRuntime::Docker,
Expand Down
Loading