diff --git a/src/api/build.rs b/src/api/build.rs index 1e12050..1bfdb41 100644 --- a/src/api/build.rs +++ b/src/api/build.rs @@ -823,6 +823,8 @@ pub struct RepublishPathParams { #[derive(Debug, Serialize, Deserialize)] pub struct RepublishArgs { app: String, + endoflife: Option, + endoflife_rebase: Option, } pub fn republish( @@ -847,7 +849,12 @@ async fn republish_async( req.has_token_repo(¶ms.repo)?; let job = db - .start_republish_job(params.repo.clone(), args.app.clone()) + .start_republish_job( + params.repo.clone(), + args.app.clone(), + args.endoflife.clone(), + args.endoflife_rebase.clone(), + ) .await?; job_queue.do_send(ProcessJobs(Some(params.repo.clone()))); diff --git a/src/db.rs b/src/db.rs index 87b4fcf..6cdc607 100644 --- a/src/db.rs +++ b/src/db.rs @@ -245,14 +245,25 @@ impl Db { .await } - pub async fn start_republish_job(&self, repo: String, app: String) -> Result { + pub async fn start_republish_job( + &self, + repo: String, + app: String, + endoflife: Option, + endoflife_rebase: Option, + ) -> Result { self.run_in_transaction(move |conn| { let job = diesel::insert_into(schema::jobs::table) .values(NewJob { kind: JobKind::Republish.to_db(), start_after: None, repo: Some(repo.clone()), - contents: json!(RepublishJob { app }).to_string(), + contents: json!(RepublishJob { + app, + endoflife, + endoflife_rebase + }) + .to_string(), }) .get_result::(conn)?; diff --git a/src/jobs/republish_job.rs b/src/jobs/republish_job.rs index 653e151..90fd89d 100644 --- a/src/jobs/republish_job.rs +++ b/src/jobs/republish_job.rs @@ -22,6 +22,8 @@ pub struct RepublishJobInstance { pub job_id: i32, pub app_id: String, pub repo: String, + pub endoflife: Option, + pub endoflife_rebase: Option, } impl RepublishJobInstance { @@ -41,6 +43,8 @@ impl RepublishJobInstance { job_id: job.id, repo, app_id: publish_job.app, + endoflife: publish_job.endoflife, + endoflife_rebase: publish_job.endoflife_rebase, }) } else { InvalidJobInstance::new(job, JobError::new("Can't parse republish job")) @@ -147,6 +151,16 @@ impl JobInstance for RepublishJobInstance { src_repo_arg.push(tmp_repo_dir.path()); cmd.arg(&src_repo_arg).arg(&repoconfig.path); + if let Some(endoflife) = &self.endoflife { + cmd.arg(format!("--end-of-life={endoflife}")); + }; + if let Some(endoflife_rebase) = &self.endoflife_rebase { + cmd.arg(format!( + "--end-of-life-rebase={}={}", + self.app_id, endoflife_rebase + )); + } + job_log_and_info!( self.job_id, conn, diff --git a/src/models.rs b/src/models.rs index bb1908e..ff3f1cb 100644 --- a/src/models.rs +++ b/src/models.rs @@ -344,6 +344,8 @@ pub struct PublishJob { #[derive(Serialize, Deserialize, Debug)] pub struct RepublishJob { pub app: String, + pub endoflife: Option, + pub endoflife_rebase: Option, } #[derive(Serialize, Deserialize, Debug)]