From 0bf1c985dcad30db4efcd9307df2b9ec23184ea5 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Mon, 30 Aug 2021 12:55:57 +0200 Subject: Rewrite interface for finding artifacts with builder Signed-off-by: Matthias Beyer --- src/commands/find_artifact.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/commands') diff --git a/src/commands/find_artifact.rs b/src/commands/find_artifact.rs index 0fc9b8c..fbd8e10 100644 --- a/src/commands/find_artifact.rs +++ b/src/commands/find_artifact.rs @@ -102,7 +102,16 @@ pub async fn find_artifact(matches: &ArgMatches, config: &Configuration, progres .inspect(|pkg| trace!("Found package: {:?}", pkg)) .map(|pkg| { let script_filter = !matches.is_present("no_script_filter"); - let pathes = crate::db::find_artifacts(database.clone(), config, pkg, &release_stores, staging_store.as_ref(), &env_filter, script_filter)?; + let pathes = crate::db::FindArtifacts::builder() + .config(config) + .release_stores(&release_stores) + .staging_store(staging_store.as_ref()) + .database_connection(database.clone()) + .env_filter(&env_filter) + .script_filter(script_filter) + .package(pkg) + .build() + .run()?; pathes.iter() .map(|tpl| (tpl.0.joined(), tpl.1)) -- cgit v1.2.3 From ed9d61a07ac69b9bdaf649356622e2553d0ef72c Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Mon, 30 Aug 2021 13:22:04 +0200 Subject: Add CLI option to call find-artifacts subcommand with filter for image Signed-off-by: Matthias Beyer --- src/commands/find_artifact.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/commands') diff --git a/src/commands/find_artifact.rs b/src/commands/find_artifact.rs index fbd8e10..6904cf4 100644 --- a/src/commands/find_artifact.rs +++ b/src/commands/find_artifact.rs @@ -31,6 +31,7 @@ use crate::filestore::path::StoreRoot; use crate::package::PackageVersionConstraint; use crate::repository::Repository; use crate::util::progress::ProgressBars; +use crate::util::docker::ImageName; /// Implementation of the "find_artifact" subcommand pub async fn find_artifact(matches: &ArgMatches, config: &Configuration, progressbars: ProgressBars, repo: Repository, database_connection: PgConnection) -> Result<()> { @@ -50,6 +51,10 @@ pub async fn find_artifact(matches: &ArgMatches, config: &Configuration, progres .transpose()? .unwrap_or_default(); + let image_name = matches.value_of("image") + .map(String::from) + .map(ImageName::from); + log::debug!("Finding artifacts for '{:?}' '{:?}'", package_name_regex, package_version_constraint); let release_stores = config @@ -109,6 +114,7 @@ pub async fn find_artifact(matches: &ArgMatches, config: &Configuration, progres .database_connection(database.clone()) .env_filter(&env_filter) .script_filter(script_filter) + .image_name(image_name.as_ref()) .package(pkg) .build() .run()?; -- cgit v1.2.3