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

#19 in #jenkins

Download history 117/week @ 2024-04-01 22/week @ 2024-04-08 18/week @ 2024-04-15 15/week @ 2024-04-22 14/week @ 2024-04-29 17/week @ 2024-05-06 23/week @ 2024-05-13 74/week @ 2024-05-20 30/week @ 2024-05-27 22/week @ 2024-06-03 19/week @ 2024-06-10 34/week @ 2024-06-17 25/week @ 2024-06-24 28/week @ 2024-07-01 56/week @ 2024-07-08 22/week @ 2024-07-15

133 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

~5–12MB
~242K SLoC