summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoriximeow <git@iximeow.net>2022-12-26 00:13:20 +0000
committeriximeow <git@iximeow.net>2022-12-26 00:13:20 +0000
commitb3dbd762d9bc21cf48357fa50901e125b42becc0 (patch)
tree71e81f6cec635881e4a86945c79aca6cb79e5b3f /src
parentc6831877b452b5e7631ad2baec3d96b199003017 (diff)
... actual artifacts dir
Diffstat (limited to 'src')
-rw-r--r--src/ci_driver.rs17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/ci_driver.rs b/src/ci_driver.rs
index 94e55a0..bf21047 100644
--- a/src/ci_driver.rs
+++ b/src/ci_driver.rs
@@ -31,8 +31,18 @@ use crate::sql::JobState;
fn reserve_artifacts_dir(job: u64) -> std::io::Result<PathBuf> {
let mut path: PathBuf = "/root/ixi_ci_server/jobs/".into();
path.push(job.to_string());
- std::fs::create_dir(&path)?;
- Ok(path)
+ match std::fs::create_dir(&path) {
+ Ok(()) => {
+ Ok(path)
+ },
+ Err(e) => {
+ if e.kind() == std::io::ErrorKind::AlreadyExists {
+ Ok(path)
+ } else {
+ Err(e)
+ }
+ }
+ }
}
async fn activate_job(dbctx: Arc<DbCtx>, job: &PendingJob, clients: &mut mpsc::Receiver<RunnerClient>) -> Result<(), String> {
@@ -53,12 +63,11 @@ async fn activate_job(dbctx: Arc<DbCtx>, job: &PendingJob, clients: &mut mpsc::R
.query_row("select sha from commits where id=?1", [job.commit_id], |row| row.get(0))
.expect("can run query");
- let artifacts = PathBuf::from("/tmp");
- /*
let artifacts: PathBuf = match &job.artifacts {
Some(artifacts) => PathBuf::from(artifacts),
None => reserve_artifacts_dir(job.id).expect("can reserve a directory for artifacts")
};
+ /*
if job.run_host.as_ref() == None {
eprintln!("need to find a host to run the job");