diff options
author | Teddy Wing | 2017-11-08 01:35:30 +0100 |
---|---|---|
committer | Teddy Wing | 2017-11-08 01:35:30 +0100 |
commit | 0e6fad71021dfda057936cb9ce79a33706cb4967 (patch) | |
tree | 46c639423cc02800187e1a3791c9a4f4390426e3 /src | |
parent | f9d8c75d5f326091138ced3a8dbcd73c3c76c8be (diff) | |
download | kipper-0e6fad71021dfda057936cb9ce79a33706cb4967.tar.bz2 |
jenkins.rs: Add `update_commit_status` outline
Outline for the main function that will integrate everything here. It
carries out the algorithm described at the top of the file.
So far it's incomplete, but wanted to get the idea down in code
somewhere. Also, this method might make more sense in a different
module.
Diffstat (limited to 'src')
-rw-r--r-- | src/jenkins.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/jenkins.rs b/src/jenkins.rs index 428b561..8965c6a 100644 --- a/src/jenkins.rs +++ b/src/jenkins.rs @@ -33,6 +33,20 @@ pub enum JobStatus { Unknown, } +pub fn update_commit_status(commit_ref) { + let jobs = get_jobs(); + + for job_url in jobs { + let payload = request_job(job_url); + + // Does `displayName` match + if job_for_commit(payload, commit_ref) { + // spawn thread + let status = result_from_job(payload); + } + } +} + pub fn auth_credentials() -> Basic { Basic { username: "username".to_string(), @@ -53,6 +67,10 @@ pub fn get_jobs(repo_name: String) {//-> Vec<String> { println!("{}", res.status()); } +// Does the `commit_ref` correspond to the job in the `payload`? +pub fn job_for_commit(payload: String, commit_ref: CommitRef) -> bool { +} + pub fn result_from_job(payload: String) -> JobStatus { let mut job = json::parse(payload.as_ref()).unwrap(); |