Overview
Concrete tool for rolling back an in-place update to the previous commit and binary provided by the internal/update package.
Description
Rollback restores the previous commit and binary saved before the last Apply. It uses the .upgrade-backup/ directory, .update-state.json, and the cyberstrike-ai.prev binary as restore points. For tarball installs, upgrade.sh provides a fallback using rsync --delete from a Release tarball. Returns a Result with from/to commits. A service restart is required after rollback.
Usage
- Self-update step 4 (rollback): called via
-update-rollback flag when the update is bad.
Code Reference
Source Location
- Repository: CyberStrikeAI
- File: internal/update/apply.go
- Lines: Rollback L907+
Signature
func Rollback(ctx context.Context, opts Options) (*Result, error)
// tarball fallback: upgrade.sh (rsync --delete from Release tarball)
Import
import "cyberstrike-ai/internal/update"
I/O Contract
Inputs
| Name |
Type |
Required |
Description
|
| ctx |
context.Context |
Yes |
Cancellation
|
| opts |
Options |
Yes |
Root + Repo
|
Outputs
| Name |
Type |
Description
|
| returns |
*Result, error |
Restored commit + binary, or error
|
Usage Examples
Rollback a Bad Update
res, err := update.Rollback(ctx, opts)
if err != nil { log.Fatal(err) }
fmt.Printf("Rolled back %s -> %s; restart required\n", res.FromCommit, res.ToCommit)
Related Pages
Implements Principle
Requires Environment
Page Connections
Double-click a node to navigate. Hold to expand connections.