Publish Clusterflux 1d0b6fa filtered source

This commit is contained in:
Michel Paulissen 2026-07-21 20:36:04 +02:00
commit e5d609cfb2
226 changed files with 86613 additions and 0 deletions

View file

@ -0,0 +1,14 @@
[package]
name = "recovery-build"
version = "0.1.0"
edition.workspace = true
license.workspace = true
repository.workspace = true
publish = false
[lib]
crate-type = ["rlib", "cdylib"]
[dependencies]
clusterflux = { package = "clusterflux-sdk", path = "../../crates/clusterflux-sdk" }
serde.workspace = true

View file

@ -0,0 +1,7 @@
# Recovery build
This advanced example starts two instances of the same task definition. The
stable lane completes while the recovering lane executes a real failing command
under AwaitOperator. Edit the failing command to write
/clusterflux/output/recovering.txt, then restart that task from the debugger or
CLI. The original main join completes from the replacement attempt.

View file

@ -0,0 +1,3 @@
FROM docker.io/library/alpine:3.20
RUN apk add --no-cache build-base tar zstd
WORKDIR /workspace

View file

@ -0,0 +1,45 @@
use clusterflux::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Clone, Serialize, Deserialize, clusterflux::TaskArg)]
pub struct BuildInput {
lane: String,
source: SourceSnapshot,
}
#[clusterflux::task(capabilities = "command")]
pub async fn build_lane(input: BuildInput) -> Result<Artifact> {
let source_root = input.source.mount()?;
let output = fs::output(format!("{}.txt", input.lane))?;
let command = if input.lane == "recovering" {
"exit 23".to_owned()
} else {
format!("sleep 3; printf 'stable\n' > {}", output.as_str())
};
Command::new("sh")
.args(["-c", command.as_str()])
.cwd(source_root)
.network_disabled()
.run()
.await?;
fs::publish(&output).await
}
#[clusterflux::main]
pub async fn build() -> Result<Vec<Artifact>> {
let source = source::current_project().snapshot().await?;
let stable = clusterflux::spawn!(build_lane(BuildInput {
lane: "stable".to_owned(),
source: source.clone(),
}))
.on(clusterflux::env!("linux"))
.await?;
let recovering = clusterflux::spawn!(build_lane(BuildInput {
lane: "recovering".to_owned(),
source,
}))
.on(clusterflux::env!("linux"))
.failure_policy(clusterflux::TaskFailurePolicy::AwaitOperator)
.await?;
Ok(vec![stable.join().await?, recovering.join().await?])
}