From e6ef767f36e01ad0e8d75ae2278117a83d0424ff Mon Sep 17 00:00:00 2001 From: Fintan Halpenny Date: Fri, 30 May 2025 13:08:42 +0200 Subject: [PATCH] radicle: remove job cob The Job COB is defined as separate crate: [radicle-job]. So this change removes its definition and use from the `heartwood` repository. [radicle-job]: https://app.radicle.xyz/nodes/seed.radicle.garden/rad:z2UcCU1LgMshWvXj6hXSDDrwB8q8M --- radicle-cli/examples/rad-job.md | 87 ------ radicle-cli/src/commands.rs | 2 - radicle-cli/src/commands/help.rs | 1 - radicle-cli/src/commands/job.rs | 380 ------------------------ radicle-cli/src/main.rs | 7 - radicle-cli/src/terminal.rs | 1 - radicle-cli/src/terminal/format.rs | 5 - radicle-cli/src/terminal/job.rs | 51 ---- radicle-cli/tests/commands.rs | 14 - radicle/src/cob.rs | 1 - radicle/src/cob/job.rs | 458 ----------------------------- 11 files changed, 1007 deletions(-) delete mode 100644 radicle-cli/examples/rad-job.md delete mode 100644 radicle-cli/src/commands/job.rs delete mode 100644 radicle-cli/src/terminal/job.rs delete mode 100644 radicle/src/cob/job.rs diff --git a/radicle-cli/examples/rad-job.md b/radicle-cli/examples/rad-job.md deleted file mode 100644 index a28668b3..00000000 --- a/radicle-cli/examples/rad-job.md +++ /dev/null @@ -1,87 +0,0 @@ -The `rad job` command lets you manage job COBs. Let's first checkout the -`heartwood` repository: - -``` -$ rad checkout rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji -✓ Repository checkout successful under ./heartwood -$ cd heartwood -``` - -Using the `rad job` (or `rad job list`) command we can see that there are -currently no jobs listed: - -``` -$ rad job -Nothing to show. -``` - -Let's create a job to represent a new CI run. We check what the current `HEAD` -of the repository is, and use the `rad job trigger` to start a fresh job for -that commit: - -``` -$ git rev-parse HEAD -f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354 -$ rad job trigger f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354 -╭──────────────────────────────────────────────────╮ -│ Job fbbda2447c30ebbab9b746498cd41a383ff05225 │ -│ Commit f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354 │ -│ State fresh │ -╰──────────────────────────────────────────────────╯ -``` - -Let's check the list again, and we should we see our fresh job there: - -``` -$ rad job -╭───────────────────────────────╮ -│ ● ID Commit State │ -├───────────────────────────────┤ -│ ● fbbda24 f2de534 fresh │ -╰───────────────────────────────╯ -``` - -From there we can start a new job, assigning an arbitrary identifier `xyzzy`, -which would usually from the CI system that is running the job: - -``` -$ rad job start fbbda2447c30ebbab9b746498cd41a383ff05225 xyzzy -``` - -Checking the job again, we can now see that the job is `running`: - -``` -$ rad job -╭─────────────────────────────────╮ -│ ● ID Commit State │ -├─────────────────────────────────┤ -│ ● fbbda24 f2de534 running │ -╰─────────────────────────────────╯ -$ rad job show fbbda2447c30ebbab9b746498cd41a383ff05225 -╭──────────────────────────────────────────────────╮ -│ Job fbbda2447c30ebbab9b746498cd41a383ff05225 │ -│ Commit f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354 │ -│ State running │ -│ Run ID xyzzy │ -╰──────────────────────────────────────────────────╯ -``` - -When a job has finished, we can mark it as done -- either with a `--success` or -`--failed` flag -- using the `rad job finish` command: - -``` -$ rad job finish --success fbbda2447c30ebbab9b746498cd41a383ff05225 -$ rad job -╭───────────────────────────────────╮ -│ ● ID Commit State │ -├───────────────────────────────────┤ -│ ● fbbda24 f2de534 succeeded │ -╰───────────────────────────────────╯ -$ rad job show fbbda2447c30ebbab9b746498cd41a383ff05225 -╭──────────────────────────────────────────────────╮ -│ Job fbbda2447c30ebbab9b746498cd41a383ff05225 │ -│ Commit f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354 │ -│ State succeeded │ -│ Run ID xyzzy │ -╰──────────────────────────────────────────────────╯ -``` diff --git a/radicle-cli/src/commands.rs b/radicle-cli/src/commands.rs index 60d5eb14..e4df12c1 100644 --- a/radicle-cli/src/commands.rs +++ b/radicle-cli/src/commands.rs @@ -32,8 +32,6 @@ pub mod rad_init; pub mod rad_inspect; #[path = "commands/issue.rs"] pub mod rad_issue; -#[path = "commands/job.rs"] -pub mod rad_job; #[path = "commands/ls.rs"] pub mod rad_ls; #[path = "commands/node.rs"] diff --git a/radicle-cli/src/commands/help.rs b/radicle-cli/src/commands/help.rs index 8b0f4d55..c735c368 100644 --- a/radicle-cli/src/commands/help.rs +++ b/radicle-cli/src/commands/help.rs @@ -25,7 +25,6 @@ const COMMANDS: &[Help] = &[ rad_inbox::HELP, rad_inspect::HELP, rad_issue::HELP, - rad_job::HELP, rad_ls::HELP, rad_node::HELP, rad_patch::HELP, diff --git a/radicle-cli/src/commands/job.rs b/radicle-cli/src/commands/job.rs deleted file mode 100644 index a8b36194..00000000 --- a/radicle-cli/src/commands/job.rs +++ /dev/null @@ -1,380 +0,0 @@ -#![allow(clippy::or_fun_call)] -use std::ffi::OsString; - -use anyhow::{anyhow, Context as _}; - -use radicle::cob::job::{JobStore, Reason, State}; -use radicle::crypto; -use radicle::node::device::Device; -use radicle::node::{Handle, NodeId}; -use radicle::storage::{WriteRepository, WriteStorage}; -use radicle::{cob, Node}; - -use crate::git::Rev; -use crate::terminal as term; -use crate::terminal::args::{Args, Error, Help}; -use crate::terminal::Element; - -pub const HELP: Help = Help { - name: "job", - description: "Manage automated jobs on a repository", - version: env!("CARGO_PKG_VERSION"), - usage: r#" -Usage - - rad job [