From b7cbe3f201d5896ee7154303387d23abb6055fa6 Mon Sep 17 00:00:00 2001 From: Dor Askayo Date: Fri, 17 Dec 2021 19:59:06 +0200 Subject: [PATCH 1/2] jobs: Print the executed command It's useful to be be able to see the executed command even when it's successful. --- src/jobs.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/jobs.rs b/src/jobs.rs index 7d23685..631b68e 100644 --- a/src/jobs.rs +++ b/src/jobs.rs @@ -270,6 +270,8 @@ fn job_log_and_error(job_id: i32, conn: &PgConnection, output: &str) { fn do_command(mut cmd: Command) -> JobResult<()> { + info!("Running command: {:?}", &cmd); + let output = unsafe { cmd From b38d4cfa2f42ac1a1ea3cb075b5c5362a3c0b861 Mon Sep 17 00:00:00 2001 From: Dor Askayo Date: Fri, 17 Dec 2021 20:12:57 +0200 Subject: [PATCH 2/2] jobs: Consider every build ref when determining the EOL prefix We assume that: * There is always at least one build ref being committed. * Committed ref names always include a ref type followed by a "/" character. For example, "app/" or "runtime/". * The main ref isn't necessarily an "app/" ref. For example, in the case of extension-only repos, the main ref is a "runtime/" ref. * The main ref being committed has the shortest ref name when removing its ref type. For example: * When the committed ref names are "app/org.app.App" and "runtime/org.app.App.Plugin", the main ref is "app/org.app.App". * When the committed ref names are "runtime/org.app.App.Plugin" and "runtime/org.app.App.Plugin.Debug", the main ref is "runtime/org.app.App.Plugin". * The main ref with its ref type removed should be considered to be the old prefix for the purpose of EOL rebasing. This should allow rebasing EOL extensions in addition to apps. --- src/jobs.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/jobs.rs b/src/jobs.rs index 631b68e..aa116dc 100644 --- a/src/jobs.rs +++ b/src/jobs.rs @@ -361,6 +361,12 @@ impl CommitJobInstance { } } + fn get_main_build_ref_name (build_refs: &Vec) -> &str { + return &build_refs.iter().min_by_key(|build_ref| { + build_ref.ref_name.split('/').nth(1).unwrap().len() + }).unwrap().ref_name + } + fn do_commit_build_refs (&self, build_refs: &Vec, config: &Config, @@ -375,11 +381,8 @@ impl CommitJobInstance { let mut commits = HashMap::new(); let endoflife_rebase_arg = if let Some(endoflife_rebase) = &self.endoflife_rebase { - if let Some(app_ref) = build_refs.iter().filter(|app_ref| app_ref.ref_name.starts_with("app/")).nth(0) { - Some(format!("--end-of-life-rebase={}={}", app_ref.ref_name.split('/').nth(1).unwrap(), endoflife_rebase)) - } else { - None - } + let old_prefix = CommitJobInstance::get_main_build_ref_name(build_refs).split('/').nth(1).unwrap(); + Some(format!("--end-of-life-rebase={}={}", old_prefix, endoflife_rebase)) } else { None };