Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ slog-term = "2"
sprockets-tls = { git = "https://github.com/oxidecomputer/sprockets.git", rev = "98615b86d51f74ce220198eb16c57932fd24e7cb", default-features = false }
sprockets-tls-test-utils = { git = "https://github.com/oxidecomputer/sprockets.git", rev = "98615b86d51f74ce220198eb16c57932fd24e7cb" }
ssh-key = { version = "0.6", features = ["ed25519", "p256", "serde"] }
strum = { version = "0.27", features = ["derive"] }
tempfile = "3"
thiserror = "1"
tokio = { version = "1", features = ["macros", "process", "rt", "signal", "sync", "time"] }
Expand Down
18 changes: 7 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,18 @@ sush# job start -w hostname
👋 Please confirm user presence to sign with key `federal-worth-fee-seed-skin-interest-road-luggage`
✅ Session is now `front-edit-bless-suggest-defy-bacon-retire-person`
✅ Signed request for job `kingdom-owner-dilemma-craft-soda-hungry-lumber-festival`
✅ Job ID: kingdom-owner-dilemma-craft-soda-hungry-lumber-festival
✅ Started job `kingdom-owner-dilemma-craft-soda-hungry-lumber-festival`
913-0000019:BRM23230010 Stopped, exit 0 (5ms 545us 307ns), 12 B out, 0 B err
913-0000019:BRM23230018 Stopped, exit 0 (6ms 165us 887ns), 12 B out, 0 B err
913-0000019:BRM27230037 Stopped, exit 0 (5ms 927us 316ns), 12 B out, 0 B err
913-0000023:2F8JEXDK Stopped, exit 0 (5ms 282us 774ns), 9 B out, 0 B err
» 913-0000019:BRM23230010 «
✅ Job stdout:
» 913-0000019:BRM23230010 stdout «
BRM23230010
» 913-0000019:BRM23230018 «
✅ Job stdout:
» 913-0000019:BRM23230018 stdout «
BRM23230018
» 913-0000019:BRM27230037 «
✅ Job stdout:
» 913-0000019:BRM27230037 stdout «
BRM27230037
» 913-0000023:2F8JEXDK «
✅ Job stdout:
» 913-0000023:2F8JEXDK stdout «
2F8JEXDK
```

Expand Down Expand Up @@ -100,9 +96,9 @@ test try running the command `echo $SUSH_JOB_ID`:
```
sush# job start --wait "echo $SUSH_JOB_ID"
✅ Signed request for job `install-there-mutual-warfare-sound-live-order-man`
✅ Job ID: install-there-mutual-warfare-sound-live-order-man
✅ Started job `install-there-mutual-warfare-sound-live-order-man`
a part:0001 Stopped, exit 0 (68ms 190us 114ns), 50 B out, 0 B err
✅ Job stdout:
» a part:0001 stdout «
install-there-mutual-warfare-sound-live-order-man
```

Expand Down
1 change: 1 addition & 0 deletions api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ hyper.workspace = true
schemars.workspace = true
serde.workspace = true
sled-hardware-types.workspace = true
strum.workspace = true
sush-common = { path = "../common" }
thiserror.workspace = true
9 changes: 9 additions & 0 deletions api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use schemars::JsonSchema;
use serde::de::{Deserializer, Error as DeserializeError, IntoDeserializer, MapAccess, Visitor};
use serde::{Deserialize, Serialize};
use sled_hardware_types::BaseboardId;
use strum::{Display, EnumString};

use sush_common::authn::Identity;
use sush_common::jobs::{
Expand Down Expand Up @@ -318,6 +319,14 @@ pub struct JobStartParams {
pub wait: JobWait,
}

/// Codes for the errors a client may act on. `Display` gives the
/// `error_code` string of the response body.
#[derive(Clone, Copy, Debug, Display, EnumString, Eq, PartialEq)]
pub enum ErrorCode {
NoSession,
SessionNotCurrent,
}

/// Whether and until what state is reached to wait for a job start/stop request.
#[derive(Clone, Copy, Debug, Default, Deserialize, Eq, JsonSchema, PartialEq, Serialize)]
#[serde(rename_all = "lowercase")]
Expand Down
Loading