summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <matthias.beyer@atos.net>2021-08-30 13:22:04 +0200
committerMatthias Beyer <matthias.beyer@atos.net>2021-09-06 11:15:08 +0200
commited9d61a07ac69b9bdaf649356622e2553d0ef72c (patch)
treee4c87c873443a2028b789e9dfe1443df740189c7
parent436c9a371aadc57ca6e0bf218cab85f47fbb4441 (diff)
Add CLI option to call find-artifacts subcommand with filter for image
Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
-rw-r--r--src/cli.rs9
-rw-r--r--src/commands/find_artifact.rs6
2 files changed, 15 insertions, 0 deletions
diff --git a/src/cli.rs b/src/cli.rs
index 37df36c..1c6bcb9 100644
--- a/src/cli.rs
+++ b/src/cli.rs
@@ -654,6 +654,15 @@ pub fn cli<'a>() -> App<'a> {
.validator(env_pass_validator)
.about("Filter for this \"key=value\" environment variable")
)
+ .arg(Arg::new("image")
+ .required(false)
+ .multiple(false)
+ .long("image")
+ .short('I')
+ .takes_value(true)
+ .value_name("IMAGE")
+ .about("Only list artifacts that were built on IMAGE")
+ )
)
.subcommand(App::new("find-pkg")
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()?;