Files
alan 06bf580154 Archive pipelines: hide unused ones while keeping their history
archived_at on pipelines (migrated in place). archive_pipeline and
unarchive_pipeline by id or name with an expected-version guard;
list_pipelines hides archived unless include_archived. Archived
pipelines refuse runs, retries, new versions and name reuse, and
cannot be archived while an enabled schedule points at them.
CLI archive/unarchive and list --archived/--all, docs and skill note.
2026-11-04 23:25:55 +00:00

24 lines
784 B
Go

package server
import (
"context"
"time"
"git.a-wan.net/alan/pipelines/internal/pipeline"
"git.a-wan.net/alan/pipelines/internal/protocol"
)
// archivePipeline serves archive_pipeline and unarchive_pipeline. Like saving
// a schedule it is a lifecycle change, not authoring: no definition or version
// is written, so it is not gated by AllowAuthoring.
func archivePipeline(ctx context.Context, store *pipeline.Store, request protocol.Message) (*protocol.PipelineDetail, error) {
id, err := store.ResolvePipelineID(ctx, request.PipelineID, request.Name)
if err != nil {
return nil, err
}
if err := store.SetArchived(ctx, id, request.Type == protocol.ArchivePipeline, request.ExpectedVersion, time.Now()); err != nil {
return nil, err
}
return store.Get(ctx, id, 0)
}