diff --git a/apps/piquelctl/src/editing.rs b/apps/piquelctl/src/editing.rs index ec0e88d50..330163dd3 100644 --- a/apps/piquelctl/src/editing.rs +++ b/apps/piquelctl/src/editing.rs @@ -1020,6 +1020,11 @@ pub(crate) struct SetJobArgs { /// access, or `read-only` for a new job. #[arg(long, value_name = "ACCESS", value_parser = volume_access())] volume_access: Option, + /// `on` to stop the job's service before the job runs, once its startup + /// dependencies are ready, until the rollout; `off` to run it beside the + /// service. By default, the job's current setting, or `off` for a new job. + #[arg(long, value_name = "on|off", value_parser = on_off())] + stop_service: Option, /// Environment variable for the job only, added to its service's. Repeat /// it to set several. They replace the job's own variables, which it keeps /// when you pass none. @@ -1732,6 +1737,10 @@ impl JobCommand { .volume_access .or_else(|| current.map(|job| job.volume_access)) .unwrap_or_default(), + stop_service: args + .stop_service + .or_else(|| current.map(|job| job.stop_service)) + .unwrap_or_default(), }; match existing { Some(index) => jobs[index] = job, diff --git a/apps/piqueld-ui/src/browser/management/jobs.rs b/apps/piqueld-ui/src/browser/management/jobs.rs index e34510de1..7020d7ef2 100644 --- a/apps/piqueld-ui/src/browser/management/jobs.rs +++ b/apps/piqueld-ui/src/browser/management/jobs.rs @@ -19,6 +19,7 @@ struct JobDraft { secrets: Vec<(String, String)>, timeout: String, volume_access: JobVolumeAccess, + stop_service: bool, } impl Default for JobDraft { @@ -31,6 +32,7 @@ impl Default for JobDraft { secrets: Vec::new(), timeout: Job::DEFAULT_TIMEOUT_SECONDS.to_string(), volume_access: JobVolumeAccess::default(), + stop_service: false, } } } @@ -67,6 +69,7 @@ impl JobDraft { .parse() .map_err(|_| "Job timeout must be a whole number of seconds".to_owned())?, volume_access: self.volume_access, + stop_service: self.stop_service, }) } } @@ -89,6 +92,7 @@ impl From for JobDraft { .collect(), timeout: job.timeout_seconds.to_string(), volume_access: job.volume_access, + stop_service: job.stop_service, } } } @@ -297,7 +301,7 @@ pub(super) fn JobSettings() -> impl IntoView {

"Jobs"

- "Each deployment runs these commands to completion, in order, after preparing images. A job reuses its service's image, environment, secrets, and volume mounts, and waits for that service's startup dependencies to be healthy. Environment variables and secrets added here reach only the job's container, never the service's replicas, and can't replace ones the service sets. Dependencies start or update first; other services roll out only after all jobs succeed. A failed job stops the deployment and dependencies return to the running deployment. Volumes are read-only unless the job has exclusive access, which stops every service using its writable volumes until the rollout. Each command element is one row; no shell parsing is applied." + "Each deployment runs these commands to completion, in order, after preparing images. A job reuses its service's image, environment, secrets, and volume mounts, and waits for that service's startup dependencies to be healthy. Environment variables and secrets added here reach only the job's container, never the service's replicas, and can't replace ones the service sets. Dependencies start or update first; other services roll out only after all jobs succeed. A failed job stops the deployment and dependencies return to the running deployment. Volumes are read-only unless the job has exclusive access, which stops every service using its writable volumes until the rollout. A job can also stop its own service, so its previous version never runs against what the job changes. Each command element is one row; no shell parsing is applied."

@@ -374,6 +378,19 @@ pub(super) fn JobSettings() -> impl IntoView { .as_str()}>"Exclusive" +