aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTeddy Wing2017-11-17 01:26:13 +0100
committerTeddy Wing2017-11-17 01:26:13 +0100
commit6a2f2232cb3bd26e512c1383a581544bc0aef731 (patch)
treea2a71d0e97db2c2432d86349c1ba3f4dc3758ae3 /src
parent5d18b165bca8dea2b0f09b61df2069a4336a4ff2 (diff)
downloadkipper-6a2f2232cb3bd26e512c1383a581544bc0aef731.tar.bz2
jenkins.rs: Add `jenkins_console_url_path()`
A new function that will return the URL to the Jenkins "Console" page given the URL of a Jenkins job. We'll be using this to pass with the GitHub status request as the `target_url`.
Diffstat (limited to 'src')
-rw-r--r--src/jenkins.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/jenkins.rs b/src/jenkins.rs
index 2cd4858..67e6c20 100644
--- a/src/jenkins.rs
+++ b/src/jenkins.rs
@@ -281,6 +281,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 +450,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"
+ );
+ }
}