πΊπΈ English Β· π¨π³ δΈζ Β Β Β Β Β Β |Β Β Β Β Β TableΒ ofΒ ContentsΒ βοΈ
β¨ Features
| Feature | Description |
|---|---|
| Async and Blocking | Choose the I/O model at compile-time: async by default, enable blocking for non-async environments. |
| Core services | Discoverable client.jobs()/queue()/system()/... APIs β no manual path building. |
| Composable middleware | Ready-made CSRF-crumb fetching, retries, custom transports β just chain builders. |
| No magic strings | URL build, query/form encoding, error mapping & JSON decoding handled for you. |
| Pure Rust, tiny deps | Built on reqwest + rustls; no C bindings, minimal footprint. |
πΌ Architecture
flowchart LR
%% ββ Your App ββββββββββββββββββββββββββ
subgraph A["Your App"]
direction TB
CLI["Binary / Service"]
end
%% ββ SDK Core ββββββββββββββββββββββββββ
subgraph S["jenkins-sdk-rust"]
direction LR
Builder["Client Builder"] --> Client["Jenkins<br/>Async / Blocking"] --> Middleware["Middleware<br/><sub>retry β’ crumbs β’ custom</sub>"] --> Service["Core Services<br/><sub>jobs β’ queue β’ system β’ ...</sub>"]
end
%% ββ External ββββββββββββββββββββββββββ
subgraph J["Jenkins Master"]
direction TB
API["REST API"]
end
%% ββ Flows βββββββββββββββββββββββββββββ
CLI --> Builder
Service --> API
%% ββ Styling βββββββββββββββββββββββββββ
classDef app fill:#e3f2fd,stroke:#1976d2,stroke-width:1px;
classDef sdk fill:#e8f5e9,stroke:#388e3c,stroke-width:1px;
classDef server fill:#fff8e1,stroke:#f57f17,stroke-width:1px;
class CLI app;
class Builder,Client,Middleware,Service sdk;
class API server;
π Supported API Matrix
| Service | APIs (core) | Status |
|---|---|---|
system() |
/api/json, /whoAmI/api/json, /crumbIssuer/api/json, /overallLoad/api/json, /loadStatistics/api/json, /jnlpJars/agent.jar, /jnlpJars/jenkins-cli.jar, /config.xml get/update, /quietDown/cancelQuietDown/reload/safeRestart/restart/exit |
β |
jobs() |
list/get + lastBuild selectors, build info, consoleText, logText/progressiveText, artifact download, stop/term/kill/doDelete/toggleLogKeep/submitDescription, config.xml get/update, createItem(xml), copy/rename/delete/enable/disable |
β |
queue() |
list/item/cancel | β |
computers() |
list/computer + typed executors_info(), doCreateItem(xml)/copy, toggleOffline/doDelete, config.xml get/update, connect/disconnect/launchSlaveAgent |
β |
views() |
list/get, createView(xml), config.xml get/update, doDelete/doRename, addJobToView/removeJobFromView |
β |
users() |
/user/<id>/api/json, /whoAmI/api/json, config.xml get/update |
β |
people() |
/people/api/json, /asynchPeople/api/json |
β |
π₯ Installation
# quickest
cargo add jenkins-sdk
# Cargo.toml β async client (default)
[]
= "0.1"
# blocking client (choose one TLS backend)
# jenkins-sdk = { version = "0.1", default-features = false, features = ["blocking", "rustls"] }
# jenkins-sdk = { version = "0.1", default-features = false, features = ["blocking", "native-tls"] }
β‘Quick Start
Base URL can include a sub-path (e.g.
https://example.com/jenkins); a trailing/is optional, the SDK normalises it for you.
Async Example
use Client;
use Duration;
async
Blocking Example
// Compile with `default-features = false, features = ["blocking", "rustls"]`
// or `default-features = false, features = ["blocking", "native-tls"]`.
use BlockingClient;
use Duration;
Any Endpoint (Unstable Raw Request)
Enable the unstable-raw feature and use raw::Request + execute() when an API endpoint isn't
modeled yet:
use Client;
use Request;
# async
Note: when using the blocking client inside a Tokio runtime, call it via
tokio::task::spawn_blockingor a dedicated thread pool.
π Changelog
See CHANGELOG.md for release notes.
π License
This project is licensed under the MIT License.