mirror of
https://github.com/mii443/wasmer.git
synced 2025-09-03 16:09:20 +00:00
fix(cli): Actively wait for packages only after tag
Before we waited for native executables, bindings and so forth after pushing a package. This patch moves this wait after tagging it - that is, when a package version is actually available.
This commit is contained in:
@ -280,6 +280,7 @@ mod queries {
|
|||||||
#[derive(cynic::QueryFragment, Debug)]
|
#[derive(cynic::QueryFragment, Debug)]
|
||||||
pub struct TagPackageReleasePayload {
|
pub struct TagPackageReleasePayload {
|
||||||
pub success: bool,
|
pub success: bool,
|
||||||
|
pub package_version: Option<PackageVersion>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(cynic::InputObject, Debug)]
|
#[derive(cynic::InputObject, Debug)]
|
||||||
|
@ -134,7 +134,7 @@ pub async fn wait_package(
|
|||||||
state.bindings = false
|
state.bindings = false
|
||||||
}
|
}
|
||||||
wasmer_registry::subscriptions::PackageVersionState::NATIVE_EXES_GENERATED => {
|
wasmer_registry::subscriptions::PackageVersionState::NATIVE_EXES_GENERATED => {
|
||||||
state.native_executables = true
|
state.native_executables = false
|
||||||
}
|
}
|
||||||
wasmer_registry::subscriptions::PackageVersionState::Other(_) => {}
|
wasmer_registry::subscriptions::PackageVersionState::Other(_) => {}
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,6 @@ impl PackagePublish {
|
|||||||
package_namespace: self.package_namespace.clone(),
|
package_namespace: self.package_namespace.clone(),
|
||||||
timeout: self.timeout,
|
timeout: self.timeout,
|
||||||
non_interactive: self.non_interactive,
|
non_interactive: self.non_interactive,
|
||||||
wait: self.wait,
|
|
||||||
package_path: self.package_path.clone(),
|
package_path: self.package_path.clone(),
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -106,6 +105,7 @@ impl PackagePublish {
|
|||||||
};
|
};
|
||||||
|
|
||||||
PackageTag {
|
PackageTag {
|
||||||
|
wait: self.wait,
|
||||||
api: self.api.clone(),
|
api: self.api.clone(),
|
||||||
env: self.env.clone(),
|
env: self.env.clone(),
|
||||||
dry_run: self.dry_run,
|
dry_run: self.dry_run,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use super::common::{macros::*, wait::*, *};
|
use super::common::{macros::*, *};
|
||||||
use crate::{
|
use crate::{
|
||||||
commands::{AsyncCliCommand, PackageBuild},
|
commands::{AsyncCliCommand, PackageBuild},
|
||||||
opts::{ApiOpts, WasmerEnv},
|
opts::{ApiOpts, WasmerEnv},
|
||||||
@ -46,17 +46,6 @@ pub struct PackagePush {
|
|||||||
#[clap(long, default_value_t = !std::io::stdin().is_terminal())]
|
#[clap(long, default_value_t = !std::io::stdin().is_terminal())]
|
||||||
pub non_interactive: bool,
|
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.
|
/// Directory containing the `wasmer.toml`, or a custom *.toml manifest file.
|
||||||
///
|
///
|
||||||
/// Defaults to current working directory.
|
/// Defaults to current working directory.
|
||||||
@ -124,7 +113,7 @@ impl PackagePush {
|
|||||||
spinner_ok!(pb, "Package correctly uploaded");
|
spinner_ok!(pb, "Package correctly uploaded");
|
||||||
|
|
||||||
let pb = make_spinner!(self.quiet, "Waiting for package to become available...");
|
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,
|
client,
|
||||||
None,
|
None,
|
||||||
namespace,
|
namespace,
|
||||||
@ -143,7 +132,6 @@ impl PackagePush {
|
|||||||
None => anyhow::bail!("An unidentified error occurred while publishing the package."), // <- This is extremely bad..
|
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");
|
let msg = format!("Succesfully pushed release to namespace {namespace} on the registry");
|
||||||
spinner_ok!(pb, msg);
|
spinner_ok!(pb, msg);
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
commands::{
|
commands::{
|
||||||
package::common::{macros::*, *},
|
package::common::{macros::*, wait::wait_package, *},
|
||||||
AsyncCliCommand,
|
AsyncCliCommand,
|
||||||
},
|
},
|
||||||
opts::{ApiOpts, WasmerEnv},
|
opts::{ApiOpts, WasmerEnv},
|
||||||
@ -16,6 +16,8 @@ use std::{
|
|||||||
use wasmer_api::WasmerClient;
|
use wasmer_api::WasmerClient;
|
||||||
use wasmer_config::package::{Manifest, NamedPackageId, PackageBuilder, PackageHash, PackageIdent};
|
use wasmer_config::package::{Manifest, NamedPackageId, PackageBuilder, PackageHash, PackageIdent};
|
||||||
|
|
||||||
|
use super::PublishWait;
|
||||||
|
|
||||||
/// Tag an existing package.
|
/// Tag an existing package.
|
||||||
#[derive(Debug, clap::Parser)]
|
#[derive(Debug, clap::Parser)]
|
||||||
pub struct PackageTag {
|
pub struct PackageTag {
|
||||||
@ -70,6 +72,17 @@ pub struct PackageTag {
|
|||||||
/// Defaults to current working directory.
|
/// Defaults to current working directory.
|
||||||
#[clap(name = "path", default_value = ".")]
|
#[clap(name = "path", default_value = ".")]
|
||||||
pub package_path: PathBuf,
|
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 {
|
impl PackageTag {
|
||||||
@ -185,6 +198,9 @@ impl PackageTag {
|
|||||||
Some(r) => {
|
Some(r) => {
|
||||||
if r.success {
|
if r.success {
|
||||||
spinner_ok!(pb, format!("Successfully tagged package {id}",));
|
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(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
spinner_err!(pb, "Could not tag package!");
|
spinner_err!(pb, "Could not tag package!");
|
||||||
|
Reference in New Issue
Block a user