aboutsummaryrefslogtreecommitdiffstats
path: root/src/jenkins.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/jenkins.rs')
-rw-r--r--src/jenkins.rs22
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"
+ );
+ }
}