Skip to content

Commit 19a3369

Browse files
committed
reverse launch order
1 parent de1da0e commit 19a3369

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/config.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ impl<'de> serde::Deserialize<'de> for BoolOrString {
8888
pub struct GitLabRunnerInstance {
8989
/// Tags whose associated jobs will be run by this runner
9090
pub tags: Vec<String>,
91-
/// Order in which the instances' launch processes should be executed
92-
/// All jobs without an order will be launched last
93-
pub launch_order: Option<u32>,
91+
/// Priority in which the instances' launch processes should be executed, higher priority means earlier launch.
92+
/// All jobs without a priority will be launched last
93+
pub launch_priority: Option<u32>,
9494
/// Variables to be expanded in the template instantiation
9595
/// Naming to avoid confusing with environment variables
9696
pub config_variables: HashMap<String, String>,
@@ -241,7 +241,7 @@ pub fn get_default_config() -> GitLabRunnersConfig {
241241
"test-runner".to_owned(),
242242
GitLabRunnerInstance {
243243
tags: vec!["tag-1".to_owned(), "tag-2".to_owned()],
244-
launch_order: None,
244+
launch_priority: None,
245245
config_variables: [("VARIABLE", "value")]
246246
.map(|(k, v)| (k.to_owned(), v.to_owned()))
247247
.into_iter()

src/run.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,10 @@ async fn run_impl(paths: &cli::Paths, state: &MetaRunnerState) -> anyhow::Result
178178
}
179179
grouped_matched_jobs.get_mut(name).unwrap().1.push(job);
180180
}
181+
// sort descending by priority
181182
let mut grouped_matched_jobs: Vec<_> = grouped_matched_jobs.into_iter().collect();
182-
grouped_matched_jobs.sort_by_key(|(_, (instance, _))| instance.launch_order);
183+
grouped_matched_jobs.sort_by_key(|(_, (instance, _))| instance.launch_priority);
184+
grouped_matched_jobs.reverse();
183185
// Dispatch jobs
184186
let mut queue = Vec::new();
185187
// this unwrap can't fail because we ran check_config::check

0 commit comments

Comments
 (0)