package models import ( "github.com/bluesky-social/indigo/atproto/syntax" "tangled.org/core/api/tangled" ) type Pipeline struct { RepoDid syntax.DID Workflows map[Engine][]Workflow // whether the code being ran was checked out from RepoDid itself TrustedSource bool // used to resolve cache hash files against the checkout the workflow builds TriggerMetadata *tangled.Pipeline_TriggerMetadata } func TrustedPipelineSource(metadata *tangled.Pipeline_TriggerMetadata, target string) bool { targetDid, err := syntax.ParseDID(target) if err != nil || metadata == nil || metadata.Repo == nil || metadata.Repo.RepoDid == nil { return false } checkoutDid, err := syntax.ParseDID(*metadata.Repo.RepoDid) if err != nil || checkoutDid != targetDid { return false } if metadata.SourceRepo != nil { sourceDid, err := syntax.ParseDID(*metadata.SourceRepo) if err != nil || sourceDid != checkoutDid { return false } } return true } type Step interface { Name() string Command() string Kind() StepKind } type StepKind int const ( // steps injected by the CI runner StepKindSystem StepKind = iota // steps defined by the user in the original pipeline StepKindUser ) type Workflow struct { Steps []Step Name string Data any Environment map[string]string OwnerDID string RepoDID string RunID string Caches []CacheEntry CacheBindings []CacheBinding CacheNamespace string Engine string }