@@ -197,6 +197,23 @@ impl JenkinsBackend {
}
}
+ pub fn get_description(
+ &self,
+ build_url: &str,
+ job: &BTreeMap<String, String>,
+ ) -> Option<String> {
+ match job.get("description") {
+ Some(artifact) => match self.get_url(&format!("{}/artifact/{}", build_url, artifact)) {
+ Ok(mut resp) => match resp.text() {
+ Ok(text) => Some(text),
+ Err(_e) => None,
+ },
+ Err(_e) => None,
+ },
+ None => None,
+ }
+ }
+
pub fn wait_build(&self, build_url: &str) -> JenkinsBuildStatus {
// TODO: Implement a timeout?
while self.get_build_status(build_url) != JenkinsBuildStatus::Done {
@@ -148,9 +148,12 @@ fn run_tests(
test_result = TestState::Warning;
}
results.push(TestResult {
- description: Some(
- format!("Test {} on branch {}", job.title, branch_name.to_string()).to_string(),
- ),
+ description: match jenkins.get_description(&build_url_real, &job.parameters) {
+ Some(description) => Some(description),
+ None => Some(
+ format!("Test {} on branch {}", job.title, branch_name.to_string()).to_string(),
+ ),
+ },
state: test_result,
context: Some(job.title.replace("/", "_")),
target_url: Some(jenkins.get_results_url(&build_url_real, &job.parameters)),
By specifying the "description" parameter in a job, take the contents of a Jenkins artifact and use it to populate the description field. Closes #49 Signed-off-by: Russell Currey <ruscur@russell.cc> --- src/jenkins.rs | 17 +++++++++++++++++ src/main.rs | 9 ++++++--- 2 files changed, 23 insertions(+), 3 deletions(-)