diff options
| author | Teddy Wing | 2017-11-17 01:36:20 +0100 | 
|---|---|---|
| committer | Teddy Wing | 2017-11-17 01:36:20 +0100 | 
| commit | 6e6204f32e13a958e4e0278b20281c30a0ea3356 (patch) | |
| tree | 89d575f44d3e9d6d09a8409296d5c0f44ca98a3b | |
| parent | 5d18b165bca8dea2b0f09b61df2069a4336a4ff2 (diff) | |
| parent | ad9537963fe3eb6589ecdec0c6f9f001a483f5e2 (diff) | |
| download | kipper-6e6204f32e13a958e4e0278b20281c30a0ea3356.tar.bz2 | |
Merge branch 'send-Jenkins-build-console-link-as-status-URL'
| -rw-r--r-- | src/jenkins.rs | 22 | 
1 files changed, 19 insertions, 3 deletions
| diff --git a/src/jenkins.rs b/src/jenkins.rs index 2cd4858..72d375e 100644 --- a/src/jenkins.rs +++ b/src/jenkins.rs @@ -127,11 +127,13 @@ pub fn find_and_track_build_and_update_status(              let commit_status = job.result.commit_status(); +            let job_console_url = jenkins_console_url_path(&job_url); +              github::update_commit_status(                  &github_token,                  &commit_ref,                  &commit_status, -                job_url.clone(), +                job_console_url.clone(),                  None,                  "continuous-integration/jenkins".to_owned()              ).expect( @@ -161,7 +163,7 @@ pub fn find_and_track_build_and_update_status(                          &github_token,                          &commit_ref,                          &github::CommitStatus::Error, -                        job_url.clone(), +                        job_console_url.clone(),                          Some("The status checker timed out.".to_owned()),                          "continuous-integration/jenkins".to_owned()                      ).expect( @@ -191,7 +193,7 @@ pub fn find_and_track_build_and_update_status(                          &github_token,                          &commit_ref,                          &updated_job.result.commit_status(), -                        job_url.clone(), +                        job_console_url.clone(),                          None,                          "continuous-integration/jenkins".to_owned()                      ).expect( @@ -281,6 +283,10 @@ pub fn result_from_job(status: Option<String>) -> JobStatus {      }  } +pub fn jenkins_console_url_path(job_url: &String) -> String { +    format!("{}console", job_url) +} +  fn jenkins_request_client(user_id: &String, token: &String) -> Result<reqwest::Client, Box<Error>> {      let credentials = auth_credentials(user_id.to_owned(), token.to_owned()); @@ -446,4 +452,14 @@ mod tests {              JobStatus::Pending          );      } + +    #[test] +    fn jenkins_console_url_path_returns_url_to_console_page() { +        assert_eq!( +            jenkins_console_url_path( +                &"https://jenkins.example.com/job/changes-branches/15/".to_owned() +            ), +            "https://jenkins.example.com/job/changes-branches/15/console" +        ); +    }  } | 
