summaryrefslogtreecommitdiffstats
path: root/src/commands/find_artifact.rs
diff options
context:
space:
mode:
authorMatthias Beyer <matthias.beyer@atos.net>2021-02-22 10:44:19 +0100
committerMatthias Beyer <mail@beyermatthias.de>2021-02-25 10:40:16 +0100
commitfe5b97425fa08854b4f1ce37451166f8a81d54d2 (patch)
tree01f3c7f85b4599e16fff44425c93789b825aeccc /src/commands/find_artifact.rs
parentdf1ab6c67de7591f849b14b8bdd94aadfc8fe961 (diff)
Multiple release stores
This patch adds the ability to have more than one release store. With this patch, a user can (has to) configure release store names in the configuration file, and can then specify one of the configured names to release the artifacts to. This way, different release "channels" can be served, for example a stable channel and a rolling release channel (although "channel" is not in our wording). The code was adapted to be able to fetch releases from multiple release directories, in the crate::db::find_artifact implementation, so that re-using artifacts works across all release directories. Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
Diffstat (limited to 'src/commands/find_artifact.rs')
-rw-r--r--src/commands/find_artifact.rs34
1 files changed, 20 insertions, 14 deletions
diff --git a/src/commands/find_artifact.rs b/src/commands/find_artifact.rs
index bf48130..93b332b 100644
--- a/src/commands/find_artifact.rs
+++ b/src/commands/find_artifact.rs
@@ -50,20 +50,26 @@ pub async fn find_artifact(matches: &ArgMatches, config: &Configuration, progres
log::debug!("Finding artifacts for '{:?}' '{:?}'", package_name_regex, package_version_constraint);
- let release_store = {
- let bar_release_loading = progressbars.bar();
- bar_release_loading.set_length(max_packages);
+ let release_stores = config
+ .release_stores()
+ .iter()
+ .map(|storename| {
+ let bar_release_loading = progressbars.bar();
+ bar_release_loading.set_length(max_packages);
+
+ let p = config.releases_directory().join(storename);
+ debug!("Loading release directory: {}", p.display());
+ let r = ReleaseStore::load(StoreRoot::new(p)?, bar_release_loading.clone());
+ if r.is_ok() {
+ bar_release_loading.finish_with_message("Loaded releases successfully");
+ } else {
+ bar_release_loading.finish_with_message("Failed to load releases");
+ }
+
+ r.map(Arc::new)
+ })
+ .collect::<Result<Vec<_>>>()?;
- let p = config.releases_directory();
- debug!("Loading release directory: {}", p.display());
- let r = ReleaseStore::load(StoreRoot::new(p.clone())?, bar_release_loading.clone());
- if r.is_ok() {
- bar_release_loading.finish_with_message("Loaded releases successfully");
- } else {
- bar_release_loading.finish_with_message("Failed to load releases");
- }
- r?
- };
let staging_store = if let Some(p) = matches.value_of("staging_dir").map(PathBuf::from) {
let bar_staging_loading = progressbars.bar();
bar_staging_loading.set_length(max_packages);
@@ -96,7 +102,7 @@ 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_store, staging_store.as_ref(), &env_filter, script_filter)?;
+ let pathes = crate::db::find_artifacts(database.clone(), config, &pkg, &release_stores, staging_store.as_ref(), &env_filter, script_filter)?;
pathes.iter()
.map(|tpl| (tpl.0.joined(), tpl.1))