Skip to content
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

Adopt the push-tag publishing mechanism #4643

Merged
merged 19 commits into from
May 8, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
feat(cli): wasmer package tag requires the hash of the package to t…
…ag as an argument
  • Loading branch information
xdoardo committed May 7, 2024

Unverified

No user is associated with the committer email.
commit 1c3d66723a6a2ed4b4f4e1fc2270943448372a5b
5 changes: 2 additions & 3 deletions lib/cli/src/commands/package/publish.rs
Original file line number Diff line number Diff line change
@@ -127,12 +127,11 @@ impl AsyncCliCommand for PackagePublish {
bump: self.bump.clone(),
non_interactive: self.non_interactive.clone(),
package_path: self.package_path.clone(),
package_hash,
}
.tag(&client, &manifest, package_hash)
.tag(&client, &manifest)
.await?;

tracing::info!("Proceeding to invalidate query cache..");

if !self.quiet && !self.non_interactive {
eprintln!(
"{} You can now run your package with {}",
31 changes: 9 additions & 22 deletions lib/cli/src/commands/package/tag.rs
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ use super::common::PackageSpecifier;
use crate::{
commands::{
package::common::{macros::*, *},
AsyncCliCommand, PackageBuild,
AsyncCliCommand,
},
opts::{ApiOpts, WasmerEnv},
};
@@ -57,6 +57,11 @@ pub struct PackageTag {
#[clap(long, default_value_t = !std::io::stdin().is_terminal())]
pub non_interactive: bool,

/// The hash of the package to tag
#[clap(name = "hash")]
pub package_hash: PackageHash,

///
/// Directory containing the `wasmer.toml`, or a custom *.toml manifest file.
///
/// Defaults to current working directory.
@@ -348,14 +353,13 @@ impl PackageTag {
&self,
client: &WasmerClient,
manifest: &Manifest,
hash: PackageHash,
) -> anyhow::Result<PackageIdent> {
let namespace = self.get_namespace(client, &manifest).await?;

let ident = into_specifier(&manifest, &hash, namespace)?;
let ident = into_specifier(&manifest, &self.package_hash, namespace)?;
tracing::info!("PackageIdent extracted from manifest is {:?}", ident);

let package_id = self.get_package_id(&client, &hash).await?;
let package_id = self.get_package_id(&client, &self.package_hash).await?;
tracing::info!(
"The package identifier returned from the registry is {:?}",
package_id
@@ -383,24 +387,7 @@ impl AsyncCliCommand for PackageTag {
let (manifest_path, manifest) = get_manifest(&self.package_path)?;
tracing::info!("Got manifest at path {}", manifest_path.display());

tracing::info!("Building package");
let pb = make_spinner!(
self.quiet,
"Creating the package locally...",
".",
"o",
"O",
"°",
"O",
"o",
"."
);
let (_, hash) = PackageBuild::check(manifest_path.clone()).execute()?;
spinner_ok!(pb, "Correctly built package locally");

tracing::info!("Package has hash: {hash}",);

self.tag(&client, &manifest, hash).await?;
self.tag(&client, &manifest).await?;
Ok(())
}
}