3 releases

Uses new Rust 2024

0.1.4 Mar 11, 2025
0.1.3 Mar 1, 2025
0.1.2 Feb 28, 2025

#594 in Web programming

Download history 323/week @ 2025-02-26 98/week @ 2025-03-05 112/week @ 2025-03-12

533 downloads per month

MIT license

15KB
165 lines

Table of Contents↗️

jenkins-sdk-rust

📦 Jenkins API SDK written in Rust


This project is a Jenkins API SDK written in Rust, designed to simplify interaction with Jenkins for Rust developers. The SDK supports asynchronous programming (via Tokio) and provides a unified interface to manage Jenkins jobs, queues, and executors efficiently.

Features

  • Asynchronous Support: Built on Tokio to support high concurrency.
  • Unified Request Handling: Simplified API interface for consistent and easy interactions.
  • Detailed Documentation: Clearly documented inputs and outputs for each method.
  • Comprehensive Error Handling: Robust error handling with meaningful messages for ease of debugging.

Implemented Interfaces

  • Job Management

    • Retrieve Jobs Information
    • Retrieve Console Output
    • Trigger Builds with Parameters
    • Stop Builds
  • Queue Management

    • Retrieve Build Queue Length
  • Executor Management

    • Retrieve Executors Information

Installation

Add the following to your Cargo.toml:

[dependencies]
jenkins-sdk = "0.1"

Quick Example

use jenkins_sdk::JenkinsClient;
use serde_json::json;

#[tokio::main]
async fn main() {
    let client = JenkinsClient::new("https://jenkins.example.com", "username", "api_token");

    match client.get_jobs_info().await {
        Ok(jobs) => println!("Jobs: {:?}", jobs),
        Err(e) => eprintln!("Error fetching jobs: {}", e),
    }

    // Trigger a build with parameters
    let params = json!({ "param1": "value1" });
    if let Err(e) = client.trigger_build_with_params("MyJob", &params).await {
        eprintln!("Failed to trigger build: {}", e);
    }
}

License

This project is licensed under the MIT License.

Dependencies

~4–16MB
~196K SLoC