diff --git a/apps/piquelctl/src/deployments.rs b/apps/piquelctl/src/deployments.rs index 4aeec2cd7..3b96b9548 100644 --- a/apps/piquelctl/src/deployments.rs +++ b/apps/piquelctl/src/deployments.rs @@ -7,7 +7,7 @@ use crate::{ error::{CliCode, CliError, ErrorKind, Result}, output::{ Console, - reports::{AcceptedDeploymentReport, Named, OperationOutcomeReport}, + reports::{AcceptedDeploymentReport, AttemptsReport, Named, OperationOutcomeReport}, }, support::{join_or, retry_transport}, }; @@ -165,13 +165,18 @@ async fn find_deployment( client .deployment(environment.id.as_str(), id) .await - .map_err(|error| match error { - ClientError::Api { status, .. } if status.as_u16() == 404 => CliError::new( - ErrorKind::Input, - format!("deployment {id:?} of {} was not found", environment.name), - ), - error => error.into(), - }) + .map_err(not_found(environment, id)) +} + +/// Maps the API's 404 for deployment `id` of `environment` to an input error. +fn not_found(environment: &EnvironmentView, id: &str) -> impl FnOnce(ClientError) -> CliError { + move |error| match error { + ClientError::Api { status, .. } if status.as_u16() == 404 => CliError::new( + ErrorKind::Input, + format!("deployment {id:?} of {} was not found", environment.name), + ), + error => error.into(), + } } /// `environment`'s latest deployment, if any: its latest operation unless @@ -364,6 +369,59 @@ impl HistoryArgs { } } +// `attempts` arguments shared by `env attempts` and `preview attempts`. +#[derive(Debug, Args)] +pub(crate) struct AttemptsArgs { + #[command(flatten)] + target: T, + /// ID of the deployment, as `history` lists it. By default, the latest + /// deployment. + #[arg(long, value_name = "ID")] + deployment: Option, + /// Cursor from the previous page; needs `--deployment`. + #[arg(long, requires = "deployment")] + cursor: Option, +} + +impl AttemptsArgs { + /// Emits one page of a deployment's attempts, newest first, 100 per + /// page. The first page leads with the attempt running now, until the + /// API retains its outcome. + pub(crate) async fn run(&self, console: &mut Console, client: &Client) -> Result<()> { + let environment = &self.target.environment(client).await?; + // The deployment's operation is read before its attempts, so the + // attempt it runs is newer than any retained outcome. `--cursor` + // needs `--deployment`, and a later page lists retained ones alone. + let (deployment, live) = match (&self.deployment, &self.cursor) { + (None, _) => { + let latest = latest_deployment(client, environment) + .await? + .ok_or_else(|| { + CliError::new( + ErrorKind::Input, + format!("{} has no deployments yet", environment.name), + ) + })?; + (latest.id.clone(), Some(latest)) + } + // Reading it reports an unknown deployment by name. + (Some(id), None) => { + let deployment = find_deployment(client, environment, id).await?; + (id.clone(), Some(deployment.operation)) + } + (Some(id), Some(_)) => (id.clone(), None), + }; + let mut page = client + .deployment_attempts(environment.id.as_str(), &deployment, self.cursor.as_deref()) + .await + .map_err(not_found(environment, &deployment))?; + if let Some(live) = live { + page.items = live.attempts(&page.items); + } + console.emit(&AttemptsReport { deployment, page }) + } +} + // `restore` arguments shared by `env restore` and `preview restore`. #[derive(Debug, Args)] pub(crate) struct RestoreArgs { diff --git a/apps/piquelctl/src/environments.rs b/apps/piquelctl/src/environments.rs index c90a36ec6..c105414c0 100644 --- a/apps/piquelctl/src/environments.rs +++ b/apps/piquelctl/src/environments.rs @@ -7,7 +7,8 @@ use crate::{ Wait, finish_operation, resolve_application, wait_for_deletion, wait_for_operation, }, deployments::{ - HistoryArgs, RestoreArgs, Target, UrlArgs, WaitArgs, latest_deployment, wait_for_accepted, + AttemptsArgs, HistoryArgs, RestoreArgs, Target, UrlArgs, WaitArgs, latest_deployment, + wait_for_accepted, }, editing::{EditFlags, on_off, visibility}, error::{CliError, ErrorKind, ErrorReport, Result}, @@ -182,6 +183,12 @@ pub(crate) enum EnvCommand { /// List an environment's deployments, newest first: each one's outcome, /// where it came from, and its release. History(HistoryArgs), + /// List the attempts of one of an environment's deployments, newest first: each + /// try at rolling it out, how it ended, and when it last changed. + /// + /// The attempt running now leads until its outcome is recorded. Without + /// `--deployment`, it lists the latest deployment's attempts. + Attempts(AttemptsArgs), /// Deploy an earlier, succeeded deployment again exactly as it ran: its /// rendered manifest, images and pinned secret versions. Jobs don't run, /// and volume contents and migrations stay as they are. @@ -304,6 +311,7 @@ impl EnvCommand { logs(console, client, &target.resolve(client).await?.1, window).await } Self::History(args) => args.run(console, client).await, + Self::Attempts(args) => args.run(console, client).await, Self::Restore(args) => args.run(console, client).await, Self::Wait(args) => args.run(console, client).await, Self::Url(args) => args.run(console, client).await, diff --git a/apps/piquelctl/src/output/reports/operations.rs b/apps/piquelctl/src/output/reports/operations.rs index 3e2d40a15..c493c8ecf 100644 --- a/apps/piquelctl/src/output/reports/operations.rs +++ b/apps/piquelctl/src/output/reports/operations.rs @@ -82,6 +82,30 @@ report!(Page, self, out, { out.next_cursor(self.next_cursor.as_deref()) }); +/// `attempts` result: one page of a deployment's attempts, newest first. Its +/// JSON is the page; every attempt's `id` is the deployment's. +pub(crate) struct AttemptsReport { + pub(crate) deployment: String, + pub(crate) page: Page, +} +report!(AttemptsReport as Page = page, self, out, { + out.label("Deployment", &self.deployment)?; + out.table( + &self.page.items, + "No attempts yet.", + ["Attempt", "State", "Outcome", "Updated"], + |attempt| { + [ + attempt.attempt.to_string(), + attempt.state.to_string(), + attempt.failure(), + Timestamp(attempt.updated_at_ms).to_string(), + ] + }, + )?; + out.next_cursor(self.page.next_cursor.as_deref()) +}); + /// Name of a deleted secret or notification destination. #[derive(Serialize)] pub(crate) struct NameDeletionReport<'a> { diff --git a/apps/piquelctl/src/previews.rs b/apps/piquelctl/src/previews.rs index 4efbd3536..cae983933 100644 --- a/apps/piquelctl/src/previews.rs +++ b/apps/piquelctl/src/previews.rs @@ -5,7 +5,8 @@ use crate::{ cli::LogArgs, commands::{resolve_application, wait_for_deletion, wait_for_operation}, deployments::{ - Deployed, HistoryArgs, RestoreArgs, Target, UrlArgs, WaitArgs, wait_for_accepted, + AttemptsArgs, Deployed, HistoryArgs, RestoreArgs, Target, UrlArgs, WaitArgs, + wait_for_accepted, }, environments::logs, error::{CliError, ErrorKind, Result}, @@ -74,6 +75,12 @@ pub(crate) enum PreviewCommand { /// List a preview's deployments, newest first: each one's outcome and /// where it came from. History(HistoryArgs), + /// List the attempts of one of a preview's deployments, newest first: each + /// try at rolling it out, how it ended, and when it last changed. + /// + /// The attempt running now leads until its outcome is recorded. Without + /// `--deployment`, it lists the latest deployment's attempts. + Attempts(AttemptsArgs), /// Deploy an earlier, succeeded deployment of a preview again exactly as /// it ran, without running its jobs. Restore(RestoreArgs), @@ -258,6 +265,7 @@ impl PreviewCommand { logs(console, client, &preview, window).await } Self::History(args) => args.run(console, client).await, + Self::Attempts(args) => args.run(console, client).await, Self::Restore(args) => args.run(console, client).await, Self::Wait(args) => args.run(console, client).await, Self::Url(args) => args.run(console, client).await, diff --git a/apps/piquelctl/tests/cli/environments.rs b/apps/piquelctl/tests/cli/environments.rs index fcd7e2a87..6d9ebe09e 100644 --- a/apps/piquelctl/tests/cli/environments.rs +++ b/apps/piquelctl/tests/cli/environments.rs @@ -1,4 +1,4 @@ -//! Environment commands: targeting, promotion, rollback, history and waits. +//! Environment commands: targeting, promotion, rollback, history, attempts and waits. use super::*; @@ -441,6 +441,111 @@ fn history_lists_restores_and_restore_names_the_deployment() { let _ = server.finish(); } +/// `env attempts` lists the latest deployment's attempts newest first, led +/// by the one running now, though the list shows only [`listed_first`], or +/// those of `--deployment`; `--cursor` pages them without it; and an +/// unknown deployment is an input error. +#[test] +fn attempts_list_a_deployments_tries_and_page() { + let attempt = |number: u64, state: &str| { + let mut attempt = operation(state); + attempt["attempt"] = json!(number); + attempt + }; + let mut live = deployment("running"); + live["operation"]["attempt"] = json!(3); + let mut detail = detail("operation-01", true, "ready"); + detail["latest_operation"] = live["operation"].clone(); + let server = start_server(false, usize::MAX, move |request| { + match request.path.as_str() { + "/api/v1/applications/app-notes-01" => Reply::json(app_view("app-notes-01", "notes")), + // Any page of the list leads with an older deployment. + path if path.starts_with("/api/v1/environments/app-notes-01/deployments?") => { + Reply::json(page(vec![listed_first()], Some("next"))) + } + "/api/v1/environments/app-notes-01/detail" => Reply::json(detail.clone()), + DEPLOYMENT => Reply::json(live.clone()), + "/api/v1/environments/app-notes-01/deployments/operation-01/attempts" => { + Reply::json(page(vec![attempt(2, "failed")], Some("older"))) + } + "/api/v1/environments/app-notes-01/deployments/operation-01/attempts?cursor=older" => { + Reply::json(page(vec![attempt(1, "succeeded")], None)) + } + "/api/v1/environments/app-notes-01/deployments/operation-07" => Reply::status( + "404 Not Found", + &json!({"code": "not_found", "message": "not found"}), + ), + path => panic!("unexpected path {path}"), + } + }); + + let output = run_human(&server, &["env", "attempts", "app-notes-01"]); + assert!(output.status.success(), "{output:?}"); + let stdout = String::from_utf8_lossy(&output.stdout); + for line in [ + "Deployment: operation-01", + "Attempt State Outcome", + "3 running", + "2 failed runtime_failed: runtime reconciliation failed", + "Next cursor: older", + ] { + assert!(stdout.contains(line), "{line:?} missing from {stdout}"); + } + + let listed = |page: &Value| { + page["items"] + .as_array() + .unwrap() + .iter() + .map(|item| (item["attempt"].as_u64().unwrap(), item["state"].clone())) + .collect::>() + }; + for named in [&[][..], &["--deployment", "operation-01"]] { + let arguments = [&["env", "attempts", "app-notes-01"][..], named].concat(); + let first = assert_json_success(&run(&server, &arguments)); + assert_eq!( + listed(&first), + [(3, json!("running")), (2, json!("failed"))] + ); + assert_eq!(first["next_cursor"], "older"); + } + + // A later page lists retained outcomes alone. + let older = assert_json_success(&run( + &server, + &[ + "env", + "attempts", + "app-notes-01", + "--deployment", + "operation-01", + "--cursor", + "older", + ], + )); + assert_eq!(listed(&older), [(1, json!("succeeded"))]); + assert_eq!(older["next_cursor"], Value::Null); + + let unknown = run( + &server, + &[ + "env", + "attempts", + "app-notes-01", + "--deployment", + "operation-07", + ], + ); + assert_eq!(unknown.status.code(), Some(2)); + let error = support::json_error(&unknown); + assert_eq!(error["code"], "invalid_input"); + assert_eq!( + error["message"], + "deployment \"operation-07\" of production was not found" + ); + server.stop(); +} + /// Where `operation-01`, a deployment of `app-notes-01`, reads alone. const DEPLOYMENT: &str = "/api/v1/environments/app-notes-01/deployments/operation-01"; diff --git a/apps/piqueld-ui/src/browser/management/deployments/page.rs b/apps/piqueld-ui/src/browser/management/deployments/page.rs index 8afd88d32..a180e71ab 100644 --- a/apps/piqueld-ui/src/browser/management/deployments/page.rs +++ b/apps/piqueld-ui/src/browser/management/deployments/page.rs @@ -498,12 +498,7 @@ fn DeploymentAttempts(deployment: Signal) -> impl IntoView { fn AttemptRow(attempt: Operation) -> impl IntoView { let context = editor(); let history = operation_events(&attempt.id); - let outcome = match (attempt.error_code, attempt.error_message) { - (Some(code), Some(message)) => format!("{code}: {message}"), - (Some(code), None) => code, - (None, Some(message)) => message, - (None, None) => String::new(), - }; + let outcome = attempt.failure(); view! { {attempt.attempt} diff --git a/apps/piqueld-ui/src/deployments.rs b/apps/piqueld-ui/src/deployments.rs index f8dd5c43c..771e98283 100644 --- a/apps/piqueld-ui/src/deployments.rs +++ b/apps/piqueld-ui/src/deployments.rs @@ -138,18 +138,11 @@ impl Attempts { self.cursor = page.next_cursor; } - /// The attempts to list for a deployment whose operation is `live`: the - /// API retains only completed outcomes, so the attempt it is running - /// leads the list until its outcome is retained. + /// The attempts to list for a deployment whose operation is `live`; see + /// [`Operation::attempts`]. #[must_use] pub fn visible(&self, live: &Operation) -> Vec { - let running = - live.attempt > 0 && !self.items.iter().any(|item| item.attempt == live.attempt); - running - .then(|| live.clone()) - .into_iter() - .chain(self.items.iter().cloned()) - .collect() + live.attempts(&self.items) } } @@ -365,53 +358,34 @@ mod tests { } #[test] - fn the_running_attempt_leads_until_its_outcome_is_retained() { + fn older_attempt_pages_append_and_a_refresh_shows_the_newest_alone() { let mut attempts = Attempts::default(); let retained = |attempt| operation("operation-1", attempt, OperationState::Failed); - attempts.show( - Page { - items: vec![retained(2)], - next_cursor: Some("older".into()), - }, - false, - ); - attempts.show( - Page { - items: vec![retained(1)], - next_cursor: None, - }, - true, - ); - assert_eq!(attempts.cursor, None); - - let listed = |attempts: &Attempts, live: &Operation| { + let page = |attempts: &[u64], next: Option<&str>| Page { + items: attempts.iter().copied().map(retained).collect(), + next_cursor: next.map(str::to_owned), + }; + let numbers = |attempts: &Attempts| { attempts - .visible(live) + .items .iter() - .map(|item| (item.attempt, item.state)) + .map(|item| item.attempt) .collect::>() }; - let running = operation("operation-1", 3, OperationState::Running); + attempts.show(page(&[2], Some("older")), false); + attempts.show(page(&[1], None), true); assert_eq!( - listed(&attempts, &running), - [ - (3, OperationState::Running), - (2, OperationState::Failed), - (1, OperationState::Failed) - ] + (numbers(&attempts), attempts.cursor.clone()), + (vec![2, 1], None) ); - // Refreshing shows the newest page alone; a retained outcome is listed - // once, and nothing ran before the first attempt. - attempts.show( - Page { - items: vec![retained(3)], - next_cursor: Some("older".into()), - }, - false, + // The running attempt leads them (see `Operation::attempts`). + let running = operation("operation-1", 3, OperationState::Running); + assert_eq!(attempts.visible(&running).len(), 3); + attempts.show(page(&[3], Some("older")), false); + assert_eq!( + (numbers(&attempts), attempts.cursor.as_deref()), + (vec![3], Some("older")) ); - assert_eq!(listed(&attempts, &running), [(3, OperationState::Failed)]); - let requested = operation("operation-1", 0, OperationState::Requested); - assert_eq!(listed(&Attempts::default(), &requested), []); } /// A plan of promoting a release from `origin`, at revision 7, whose diff --git a/crates/piqueld-core/src/operation.rs b/crates/piqueld-core/src/operation.rs index 121dbccea..66c161c2e 100644 --- a/crates/piqueld-core/src/operation.rs +++ b/crates/piqueld-core/src/operation.rs @@ -135,6 +135,31 @@ impl Operation { attempt > self.attempt || (attempt == self.attempt && self.state != OperationState::Requested) } + + /// The attempts to list for this deployment operation, newest first, + /// from `retained`, the outcomes the API keeps, newest first: the + /// attempt it is running leads until its outcome is retained. The + /// dashboard and `piquelctl env attempts` list attempts this way. + #[must_use] + pub fn attempts(&self, retained: &[Self]) -> Vec { + let running = self.attempt > 0 && !retained.iter().any(|item| item.attempt == self.attempt); + running + .then(|| self.clone()) + .into_iter() + .chain(retained.iter().cloned()) + .collect() + } + + /// How the operation failed, as `code: message`, either one alone, or + /// empty without a failure; attempt lists show it as the outcome. + #[must_use] + pub fn failure(&self) -> String { + match (&self.error_code, &self.error_message) { + (Some(code), Some(message)) => format!("{code}: {message}"), + (Some(text), None) | (None, Some(text)) => text.clone(), + (None, None) => String::new(), + } + } } string_enum! { @@ -249,3 +274,84 @@ string_enum! { IngressCertificateChallengeDelete => "ingress_certificate_challenge_delete", } } + +#[cfg(test)] +mod tests { + use super::*; + + /// Attempt `attempt` of one deployment, in `state`. + fn attempt(attempt: u64, state: OperationState) -> Operation { + Operation { + id: "operation-1".into(), + environment_id: EnvironmentId::parse("env-web-01").unwrap(), + kind: OperationKind::Apply, + generation: 1, + attempt, + consecutive_failures: 0, + state, + phase: None, + resource: None, + error_code: None, + error_message: None, + created_at_ms: 0, + updated_at_ms: 0, + started_at_ms: None, + finished_at_ms: None, + } + } + + /// The listed attempts' numbers and states. + fn listed(attempts: &[Operation]) -> Vec<(u64, OperationState)> { + attempts + .iter() + .map(|item| (item.attempt, item.state)) + .collect() + } + + #[test] + fn the_running_attempt_leads_until_its_outcome_is_retained() { + let retained = [ + attempt(2, OperationState::Failed), + attempt(1, OperationState::Failed), + ]; + let running = attempt(3, OperationState::Running); + assert_eq!( + listed(&running.attempts(&retained)), + [ + (3, OperationState::Running), + (2, OperationState::Failed), + (1, OperationState::Failed) + ] + ); + // A retained outcome is listed once, and nothing ran before the + // first attempt. + let ended = [attempt(3, OperationState::Failed)]; + assert_eq!( + listed(&running.attempts(&ended)), + [(3, OperationState::Failed)] + ); + assert_eq!( + listed(&attempt(0, OperationState::Requested).attempts(&[])), + [] + ); + } + + #[test] + fn a_failure_reads_as_its_code_and_message() { + let failed = |code: Option<&str>, message: Option<&str>| Operation { + error_code: code.map(str::to_owned), + error_message: message.map(str::to_owned), + ..attempt(1, OperationState::Failed) + }; + assert_eq!( + failed(Some("runtime_failed"), Some("it crashed")).failure(), + "runtime_failed: it crashed" + ); + assert_eq!( + failed(Some("runtime_failed"), None).failure(), + "runtime_failed" + ); + assert_eq!(failed(None, Some("it crashed")).failure(), "it crashed"); + assert_eq!(failed(None, None).failure(), ""); + } +} diff --git a/docs/user/operations/history.md b/docs/user/operations/history.md index 58faadc0c..7e9b6bb33 100644 --- a/docs/user/operations/history.md +++ b/docs/user/operations/history.md @@ -48,7 +48,20 @@ To follow a deployment's steps in the dashboard: operation's events, where each event shows its attempt. With `piquelctl`, run `piquelctl operation `, which also waits -for it to finish. +for it to finish. `piquelctl env attempts ` lists each time +piqueld tried the environment's latest deployment, newest first: + +```console +$ piquelctl env attempts hello production +Deployment: operation-0f3a9c2e7b1d4856a0c9e2f4b7d1a3c5 +Attempt State Outcome Updated +2 succeeded 2026-11-21 21:14:05Z +1 failed runtime_failed: runtime reconciliation failed 2026-11-21 21:12:40Z +``` + +Add `--deployment ` for an earlier deployment, as +`piquelctl env history` lists them. +`piquelctl preview attempts` does the same for a preview. ## Find out why something failed diff --git a/docs/user/reference/cli-commands.md b/docs/user/reference/cli-commands.md index 19b8e23d3..c74a3d3b3 100644 --- a/docs/user/reference/cli-commands.md +++ b/docs/user/reference/cli-commands.md @@ -3162,6 +3162,7 @@ Commands: - [`piquelctl env secret`](#piquelctl-env-secret): List, regenerate, or delete an environment's generated secrets. - [`piquelctl env logs`](#piquelctl-env-logs): Print the most recent lines of an environment's Docker logs. - [`piquelctl env history`](#piquelctl-env-history): List an environment's deployments, newest first: each one's outcome, where it came from, and its release. +- [`piquelctl env attempts`](#piquelctl-env-attempts): List the attempts of one of an environment's deployments, newest first: each try at rolling it out, how it ended, and when it last changed. - [`piquelctl env restore`](#piquelctl-env-restore): Deploy an earlier, succeeded deployment again exactly as it ran: its rendered manifest, images and pinned secret versions. Jobs don't run, and volume contents and migrations stay as they are. - [`piquelctl env wait`](#piquelctl-env-wait): Wait until a deployment of an environment is ready. - [`piquelctl env url`](#piquelctl-env-url): Print the URLs of an environment's routes, and whether each is ready. @@ -3637,6 +3638,26 @@ Options: - `--cursor `: Cursor from the previous page. - `--limit `: Show at most this many deployments, from 1 to 100; 3 without it. +## `piquelctl env attempts` + +List the attempts of one of an environment's deployments, newest first: each try at rolling it out, how it ended, and when it last changed. + +The attempt running now leads until its outcome is recorded. Without `--deployment`, it lists the latest deployment's attempts. + +```text +piquelctl env attempts [OPTIONS] [ENVIRONMENT] +``` + +Arguments: + +- ``: Application name or stable ID. +- `[ENVIRONMENT]`: Environment name or stable ID. You can omit it when the application has exactly one environment. + +Options: + +- `--deployment `: ID of the deployment, as `history` lists it. By default, the latest deployment. +- `--cursor `: Cursor from the previous page; needs `--deployment`. + ## `piquelctl env restore` Deploy an earlier, succeeded deployment again exactly as it ran: its rendered manifest, images and pinned secret versions. Jobs don't run, and volume contents and migrations stay as they are. @@ -3733,6 +3754,7 @@ Commands: - [`piquelctl preview show`](#piquelctl-preview-show): Show one preview, its URLs, and the state of its branch. - [`piquelctl preview logs`](#piquelctl-preview-logs): Print the most recent lines of a preview's Docker logs. - [`piquelctl preview history`](#piquelctl-preview-history): List a preview's deployments, newest first: each one's outcome and where it came from. +- [`piquelctl preview attempts`](#piquelctl-preview-attempts): List the attempts of one of a preview's deployments, newest first: each try at rolling it out, how it ended, and when it last changed. - [`piquelctl preview restore`](#piquelctl-preview-restore): Deploy an earlier, succeeded deployment of a preview again exactly as it ran, without running its jobs. - [`piquelctl preview wait`](#piquelctl-preview-wait): Wait until a deployment of a preview is ready. - [`piquelctl preview url`](#piquelctl-preview-url): Print the URLs of a preview's routes, and whether each is ready. @@ -3862,6 +3884,27 @@ Options: - `--cursor `: Cursor from the previous page. - `--limit `: Show at most this many deployments, from 1 to 100; 3 without it. +## `piquelctl preview attempts` + +List the attempts of one of a preview's deployments, newest first: each try at rolling it out, how it ended, and when it last changed. + +The attempt running now leads until its outcome is recorded. Without `--deployment`, it lists the latest deployment's attempts. + +```text +piquelctl preview attempts [OPTIONS] +``` + +Arguments: + +- ``: Application name or stable ID. +- ``: Preview ID, slug, or branch, matched in that order. + +Options: + +- `--slot `: The preview's slot. Needed to address a preview with a slot by its branch. +- `--deployment `: ID of the deployment, as `history` lists it. By default, the latest deployment. +- `--cursor `: Cursor from the previous page; needs `--deployment`. + ## `piquelctl preview restore` Deploy an earlier, succeeded deployment of a preview again exactly as it ran, without running its jobs. diff --git a/docs/user/reference/cli.md b/docs/user/reference/cli.md index d9a3d0c83..c2f25988e 100644 --- a/docs/user/reference/cli.md +++ b/docs/user/reference/cli.md @@ -263,6 +263,13 @@ from, its release, and which is the current target and the last successful one. An [automatic rollback](manifest.md#rollback) shows as "rolled back from deployment \ to deployment \". +`env attempts APP [ENV]` lists each time piqueld tried a deployment, newest +first, as the dashboard's **Attempts** tab does: each attempt's number, state, +failure code and message, and when it last changed. The attempt running now +leads until its outcome is recorded. It lists the latest deployment's attempts, +or those of `--deployment ID`, 100 per page; `--cursor` pages the deployment +`--deployment` names. `preview attempts` does the same for a preview. + `env restore APP ENV DEPLOYMENT` deploys an earlier deployment again exactly as it ran: its rendered manifest, its images and the secret versions it pinned, never newer ones. It is recorded as a new deployment restored from that one, @@ -531,6 +538,7 @@ written to stderr, so stdout remains valid JSON. | `env url --route` / `preview url --route` | `RouteUrl` | | `env wait` / `preview wait` | `Deployment` | | `env history` / `preview history` | `{ "items": [DeploymentView], "next_cursor": string or null }` | +| `env attempts` / `preview attempts` | `{ "items": [Operation], "next_cursor": string or null }`; each item is one attempt of the deployment, whose ID is the deployment's | | `env restore` / `preview restore` | Same as `env deploy`, with `--no-wait` too | | `env traffic` | `TrafficReport` | | `env create` / `env rename` / `env branch` / `env sync` / `env telemetry` / `env source` / `env stop` | `EnvironmentView` |