Skip to content

Commit 058003a

Browse files
Merge branch 'main' into feat/user-project-telemetry
2 parents b62986f + 5e5a2ac commit 058003a

File tree

4 files changed

+25
-9
lines changed

4 files changed

+25
-9
lines changed

api-client/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,10 @@ impl ShuttleApiClient {
130130
&self,
131131
project: &str,
132132
deployment_req: DeploymentRequest,
133+
force: bool,
133134
) -> Result<deployment::Response> {
134-
let path = format!("/projects/{project}/services/{project}");
135+
let query = if force { "?force=true" } else { "" };
136+
let path = format!("/projects/{project}/services/{project}{query}");
135137
let deployment_req = rmp_serde::to_vec(&deployment_req)
136138
.context("serialize DeploymentRequest as a MessagePack byte vector")?;
137139

cargo-shuttle/src/args.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,9 @@ pub struct DeployArgs {
356356
#[arg(long)]
357357
pub output_archive: Option<PathBuf>,
358358

359+
#[arg(long, hide = true)]
360+
pub force: bool,
361+
359362
#[command(flatten)]
360363
pub secret_args: SecretsArgs,
361364
}

cargo-shuttle/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2612,7 +2612,7 @@ impl Shuttle {
26122612

26132613
deployment_req.data = archive;
26142614
let deployment = client
2615-
.deploy(project_name, deployment_req)
2615+
.deploy(project_name, deployment_req, args.force)
26162616
.await
26172617
.map_err(suggestions::deploy::deploy_request_failure)?;
26182618

gateway/src/api/latest.rs

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -417,14 +417,25 @@ async fn delete_project(
417417
Ok(AxumJson("project successfully deleted".to_owned()))
418418
}
419419

420+
#[derive(Deserialize)]
421+
struct DeployQuery {
422+
force: Option<bool>,
423+
}
424+
420425
#[instrument(skip_all, fields(shuttle.project.name = %scoped_user.scope))]
421-
async fn override_create_service(scoped_user: ScopedUser) -> Result<Response<Body>, ApiError> {
422-
// Creating new deployments on the shuttle.rs platform is deprecated as of the first of January
423-
// 2025.
424-
return Err(Deprecated(
425-
"Creating new deployments on the shuttle.rs platform has been deprecated.".to_string(),
426-
)
427-
.into());
426+
async fn override_create_service(
427+
state: State<RouterState>,
428+
scoped_user: ScopedUser,
429+
Query(query): Query<DeployQuery>,
430+
req: Request<Body>,
431+
) -> Result<Response<Body>, ApiError> {
432+
if query.force.is_some_and(|t| t) {
433+
route_project(state, scoped_user, req).await
434+
} else {
435+
Err(Deprecated(
436+
"Creating new deployments on the shuttle.rs platform has been deprecated.".to_string(),
437+
))?
438+
}
428439
}
429440

430441
#[instrument(skip_all, fields(shuttle.project.name = %scoped_user.scope))]

0 commit comments

Comments
 (0)