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.
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user