summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2021-11-03 22:27:50 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2021-11-03 22:27:50 +0100
commit3bfca7703c298e3379fde398ea71b5cf082ba5bf (patch)
tree7453e8cf855ea9111c09fb6f23edc50e99c9a74a
parent550295e0906e7ea874b3b2c35fb17519b429369c (diff)
downloadrebel-3bfca7703c298e3379fde398ea71b5cf082ba5bf.tar
rebel-3bfca7703c298e3379fde398ea71b5cf082ba5bf.zip
driver: recipe: sort recipes by filename
Make the task order deterministic, in case there are multiple recipes with the same name and version number.
-rw-r--r--crates/driver/src/recipe.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/crates/driver/src/recipe.rs b/crates/driver/src/recipe.rs
index 277a393..c6a06f1 100644
--- a/crates/driver/src/recipe.rs
+++ b/crates/driver/src/recipe.rs
@@ -54,7 +54,11 @@ fn is_yml(path: &Path) -> bool {
pub fn read_recipes<P: AsRef<Path>>(path: P) -> Result<HashMap<TaskID, Vec<TaskDef>>> {
let mut tasks = HashMap::<TaskID, Vec<TaskDef>>::new();
- for entry in WalkDir::new(path).into_iter().filter_map(|e| e.ok()) {
+ for entry in WalkDir::new(path)
+ .sort_by_file_name()
+ .into_iter()
+ .filter_map(|e| e.ok())
+ {
let path = entry.path();
if !path.is_file() || !is_yml(path) {
continue;