stratumiops/scripts/nu/install-rollback.nu
Jesús Pérez 9095ea6d8e
Some checks failed
Nickel Type Check / Nickel Type Checking (push) Has been cancelled
Rust CI / Security Audit (push) Has been cancelled
Rust CI / Check + Test + Lint (nightly) (push) Has been cancelled
Rust CI / Check + Test + Lint (stable) (push) Has been cancelled
feat: add stratum-orchestrator with graph, state, NATS, and Nickel action nodes
New crates: stratum-orchestrator (Cedar authz, Vault secrets, Nu/agent executors,
  saga runner), stratum-graph (petgraph DAG + SurrealDB repo), stratum-state
  (SurrealDB tracker), platform-nats (NKey auth client), ncl-import-resolver.

  Updates: stratum-embeddings (SurrealDB store + persistent cache), stratum-llm
  circuit breaker. Adds Nickel action-nodes, schemas, config, Nushell scripts,
  docker-compose dev stack, and ADR-003.
2026-02-22 21:33:26 +00:00

28 lines
1003 B
Plaintext

#!/usr/bin/env nu
# install-rollback.nu — compensation for install-crate.
# Removes the installed binary if it was placed during a now-failed pipeline.
def main []: nothing -> nothing {
let run_id = ($env | get --ignore-errors PIPELINE_RUN_ID | default "unknown")
print $"Compensating install for pipeline run [$run_id]"
# The binary name must be deterministic — read from env or derive from cargo metadata
let crate_name = ($env | get --ignore-errors STRATUM_CRATE_NAME | default "")
if ($crate_name | is-empty) {
print "STRATUM_CRATE_NAME not set — skipping install rollback"
return
}
let target = ($nu.home-dir | path join ".local" "bin" $crate_name)
if ($target | path exists) {
let rm_result = (do { ^rm $target } | complete)
if ($rm_result.exit_code != 0) {
print $"WARNING: failed to remove ($target): ($rm_result.stderr)"
} else {
print $"Removed ($target)"
}
} else {
print $"($target) not present — nothing to remove"
}
}