diff options
author | Matthias Beyer <matthias.beyer@atos.net> | 2021-02-22 10:44:19 +0100 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2021-02-25 10:40:16 +0100 |
commit | fe5b97425fa08854b4f1ce37451166f8a81d54d2 (patch) | |
tree | 01f3c7f85b4599e16fff44425c93789b825aeccc /src/commands/build.rs | |
parent | df1ab6c67de7591f849b14b8bdd94aadfc8fe961 (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/build.rs')
-rw-r--r-- | src/commands/build.rs | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/src/commands/build.rs b/src/commands/build.rs index 05fb0d6..1044896 100644 --- a/src/commands/build.rs +++ b/src/commands/build.rs @@ -151,20 +151,24 @@ pub async fn build( .get(0) .ok_or_else(|| anyhow!("Found no package."))?; - let release_dir = { - let bar_release_loading = progressbars.bar(); - bar_release_loading.set_length(max_packages); - - 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.map(RwLock::new).map(Arc::new)? - }; + 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 (staging_store, staging_dir, submit_id) = { let bar_staging_loading = progressbars.bar(); @@ -325,7 +329,7 @@ pub async fn build( .progress_generator(progressbars) .endpoint_config(endpoint_configurations) .staging_store(staging_store) - .release_store(release_dir) + .release_stores(release_stores) .database(database_connection.clone()) .source_cache(source_cache) .submit(submit) |