πΊπΈ English Β· π¨π³ δΈζΒ Β Β Β Β Β |Β Β Β Β Β TableΒ ofΒ ContentsΒ βοΈ
β¨ Features
| Feature | Description |
|---|---|
| Async and Blocking | Choose the I/O model at compile-time: tokio by default, enable blocking-client for sync. |
| Type-safe endpoints | Each REST call is a zero-cost struct implementing Endpoint; responses deserialize into concrete types. |
| 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>"] --> Endpoint["Typed Endpoint<br/>structs"]
end
%% ββ External ββββββββββββββββββββββββββ
subgraph J["Jenkins Master"]
direction TB
API["REST API"]
end
%% ββ Flows βββββββββββββββββββββββββββββ
CLI --> Builder
Endpoint --> 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,Endpoint sdk;
class API server;
π Supported API Matrix
| Category | Description | Method | Path | Status |
|---|---|---|---|---|
| Job | Retrieve jobs information | GET |
/api/json |
β |
| Job | Fetch job details | GET |
/job/:name/api/json |
β |
| Job | Fetch last-build information | GET |
/job/:name/lastBuild/api/json |
β |
| Job | Fetch console logs | GET |
/job/:name/:id/consoleText |
β |
| Job | Fetch last-build console log | GET |
/job/:name/lastBuild/consoleText |
β |
| Job | Trigger builds with parameters | POST |
/job/:name/buildWithParameters |
β |
| Job | Stop ongoing builds | POST |
/job/:name/:id/stop |
β |
| Queue | Retrieve build queue details | GET |
/queue/api/json |
β |
| Executor | Retrieve executor statistics and status | GET |
/computer/api/json |
β |
π₯ Installation
# quickest
cargo add jenkins-sdk
# Cargo.toml β async client (default)
[]
= "0.1"
# blocking client
# jenkins-sdk = { version = "0.1", default-features = false, features = ["blocking-client"] }
β‘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 ;
use ;
use Duration;
async
Sync Example
// Compile with `default-features = false, features = ["blocking-client"]`.
use ;
use QueueLength;
use Duration;
π Changelog
See CHANGELOG.md for release notes.
π License
This project is licensed under the MIT License.