diff --git a/lib/backend-api/src/types.rs b/lib/backend-api/src/types.rs index 45869eb7370..1519ff67ff1 100644 --- a/lib/backend-api/src/types.rs +++ b/lib/backend-api/src/types.rs @@ -280,6 +280,7 @@ mod queries { #[derive(cynic::QueryFragment, Debug)] pub struct TagPackageReleasePayload { pub success: bool, + pub package_version: Option, } #[derive(cynic::InputObject, Debug)] diff --git a/lib/cli/src/commands/package/common/wait.rs b/lib/cli/src/commands/package/common/wait.rs index 30bb410f310..8fcba61e201 100644 --- a/lib/cli/src/commands/package/common/wait.rs +++ b/lib/cli/src/commands/package/common/wait.rs @@ -134,7 +134,7 @@ pub async fn wait_package( state.bindings = false } wasmer_registry::subscriptions::PackageVersionState::NATIVE_EXES_GENERATED => { - state.native_executables = true + state.native_executables = false } wasmer_registry::subscriptions::PackageVersionState::Other(_) => {} } diff --git a/lib/cli/src/commands/package/publish.rs b/lib/cli/src/commands/package/publish.rs index 798bd98fcaf..c49b41ed6d8 100644 --- a/lib/cli/src/commands/package/publish.rs +++ b/lib/cli/src/commands/package/publish.rs @@ -98,7 +98,6 @@ impl PackagePublish { package_namespace: self.package_namespace.clone(), timeout: self.timeout, non_interactive: self.non_interactive, - wait: self.wait, package_path: self.package_path.clone(), }; @@ -106,6 +105,7 @@ impl PackagePublish { }; PackageTag { + wait: self.wait, api: self.api.clone(), env: self.env.clone(), dry_run: self.dry_run, diff --git a/lib/cli/src/commands/package/push.rs b/lib/cli/src/commands/package/push.rs index c7f2caf7ad3..24354aeea5f 100644 --- a/lib/cli/src/commands/package/push.rs +++ b/lib/cli/src/commands/package/push.rs @@ -1,4 +1,4 @@ -use super::common::{macros::*, wait::*, *}; +use super::common::{macros::*, *}; use crate::{ commands::{AsyncCliCommand, PackageBuild}, opts::{ApiOpts, WasmerEnv}, @@ -46,17 +46,6 @@ pub struct PackagePush { #[clap(long, default_value_t = !std::io::stdin().is_terminal())] pub non_interactive: bool, - /// Wait for package to be available on the registry before exiting. - #[clap( - long, - require_equals = true, - num_args = 0..=1, - default_value_t = PublishWait::None, - default_missing_value = "container", - value_enum - )] - pub wait: PublishWait, - /// Directory containing the `wasmer.toml`, or a custom *.toml manifest file. /// /// Defaults to current working directory. @@ -124,7 +113,7 @@ impl PackagePush { spinner_ok!(pb, "Package correctly uploaded"); let pb = make_spinner!(self.quiet, "Waiting for package to become available..."); - let id = match wasmer_api::query::push_package_release( + match wasmer_api::query::push_package_release( client, None, namespace, @@ -143,7 +132,6 @@ impl PackagePush { None => anyhow::bail!("An unidentified error occurred while publishing the package."), // <- This is extremely bad.. }; - wait_package(client, self.wait, id, self.timeout).await?; let msg = format!("Succesfully pushed release to namespace {namespace} on the registry"); spinner_ok!(pb, msg); diff --git a/lib/cli/src/commands/package/tag.rs b/lib/cli/src/commands/package/tag.rs index b74eb563aa5..d46be8248f9 100644 --- a/lib/cli/src/commands/package/tag.rs +++ b/lib/cli/src/commands/package/tag.rs @@ -1,6 +1,6 @@ use crate::{ commands::{ - package::common::{macros::*, *}, + package::common::{macros::*, wait::wait_package, *}, AsyncCliCommand, }, opts::{ApiOpts, WasmerEnv}, @@ -16,6 +16,8 @@ use std::{ use wasmer_api::WasmerClient; use wasmer_config::package::{Manifest, NamedPackageId, PackageBuilder, PackageHash, PackageIdent}; +use super::PublishWait; + /// Tag an existing package. #[derive(Debug, clap::Parser)] pub struct PackageTag { @@ -70,6 +72,17 @@ pub struct PackageTag { /// Defaults to current working directory. #[clap(name = "path", default_value = ".")] pub package_path: PathBuf, + + /// Wait for package to be available on the registry before exiting. + #[clap( + long, + require_equals = true, + num_args = 0..=1, + default_value_t = PublishWait::None, + default_missing_value = "container", + value_enum + )] + pub wait: PublishWait, } impl PackageTag { @@ -185,6 +198,9 @@ impl PackageTag { Some(r) => { if r.success { spinner_ok!(pb, format!("Successfully tagged package {id}",)); + if let Some(package_version) = r.package_version { + wait_package(client, self.wait, package_version.id, self.timeout).await?; + } Ok(()) } else { spinner_err!(pb, "Could not tag package!");