| + |
//! Radicle "job COB".
|
| + |
//!
|
| + |
//! # Example
|
| + |
//!
|
| + |
//! ```
|
| + |
//! # use radicle::crypto::Signer;
|
| + |
//! # use radicle::git::{raw::Repository, Oid};
|
| + |
//! # use radicle::test;
|
| + |
//! # use url::Url;
|
| + |
//! # use uuid::Uuid;
|
| + |
//! #
|
| + |
//! # use radicle_job::{Jobs, Run, Runs, Reason};
|
| + |
//! #
|
| + |
//! # fn commit(repo: &Repository) -> Oid {
|
| + |
//! # let tree = {
|
| + |
//! # let tree = repo.treebuilder(None).unwrap();
|
| + |
//! # let oid = tree.write().unwrap();
|
| + |
//! # repo.find_tree(oid).unwrap()
|
| + |
//! # };
|
| + |
//! #
|
| + |
//! # let author = repo.signature().unwrap();
|
| + |
//! # repo.commit(None, &author, &author, "Test Commit", &tree, &[])
|
| + |
//! # .unwrap()
|
| + |
//! # .into()
|
| + |
//! # }
|
| + |
//! #
|
| + |
//! # let test::setup::NodeWithRepo {
|
| + |
//! # node: alice, repo, ..
|
| + |
//! # } = test::setup::NodeWithRepo::default();
|
| + |
//! # let oid = commit(&repo.backend);
|
| + |
//! # let repo = (&*repo).clone();
|
| + |
//! let mut jobs = Jobs::open(repo).unwrap();
|
| + |
//! #
|
| + |
//! # let test::setup::NodeWithRepo { node: bob, .. } = test::setup::NodeWithRepo::default();
|
| + |
//! let mut job = jobs.create(oid, &alice.signer).unwrap();
|
| + |
//! #
|
| + |
//! let uuid = Uuid::new_v4();
|
| + |
//! let log = Url::parse(&format!("https://example.com/ci/logs?run={}", uuid)).unwrap();
|
| + |
//! job.run(uuid, log, &alice.signer).unwrap();
|
| + |
//! ```
|
| + |
|
| |
use std::collections::HashMap;
|
| |
use std::ops::{Deref, DerefMut};
|
| |
use std::str::FromStr;
|