summaryrefslogtreecommitdiff
path: root/src/ci_ctl.rs
diff options
context:
space:
mode:
authoriximeow <git@iximeow.net>2022-12-27 23:45:18 +0000
committeriximeow <git@iximeow.net>2022-12-27 23:46:27 +0000
commit3411ef67fb829c419f853293664d97c6a6d4b96b (patch)
tree4101f4acac71fdd98074407c964d94635e3f2eb9 /src/ci_ctl.rs
parenta4dcaedc05c667a293d98848fbecd76c8708a298 (diff)
cictl rerun by-commit not just job id
what happens if there are multiple jobs for the same commit? nothing good, really!
Diffstat (limited to 'src/ci_ctl.rs')
-rw-r--r--src/ci_ctl.rs16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/ci_ctl.rs b/src/ci_ctl.rs
index 3f48907..687aa46 100644
--- a/src/ci_ctl.rs
+++ b/src/ci_ctl.rs
@@ -47,6 +47,9 @@ enum JobAction {
List,
Rerun {
which: u32
+ },
+ RerunCommit {
+ commit: String
}
}
@@ -93,6 +96,17 @@ fn main() {
.expect("works");
eprintln!("[+] job {} set to pending", which);
}
+ JobAction::RerunCommit { commit } => {
+ let db = DbCtx::new(&config_path, &db_path);
+ let job_id = db.job_for_commit(&commit).unwrap();
+ if let Some(job_id) = job_id {
+ db.conn.lock().unwrap().execute("update jobs set state=0 where id=?1", [job_id])
+ .expect("works");
+ eprintln!("[+] job {} (commit {}) set to pending", job_id, commit);
+ } else {
+ eprintln!("[-] no job for commit {}", commit);
+ }
+ }
}
},
Command::Add { what } => {
@@ -131,7 +145,7 @@ fn main() {
};
println!("[+] new repo created: '{}' id {}", &name, repo_id);
if let Some((remote, remote_kind, config_path)) = remote_config {
- let full_config_file_path = format!("{}/{}", &db.config_path, config_path);
+ let full_config_file_path = format!("{}/{}", &db.config_path.display(), config_path);
let config = match remote_kind.as_ref() {
"github" => {
assert!(NotifierConfig::github_from_file(&full_config_file_path).is_ok());