16 unstable releases (7 breaking)

0.8.0 May 23, 2020
0.7.0 Nov 17, 2019
0.6.0 Sep 16, 2019
0.5.2 Nov 10, 2018
0.1.1 Mar 25, 2018

#16 in #jenkins

Download history 15/week @ 2024-07-19 19/week @ 2024-07-26 18/week @ 2024-08-02 19/week @ 2024-08-09 15/week @ 2024-08-16 38/week @ 2024-08-23 86/week @ 2024-08-30 36/week @ 2024-09-06 17/week @ 2024-09-13 75/week @ 2024-09-20 36/week @ 2024-09-27 28/week @ 2024-10-04 38/week @ 2024-10-11 133/week @ 2024-10-18 39/week @ 2024-10-25 36/week @ 2024-11-01

247 downloads per month
Used in 8 crates (6 directly)

MIT license

155KB
3.5K SLoC

jenkins-api.rs License: MIT Build Status Coverage Status Realease Doc Crate

Bindings to Jenkins JSON API

The API docs for the master branch are published here.

Example

use jenkins_api::JenkinsBuilder;
use jenkins_api::build::BuildStatus;
use jenkins_api::job::BuildableJob;

fn main() {
    let jenkins = JenkinsBuilder::new("http://localhost:8080")
        .with_user("user", Some("password"))
        .build().unwrap();

    let job = jenkins.get_job("job name").unwrap();

    let to_build = if let Some(short_build) = job.last_build.clone() {
        let build = short_build.get_full_build(&jenkins).unwrap();
        println!(
            "last build for job {} at {} was {:?}",
            job.name, build.timestamp, build.result
        );
        if let Some(result) = build.result {
            result != BuildStatus::Success
        } else {
            true
        }
    } else {
        println!("job {} was never built", job.name);
        true
    };

    if to_build {
        println!("triggering a new build");
        job.as_variant::<jenkins_api::job::FreeStyleProject>().unwrap()
            .build(&jenkins).unwrap();
    }
}

Dependencies

~6–13MB
~232K SLoC