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

#17 in #jenkins

Download history 31/week @ 2023-11-19 73/week @ 2023-11-26 23/week @ 2023-12-03 22/week @ 2023-12-10 38/week @ 2023-12-17 13/week @ 2023-12-24 12/week @ 2024-01-07 24/week @ 2024-01-14 40/week @ 2024-01-21 41/week @ 2024-01-28 24/week @ 2024-02-04 16/week @ 2024-02-11 21/week @ 2024-02-18 47/week @ 2024-02-25 38/week @ 2024-03-03

125 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
~256K SLoC