Documentation
¶
Overview ¶
Package artifact defines the generic, repository-independent domain contracts for Atmos artifacts: references, portable records, canonical serialization and digests, the repository, producer, signer, verifier, and lock-provider interfaces, and the typed service requests and results.
The package deliberately imports no CLI, runner, hook, plugin, or CI packages. Backends and producers register through composition roots and implement the interfaces defined here. Backend SDK types (AWS clients, go-containerregistry images, ORAS remote repositories) never appear in this API; OCI seams use opencontainers image-spec descriptors and go-digest values.
Canonical records ¶
A Record serializes to one canonical byte sequence (see Record.Canonical): typed JSON with a fixed field order, sorted inventory and document arrays, sorted map keys, UTF-8 strings, integer sizes and modes, UTC RFC3339 timestamps at second precision, no insignificant whitespace, no HTML escaping, and no trailing newline. A Record never contains its own hash. The content, intent, and record digests are SHA-256 digests over canonical byte sequences defined in this package and frozen by test vectors.
Package artifact is a generated GoMock package.
Package artifact is a generated GoMock package.
Package artifact is a generated GoMock package.
Package artifact is a generated GoMock package.
Package artifact is a generated GoMock package.
Package artifact is a generated GoMock package.
Package artifact is a generated GoMock package.
Package artifact is a generated GoMock package.
Index ¶
- Constants
- func BuiltinKinds() []string
- func CanonicalizeJSON(raw []byte) ([]byte, error)
- func ComputeContentDigest(inventory []Entry, documents []Document) (digest.Digest, error)
- func DecodeOptions(raw map[string]any, out any) error
- func IsSCPAddress(s string) bool
- func MustRegisterRepositoryKind(desc *KindDescriptor, factory RepositoryFactory)
- func ParsePermissions(value string) (fs.FileMode, error)
- func ReadBounded(r io.Reader, limit int64) ([]byte, error)
- func RedactCredentials(text, raw string) string
- func RedactDecodeError(err error, raw any) error
- func RedactError(err error, raws ...string) error
- func RedactURL(raw string) string
- func RegisterRepositoryKind(desc *KindDescriptor, factory RepositoryFactory) error
- func RegistryHostOf(uri string) (string, bool)
- func RepositoryKinds() []string
- func ResetRepositoryKindsForTesting()
- func SplitGetterPrefix(raw string) (prefix, body string)
- func ValidateDigest(d digest.Digest) error
- func ValidateKeyPattern(pattern string, packaging Packaging) error
- func ValidateKind(kind string) error
- func ValidateLabel(key, value string) error
- func ValidateLabels(labels map[string]string) error
- func ValidateName(name string) error
- func ValidatePayloadPath(p string) error
- func ValidatePrefix(prefix string) error
- func ValidateRepositoryConfig(desc *KindDescriptor, cfg *schema.ArtifactRepositoryConfig) error
- func ValidateVersion(version string) error
- type Action
- type BlobRole
- type CIProvenance
- type Capabilities
- func (c *Capabilities) CheckSignerFormats(repository string, signer Signer) error
- func (c *Capabilities) Clone() Capabilities
- func (c *Capabilities) HasEvidenceFormat(f EvidenceFormat) bool
- func (c *Capabilities) HasLockScope(s LockScope) bool
- func (c *Capabilities) HasPackaging(p Packaging) bool
- func (c *Capabilities) HasSubjectKind(k SubjectKind) bool
- type CapabilityError
- type Content
- type ContentStream
- type Copier
- type CopyFromOptions
- type CopyRequest
- type DeleteOptions
- type DeleteRequest
- type DeleteResult
- type DeleteSemantics
- type Diagnostic
- type Document
- type DocumentResult
- type DocumentRole
- type DocumentStream
- type Entry
- type EntryType
- type EvidenceBlob
- type EvidenceFormat
- type EvidencePayload
- type EvidenceReader
- type EvidenceWriter
- type Exclusion
- type Execution
- type GraphSource
- type IdentityResolver
- type InspectRequest
- type InspectResult
- type Inspection
- type KindData
- type KindDescriptor
- type Label
- type ListEntry
- type ListPage
- type ListQuery
- type ListRequest
- type ListResult
- type LocalArchiveOptions
- type LocalDirOptions
- type LockHandle
- type LockNamespacer
- type LockProvider
- type LockRequest
- type LockScope
- type Metadata
- type MockCopier
- type MockCopierMockRecorder
- type MockEvidenceReader
- type MockEvidenceReaderMockRecorder
- type MockEvidenceWriter
- type MockEvidenceWriterMockRecorder
- type MockGraphSource
- func (m *MockGraphSource) EXPECT() *MockGraphSourceMockRecorder
- func (m *MockGraphSource) Fetch(ctx context.Context, descriptor v1.Descriptor) (io.ReadCloser, error)
- func (m *MockGraphSource) Root() v1.Descriptor
- func (m *MockGraphSource) Successors(ctx context.Context, descriptor v1.Descriptor) ([]v1.Descriptor, error)
- type MockGraphSourceMockRecorder
- type MockLockHandle
- func (m *MockLockHandle) EXPECT() *MockLockHandleMockRecorder
- func (m *MockLockHandle) ExpiresAt() (time.Time, bool)
- func (m *MockLockHandle) Owner() string
- func (m *MockLockHandle) Release(ctx context.Context) error
- func (m *MockLockHandle) Renew(ctx context.Context, lease time.Duration) error
- func (m *MockLockHandle) Resource() string
- func (m *MockLockHandle) Scope() LockScope
- func (m *MockLockHandle) Token() string
- type MockLockHandleMockRecorder
- func (mr *MockLockHandleMockRecorder) ExpiresAt() *gomock.Call
- func (mr *MockLockHandleMockRecorder) Owner() *gomock.Call
- func (mr *MockLockHandleMockRecorder) Release(ctx any) *gomock.Call
- func (mr *MockLockHandleMockRecorder) Renew(ctx, lease any) *gomock.Call
- func (mr *MockLockHandleMockRecorder) Resource() *gomock.Call
- func (mr *MockLockHandleMockRecorder) Scope() *gomock.Call
- func (mr *MockLockHandleMockRecorder) Token() *gomock.Call
- type MockLockProvider
- type MockLockProviderMockRecorder
- type MockProducer
- type MockProducerMockRecorder
- type MockRepository
- func (m *MockRepository) Capabilities() Capabilities
- func (m *MockRepository) Delete(ctx context.Context, pinned PinnedReference, options DeleteOptions) (*DeleteResult, error)
- func (m *MockRepository) EXPECT() *MockRepositoryMockRecorder
- func (m *MockRepository) Inspect(ctx context.Context, pinned PinnedReference) (*Inspection, error)
- func (m *MockRepository) List(ctx context.Context, query ListQuery) (*ListPage, error)
- func (m *MockRepository) Lock(ctx context.Context, request LockRequest) (LockHandle, error)
- func (m *MockRepository) OpenDocument(ctx context.Context, pinned PinnedReference, role DocumentRole) (*DocumentStream, error)
- func (m *MockRepository) Pin(ctx context.Context, ref Ref) (PinnedReference, error)
- func (m *MockRepository) Publish(ctx context.Context, prepared *PreparedArtifact, options PublishOptions) (*PublishResult, error)
- func (m *MockRepository) Read(ctx context.Context, pinned PinnedReference) (*Content, error)
- func (m *MockRepository) Resolve(ctx context.Context, ref Ref) (PinnedReference, error)
- func (m *MockRepository) Sign(ctx context.Context, subject SignatureSubject, signer Signer, ...) ([]SignatureEvidence, error)
- func (m *MockRepository) Verify(ctx context.Context, subject SignatureSubject, policy VerificationPolicy) (*VerificationResult, error)
- type MockRepositoryMockRecorder
- func (mr *MockRepositoryMockRecorder) Capabilities() *gomock.Call
- func (mr *MockRepositoryMockRecorder) Delete(ctx, pinned, options any) *gomock.Call
- func (mr *MockRepositoryMockRecorder) Inspect(ctx, pinned any) *gomock.Call
- func (mr *MockRepositoryMockRecorder) List(ctx, query any) *gomock.Call
- func (mr *MockRepositoryMockRecorder) Lock(ctx, request any) *gomock.Call
- func (mr *MockRepositoryMockRecorder) OpenDocument(ctx, pinned, role any) *gomock.Call
- func (mr *MockRepositoryMockRecorder) Pin(ctx, ref any) *gomock.Call
- func (mr *MockRepositoryMockRecorder) Publish(ctx, prepared, options any) *gomock.Call
- func (mr *MockRepositoryMockRecorder) Read(ctx, pinned any) *gomock.Call
- func (mr *MockRepositoryMockRecorder) Resolve(ctx, ref any) *gomock.Call
- func (mr *MockRepositoryMockRecorder) Sign(ctx, subject, signer, options any) *gomock.Call
- func (mr *MockRepositoryMockRecorder) Verify(ctx, subject, policy any) *gomock.Call
- type MockService
- func (m *MockService) Copy(ctx context.Context, request CopyRequest) (*OperationResult, error)
- func (m *MockService) Delete(ctx context.Context, request DeleteRequest) (*OperationResult, error)
- func (m *MockService) EXPECT() *MockServiceMockRecorder
- func (m *MockService) Inspect(ctx context.Context, request InspectRequest) (*InspectResult, error)
- func (m *MockService) List(ctx context.Context, request ListRequest) (*ListResult, error)
- func (m *MockService) Pin(ctx context.Context, request PinRequest) (*PinResult, error)
- func (m *MockService) Publish(ctx context.Context, request PublishRequest) (*OperationResult, error)
- func (m *MockService) Pull(ctx context.Context, request PullRequest) (*OperationResult, error)
- func (m *MockService) Search(ctx context.Context, request SearchRequest) (*ListResult, error)
- func (m *MockService) ShowDocument(ctx context.Context, request ShowDocumentRequest) (*DocumentResult, error)
- func (m *MockService) Sign(ctx context.Context, request SignRequest) (*SignResult, error)
- func (m *MockService) Verify(ctx context.Context, request VerifyRequest) (*VerifyResult, error)
- type MockServiceMockRecorder
- func (mr *MockServiceMockRecorder) Copy(ctx, request any) *gomock.Call
- func (mr *MockServiceMockRecorder) Delete(ctx, request any) *gomock.Call
- func (mr *MockServiceMockRecorder) Inspect(ctx, request any) *gomock.Call
- func (mr *MockServiceMockRecorder) List(ctx, request any) *gomock.Call
- func (mr *MockServiceMockRecorder) Pin(ctx, request any) *gomock.Call
- func (mr *MockServiceMockRecorder) Publish(ctx, request any) *gomock.Call
- func (mr *MockServiceMockRecorder) Pull(ctx, request any) *gomock.Call
- func (mr *MockServiceMockRecorder) Search(ctx, request any) *gomock.Call
- func (mr *MockServiceMockRecorder) ShowDocument(ctx, request any) *gomock.Call
- func (mr *MockServiceMockRecorder) Sign(ctx, request any) *gomock.Call
- func (mr *MockServiceMockRecorder) Verify(ctx, request any) *gomock.Call
- type MockSigner
- type MockSignerMockRecorder
- type MockVerifier
- type MockVerifierMockRecorder
- type OCILayoutOptions
- type OCIRegistryOptions
- type OperationResult
- type Options
- type Outcome
- type Packaging
- type PackagingValidator
- type PinRequest
- type PinResult
- type PinnedReference
- type PrepareRequest
- type PreparedArtifact
- type Producer
- type ProducerRegistry
- type Provenance
- type PublishOptions
- type PublishRequest
- type PublishResult
- type PullRequest
- type Record
- type Ref
- type Repository
- type RepositoryFactory
- type RepositoryListing
- type RepositoryLookup
- type RepositoryOption
- type RepositoryOptions
- type RepositoryRegistry
- func (r *RepositoryRegistry) IsRegistered(kind string) bool
- func (r *RepositoryRegistry) Kinds() []string
- func (r *RepositoryRegistry) Lookup(kind string) (*KindDescriptor, bool)
- func (r *RepositoryRegistry) New(ctx context.Context, alias string, cfg *schema.ArtifactRepositoryConfig, ...) (Repository, error)
- func (r *RepositoryRegistry) Register(desc *KindDescriptor, factory RepositoryFactory) error
- func (r *RepositoryRegistry) Reset()
- type Representation
- type S3Options
- type SearchRequest
- type Service
- type Severity
- type ShowDocumentRequest
- type SignOptions
- type SignRequest
- type SignResult
- type SignatureEvidence
- type SignatureSubject
- type Signer
- type SignerClaim
- type SourceProvenance
- type StagedBlob
- type SubjectKind
- type Timestamp
- type TrustSet
- type TrustedIdentity
- type VerificationPolicy
- type VerificationResult
- type VerificationStatus
- type Verifier
- type VerifyRequest
- type VerifyResult
Constants ¶
const ( // SchemaVersion is the only Record schema version defined by V1. SchemaVersion = 1 // MaxRecordSize is the largest canonical Record (and catalog JSON) read or written, in bytes. MaxRecordSize int64 = 8 << 20 // MaxDocumentSize is the largest README or CHANGELOG document, in bytes. MaxDocumentSize int64 = 4 << 20 // MaxEvidenceSize is the largest single signature evidence blob read into memory, in bytes. MaxEvidenceSize int64 = 1 << 20 // MaxNameLength is the longest artifact name, matching the OCI repository name limit. MaxNameLength = 255 // MaxVersionLength is the longest artifact version, matching the OCI tag limit. MaxVersionLength = 128 // MaxKindLength is the longest artifact kind. MaxKindLength = 128 // DefaultConcurrency is the default transfer and discovery concurrency. DefaultConcurrency = 4 // ReservedNamespace is the managed-record directory below a local or S3 root. Payload // names and key patterns must never enter it. ReservedNamespace = ".atmos-artifacts" // DocumentMediaType is the default media type of README and CHANGELOG documents. DocumentMediaType = "text/markdown" // DistributionDir is the source directory reserved for distribution metadata (the package // README and CHANGELOG, and the generated manifest inside packaged representations). Consumers // that materialize a package for generation or provisioning never expose it. DistributionDir = ".atmos/artifact" // DistributionParent is the directory that holds [DistributionDir]. DistributionParent = ".atmos" )
Serialization and bounded-read limits shared by every repository adapter.
const ( // MediaTypeArtifact is the generic artifact type. MediaTypeArtifact = "application/vnd.atmos.artifact.v1" // MediaTypeScaffold is the scaffold artifact type. MediaTypeScaffold = "application/vnd.atmos.scaffold.v1" // MediaTypeComponent is the component artifact type. MediaTypeComponent = "application/vnd.atmos.component.v1" // MediaTypeToolchainPackage is the toolchain package artifact type. MediaTypeToolchainPackage = "application/vnd.atmos.toolchain.package.v1" // MediaTypeCatalog is the artifact type of a catalog Record. MediaTypeCatalog = "application/vnd.atmos.artifact.catalog.v1" // MediaTypeCatalogPayload is the media type of a catalog's direct JSON payload layer. MediaTypeCatalogPayload = "application/vnd.atmos.artifact.catalog.v1+json" // MediaTypeConfig is the media type of the OCI config blob holding the canonical Record bytes. MediaTypeConfig = "application/vnd.atmos.artifact.config.v1+json" // MediaTypeTar is the media type of an uncompressed tar payload. MediaTypeTar = "application/vnd.atmos.artifact.content.v1.tar" // MediaTypeTarGzip is the media type of a gzip-compressed tar payload. MediaTypeTarGzip = "application/vnd.atmos.artifact.content.v1.tar+gzip" // MediaTypeZip is the media type of a zip payload. MediaTypeZip = "application/vnd.atmos.artifact.content.v1.zip" )
OCI media types from the artifact PRD. Existing plugin and foreign OCI graphs keep their own types.
const ( // KindFiles is the default kind for generic file packages. KindFiles = "files" // KindCatalog is the kind of an artifact catalog Record. KindCatalog = "catalog" )
Well-known artifact kinds.
const ( // RepositoryKindLocalDir stores copied files below a local directory. RepositoryKindLocalDir = "local/dir" // RepositoryKindLocalArchive stores one archive per artifact below a local directory. RepositoryKindLocalArchive = "local/archive" // RepositoryKindS3 stores objects in an S3 bucket. RepositoryKindS3 = "aws/s3" // RepositoryKindOCIRegistry stores artifacts in an OCI registry. RepositoryKindOCIRegistry = "oci/registry" // RepositoryKindOCILayout stores artifacts in an OCI image layout directory. RepositoryKindOCILayout = "oci/layout" )
Repository kinds defined by V1. They name repository backends and are independent of artifact kinds such as "files" or "component/terraform".
const ( // MaxLabelKeyLength is the longest label key, in bytes. MaxLabelKeyLength = 128 // MaxLabelValueLength is the longest label value, in bytes. MaxLabelValueLength = 1024 // MaxLabels is the largest number of labels on one artifact version or repository default. MaxLabels = 64 )
Label limits. Labels must be expressible and selectable with `--labels 'key=value,key2=value2'`, which splits pairs on ',' and each pair on the first '=' or ':'.
const ( // OptionPath is the local destination root of local/dir, local/archive, and oci/layout. OptionPath = "path" // OptionKeyPattern overrides the path below the stable root for local and S3 payloads. OptionKeyPattern = "key_pattern" )
Option keys shared by several kinds.
const DefaultArchivePermissions fs.FileMode = 0o600
DefaultArchivePermissions is the mode of a local archive file when permissions are not configured.
const RedactedValue = "<redacted>"
RedactedValue replaces a value that must not be echoed because it may carry credentials.
Variables ¶
This section is empty.
Functions ¶
func BuiltinKinds ¶
func BuiltinKinds() []string
BuiltinKinds returns the sorted names of the V1 repository kinds.
func CanonicalizeJSON ¶
CanonicalizeJSON re-encodes JSON text into the canonical form used by Records.
The canonical form has object members sorted by key (bytewise on UTF-8), no insignificant whitespace, integers in plain decimal, and strings with only the escapes required by JSON (the quote, the backslash, and control characters as lowercase \u00xx); every other character is written as literal UTF-8, including <, >, &, U+2028 and U+2029. The result is independent of the Go version's encoding/json escaping behavior. The input must be valid UTF-8, contain no duplicate object keys, no floating-point numbers, no integers outside the int64 range, no U+FFFD replacement characters (which indicate invalid input), and no trailing data.
func ComputeContentDigest ¶
ComputeContentDigest returns the content_digest: the SHA-256 of the canonical JSON object {"documents":[...],"inventory":[...],"schema_version":1} built from the sorted inventory and document descriptors, including paths, modes, and link targets. It excludes storage locators and generated operation data. Inputs are validated first.
func DecodeOptions ¶
DecodeOptions decodes a generic options map into a typed options struct. Decoding is strict: unknown keys and mistyped values are errors, so a typo such as `buckt` never silently becomes a missing option. Keys that look like credentials get a pointer to the `identity` field.
func IsSCPAddress ¶
IsSCPAddress reports whether s is an SCP-style git address such as "git@github.com:org/repo.git". Its user carries no password, so it holds no credential.
func MustRegisterRepositoryKind ¶
func MustRegisterRepositoryKind(desc *KindDescriptor, factory RepositoryFactory)
MustRegisterRepositoryKind is RegisterRepositoryKind for init functions: it panics on error.
func ParsePermissions ¶
ParsePermissions parses a quoted octal permission string such as "0600". Only ordinary permission bits (at most 0777) are accepted: privileged bits (setuid, setgid, sticky) are rejected, as are "preserve" and non-octal forms such as "0o600".
func ReadBounded ¶
ReadBounded reads at most limit bytes from r and fails with ErrArtifactTooLarge when the stream is longer, so callers never buffer unbounded input.
func RedactCredentials ¶
RedactCredentials removes credentials from text, an error message or log line that may quote raw, its userinfo, its password on its own, or any other URL. It is fail-closed, in three steps:
- The credential carried by raw is cut out of text wherever it is quoted: the userinfo with its trailing "@", written as in a URL, decoded, or escaped for a quote, and the password on its own together with every fragment of it that a delimiter cut loose. The password is the part of the userinfo as written after its first ":", decoded separately. A user name without a password is not replaced when it stands alone, since it is usually a service account such as "git".
- Every other URL-shaped word of text that still holds an "@" which cannot be proven to introduce a digest is replaced by RedactedValue as a whole, and so is every word that still holds an "@" when raw carried a credential.
- If any part of the password is still present, the whole text is replaced by RedactedValue.
A raw address with more "@" signs than a real one holds, or longer than any real one, has no credential that can be listed at a bounded cost, so the whole text is replaced by RedactedValue without taking any of the steps above.
func RedactDecodeError ¶
RedactDecodeError is RedactError for the error of decoding raw, a configuration value as it was parsed: a decode error quotes the keys and values it rejects, so every string held by raw, keys included and at any depth, is a credential candidate when the message is scrubbed.
func RedactError ¶
RedactError returns err with its message scrubbed of the credentials of every address in raws and of any other URL-shaped word that carries userinfo (see RedactCredentials). The result keeps err in its chain, so errors.Is and errors.As still see the cause, and it is err itself when the message needs no change.
func RedactURL ¶
RedactURL returns raw with any userinfo removed, so that a mistakenly pasted credential is not repeated in an error message or a log line. It is the one implementation every caller shares.
RedactURL is fail-closed. A value without an "@" cannot hold userinfo and is returned as it is. A value whose "@" signs all sit in the authority has its userinfo cut at the last one, as RFC 3986 requires, and is returned when what is left is a well-formed host. A value that cannot be proven free of a credential is replaced by RedactedValue as a whole: an "@" after the authority that does not introduce a complete digest (a password that held "/", "?", "#" or "\" may have closed there), scheme-less userinfo such as "user:secret@registry.example", a host that is not shaped like a host, an address that does not parse, or an address with more "@" signs than a real one holds or longer than any real one (see [maxBoundaries] and [maxAddressLength]), which is withheld before any work that grows with it starts. The diagnostic value of an error drops for such inputs by design; a credential is never echoed. A forced-getter prefix such as "git::" is kept.
func RegisterRepositoryKind ¶
func RegisterRepositoryKind(desc *KindDescriptor, factory RepositoryFactory) error
RegisterRepositoryKind registers a backend kind in the process-wide registry. Backend packages call it from a composition root. Duplicate registration is an error.
func RegistryHostOf ¶
RegistryHostOf returns the host of an oci:// URI without credentials, query, or path, and whether the URI is well formed. It is used to bind a catalog to its repository's registry.
func RepositoryKinds ¶
func RepositoryKinds() []string
RepositoryKinds lists the known kinds of the process-wide registry.
func ResetRepositoryKindsForTesting ¶
func ResetRepositoryKindsForTesting()
ResetRepositoryKindsForTesting clears the process-wide registry. Tests that register fake backends call it from t.Cleanup so registrations do not leak between tests.
func SplitGetterPrefix ¶
SplitGetterPrefix separates a forced-getter prefix ("git::") from the URL that follows it. The prefix is recognized only when a URL scheme follows it, so a "::" inside userinfo is never taken for one. The prefix is empty, and body is raw, when there is none.
func ValidateDigest ¶
ValidateDigest checks that d is a well-formed sha256 digest. V1 supports sha256 only.
func ValidateKeyPattern ¶
ValidateKeyPattern statically checks a key_pattern template against the effective packaging without expanding it. Expansion needs the artifact name, version, kind, and creation time, so only the literal structure is checked here: balanced template delimiters, referenced fields limited to .Name, .Version, .Kind and .CreatedAt, no literal root escape or empty segment, no entry into the reserved namespace, and an archive extension that agrees with the packaging. The pattern is never rendered during configuration loading.
func ValidateKind ¶
ValidateKind checks an artifact kind such as "files", "component/terraform", or "catalog".
func ValidateLabel ¶
ValidateLabel checks one exact key/value label. The key must be non-empty, free of control characters and surrounding whitespace, and free of '=', ':' and ',' so that it can be selected with `--labels`; the value must be free of control characters and ','.
func ValidateLabels ¶
ValidateLabels checks a label set, returning every malformed label joined in key order.
func ValidateName ¶
ValidateName checks an artifact name: relative, slash-separated, with no empty, "." or ".." segments and each segment matching the OCI path-component grammar. Names are never rewritten.
func ValidatePayloadPath ¶
ValidatePayloadPath checks a relative, slash-separated path inside a package. It rejects empty, absolute, backslash, control-character, "." / ".." segments, invalid UTF-8, and any path that enters the managed ReservedNamespace. Paths are never rewritten.
func ValidatePrefix ¶
ValidatePrefix checks a collection-root prefix such as acme/atmos below a bucket or registry. It must be a relative, slash-separated path with no empty, "." or ".." segments, so the prefix cannot escape its root, and it must not enter the reserved managed-record namespace.
func ValidateRepositoryConfig ¶
func ValidateRepositoryConfig(desc *KindDescriptor, cfg *schema.ArtifactRepositoryConfig) error
ValidateRepositoryConfig checks one repository configuration against its kind descriptor: the packaging matrix, permissions (accepted only where the kind allows them, and only as a quoted octal string), and strict typed options with their required values. It performs no network access, credential resolution, or directory creation.
func ValidateVersion ¶
ValidateVersion checks a version against the OCI tag grammar. Versions are never normalized.
Types ¶
type Action ¶
type Action string
Action names an artifact operation.
const ( ActionPublish Action = "publish" ActionPull Action = "pull" ActionCopy Action = "copy" ActionInspect Action = "inspect" ActionList Action = "list" ActionSearch Action = "search" ActionDelete Action = "delete" ActionShow Action = "show" ActionSign Action = "sign" ActionVerify Action = "verify" ActionPin Action = "pin" )
Artifact operations.
type CIProvenance ¶
type CIProvenance struct {
// Provider is the CI provider name, e.g. "github".
Provider string `json:"provider,omitempty"`
// RunID is the provider's run identifier.
RunID string `json:"run_id,omitempty"`
// RunURL links to the run.
RunURL string `json:"run_url,omitempty"`
// Job is the job or step name.
Job string `json:"job,omitempty"`
}
CIProvenance identifies the CI run that published an artifact.
type Capabilities ¶
type Capabilities struct {
// Read reports that Resolve, Inspect, OpenDocument, and Read are supported.
Read bool `json:"read"`
// Write reports that Publish is supported.
Write bool `json:"write"`
// EnumerateNamed reports that listing versions of a known name is supported.
EnumerateNamed bool `json:"enumerate_named"`
// EnumerateCollection reports that listing every name is supported (catalog or native).
EnumerateCollection bool `json:"enumerate_collection"`
// Delete describes delete semantics.
Delete DeleteSemantics `json:"delete"`
// ConditionalUpdate reports conditional (compare-and-swap) reference publication.
ConditionalUpdate bool `json:"conditional_update"`
// Packagings lists supported file payload packaging modes.
Packagings []Packaging `json:"packagings,omitempty"`
// PreservesModes reports that ordinary permission bits survive a round trip.
PreservesModes bool `json:"preserves_modes"`
// SubjectKinds lists the immutable signature subjects the repository can bind evidence to.
SubjectKinds []SubjectKind `json:"subject_kinds,omitempty"`
// EvidenceFormats lists the signature evidence formats the repository can store and verify.
EvidenceFormats []EvidenceFormat `json:"evidence_formats,omitempty"`
// LockScopes lists the mutation lock scopes the repository can provide.
LockScopes []LockScope `json:"lock_scopes,omitempty"`
}
Capabilities describes what a repository can do. It is computed without network access.
func (*Capabilities) CheckSignerFormats ¶
func (c *Capabilities) CheckSignerFormats(repository string, signer Signer) error
CheckSignerFormats refuses a signer before it is invoked when the repository can store none of its evidence formats, so an unusable signer never signs anything. The repository argument names the repository in the capability error.
func (*Capabilities) Clone ¶
func (c *Capabilities) Clone() Capabilities
Clone returns Capabilities that share no slices with c, so the guarantees a repository advertises stay static whatever a caller does with the returned value.
func (*Capabilities) HasEvidenceFormat ¶
func (c *Capabilities) HasEvidenceFormat(f EvidenceFormat) bool
HasEvidenceFormat reports whether the repository supports the evidence format.
func (*Capabilities) HasLockScope ¶
func (c *Capabilities) HasLockScope(s LockScope) bool
HasLockScope reports whether the repository can provide at least the requested lock scope. A repository-scope lock satisfies a host-scope request.
func (*Capabilities) HasPackaging ¶
func (c *Capabilities) HasPackaging(p Packaging) bool
HasPackaging reports whether the repository supports the packaging mode.
func (*Capabilities) HasSubjectKind ¶
func (c *Capabilities) HasSubjectKind(k SubjectKind) bool
HasSubjectKind reports whether the repository supports the signature subject kind.
type CapabilityError ¶
type CapabilityError struct {
// Repository is the repository alias or kind that lacks the capability.
Repository string
// Operation is the attempted operation, for example "lock" or "sign".
Operation string
// Capability names the missing guarantee, for example "lock/repository" or "enumerate/collection".
Capability string
// Reason explains the limitation and, where useful, the supported alternative.
Reason string
// Sentinel is the wrapped sentinel; nil means ErrArtifactUnsupportedCapability.
Sentinel error
// Cause is an optional underlying error kept for diagnostics.
Cause error
}
CapabilityError reports an operation that a repository cannot honor. It is never a successful no-op: callers receive it instead of silently degraded behavior. It wraps a sentinel (ErrArtifactUnsupportedCapability by default, or ErrArtifactPublicationUnavailable) and an optional cause, so errors.Is works against both.
func AsCapabilityError ¶
func AsCapabilityError(err error) (*CapabilityError, bool)
AsCapabilityError extracts a *CapabilityError from err's chain.
func NewPublicationUnavailable ¶
func NewPublicationUnavailable(repository, operation, reason string, cause error) *CapabilityError
NewPublicationUnavailable returns a CapabilityError wrapping ErrArtifactPublicationUnavailable.
func NewUnsupportedCapability ¶
func NewUnsupportedCapability(repository, operation, capability, reason string) *CapabilityError
NewUnsupportedCapability returns a CapabilityError wrapping ErrArtifactUnsupportedCapability.
func (*CapabilityError) Unwrap ¶
func (e *CapabilityError) Unwrap() []error
Unwrap exposes the sentinel and the cause to errors.Is and errors.As.
type Content ¶
type Content struct {
// Record is the portable Record; nil for a foreign OCI graph that carries none.
Record *Record
// Representation describes how the content is stored.
Representation Representation
// Streams are the verified payload and document streams. Empty when Graph is set.
Streams []ContentStream
// Graph is the OCI graph source when a native graph is carried.
Graph GraphSource
}
Content is the result of reading an artifact: either verified payload streams or an OCI graph source. The caller must Close it.
type ContentStream ¶
type ContentStream struct {
// Descriptor identifies the blob.
Descriptor ocispec.Descriptor
// Role is payload or document.
Role BlobRole
// Path is the inventory path for per-file payloads; empty for archives.
Path string
// Reader yields the blob bytes and verifies the descriptor digest and size.
Reader io.ReadCloser
}
ContentStream is one verified, closeable payload stream.
type Copier ¶
type Copier interface {
// CanCopyFrom reports whether source is compatible with a native transfer into this repository.
CanCopyFrom(source Repository) bool
// CopyFrom transfers the pinned artifact from source into this repository, preserving Record
// bytes and content identity.
CopyFrom(ctx context.Context, source Repository, pinned PinnedReference, options CopyFromOptions) (*PublishResult, error)
}
Copier is an optional Repository extension for a compatible native transfer (for example an OCI registry-to-registry graph copy that preserves every original descriptor). A repository that does not implement it, or whose CanCopyFrom returns false, uses the shared staging fallback.
type CopyFromOptions ¶
type CopyFromOptions struct {
// ExpectedPrior is the destination reference observed under the writer guard; nil means none.
ExpectedPrior *PinnedReference
// Force permits replacing a conflicting destination. It never bypasses verification.
Force bool
// Lock is the destination lock already held by the service.
Lock LockHandle
}
CopyFromOptions control a native transfer.
type CopyRequest ¶
type CopyRequest struct {
// Execution carries the wrapper-owned operation identity and retry budget.
Execution Execution
// Ref selects the artifact in the source repository.
Ref Ref
// From is the source repository alias.
From string
// To is the destination repository alias.
To string
// Force permits replacing a conflicting destination. It never bypasses verification.
Force bool
}
CopyRequest copies an artifact between two configured repositories.
type DeleteOptions ¶
type DeleteOptions struct {
// ExpectedCurrent is the reference the service observed; nil skips the staleness check.
ExpectedCurrent *PinnedReference
// Scope is the explicit deletion scope. A tag-safe delete must not remove sibling references.
Scope DeleteSemantics
// Lock is the writer lock already held by the service.
Lock LockHandle
}
DeleteOptions control one repository deletion.
type DeleteRequest ¶
type DeleteRequest struct {
// Execution carries the wrapper-owned operation identity and retry budget.
Execution Execution
// Repository is the required configured repository alias.
Repository string
// Ref selects the artifact.
Ref Ref
}
DeleteRequest deletes an artifact from one repository.
type DeleteResult ¶
type DeleteResult struct {
// Deleted lists removed locations.
Deleted []string
// Affected lists other references that resolved to the removed content.
Affected []Ref
// Digest is the removed resolved digest.
Digest digest.Digest
}
DeleteResult reports what a deletion removed and affected.
type DeleteSemantics ¶
type DeleteSemantics string
DeleteSemantics describes what deleting a reference removes.
const ( // DeleteNone means the repository cannot delete. DeleteNone DeleteSemantics = "none" // DeleteReference removes only the named reference (tag-safe). DeleteReference DeleteSemantics = "reference" // DeleteManifest removes a manifest by digest, affecting every reference to it. DeleteManifest DeleteSemantics = "manifest" // DeleteObject removes the stored record and payload objects. DeleteObject DeleteSemantics = "object" )
Delete semantics a repository can advertise.
type Diagnostic ¶
type Diagnostic struct {
// Severity is info, warning, or error.
Severity Severity `json:"severity"`
// Code is a stable machine-readable identifier.
Code string `json:"code,omitempty"`
// Message is the human-readable text. It never contains credentials.
Message string `json:"message"`
}
Diagnostic is a structured, non-fatal message attached to a result.
type Document ¶
type Document struct {
// Role is readme or changelog. At most one document exists per role.
Role DocumentRole `json:"role"`
// SourcePath is the original source path, relative to the publish source.
SourcePath string `json:"source_path"`
// MediaType is the document media type, normally [DocumentMediaType].
MediaType string `json:"media_type"`
// Size is the document size in bytes (at most [MaxDocumentSize]).
Size int64 `json:"size"`
// Digest is the SHA-256 of the document bytes.
Digest digest.Digest `json:"digest"`
}
Document describes one distribution document. Catalogs carry descriptors, never full Markdown.
type DocumentResult ¶
type DocumentResult struct {
// Operation is the typed operation result.
Operation OperationResult `json:"operation"`
// Document is the descriptor from the Record.
Document Document `json:"document"`
// Content is the verified document bytes.
Content []byte `json:"content"`
}
DocumentResult is the result of Service.ShowDocument. Content is bounded by MaxDocumentSize.
type DocumentRole ¶
type DocumentRole string
DocumentRole is the role of a package document.
const ( // DocumentReadme is the package README. DocumentReadme DocumentRole = "readme" // DocumentChangelog is the package CHANGELOG. DocumentChangelog DocumentRole = "changelog" )
Package document roles.
type DocumentStream ¶
type DocumentStream struct {
// Document is the descriptor from the Record.
Document Document
// Reader yields the document bytes and fails with an integrity error at EOF on mismatch.
// The caller closes it. Callers bound reads to [MaxDocumentSize].
Reader io.ReadCloser
}
DocumentStream is an open, digest-verifying reader over one package document.
type Entry ¶
type Entry struct {
// Path is the relative, slash-separated path inside the package.
Path string `json:"path"`
// Type is file, directory, or symlink.
Type EntryType `json:"type"`
// Size is the file size in bytes; zero for directories and symlinks.
Size int64 `json:"size"`
// Mode holds ordinary permission bits (0o777 mask); privileged bits are always cleared.
// Symlinks have mode zero so equivalent trees share one canonical form.
Mode uint32 `json:"mode"`
// Digest is the SHA-256 of a regular file's bytes; empty for other types.
Digest digest.Digest `json:"digest,omitempty"`
// Target is a symlink's relative target; empty for other types.
Target string `json:"target,omitempty"`
}
Entry is one inventory item. Hard links are represented as independent regular files.
type EntryType ¶
type EntryType string
EntryType is the type of an inventory entry.
const ( // EntryFile is a regular file. EntryFile EntryType = "file" // EntryDirectory is a directory. EntryDirectory EntryType = "directory" // EntrySymlink is a symbolic link whose target stays inside the package. EntrySymlink EntryType = "symlink" )
Inventory entry types. Devices, sockets, and other special files are never representable.
type EvidenceBlob ¶
type EvidenceBlob struct {
// Evidence locates and describes the blob.
Evidence SignatureEvidence
// Data holds the evidence bytes.
Data []byte
}
EvidenceBlob is evidence together with its bytes, bounded by MaxEvidenceSize.
type EvidenceFormat ¶
type EvidenceFormat string
EvidenceFormat identifies a signature evidence encoding.
const ( // EvidenceSigstoreBundle is a Sigstore bundle verified against trusted certificate identities. EvidenceSigstoreBundle EvidenceFormat = "sigstore-bundle" // EvidencePublicKeyBundle is a bundle verified against an explicitly configured public key. // It never satisfies an OIDC issuer/identity requirement. EvidencePublicKeyBundle EvidenceFormat = "public-key-bundle" )
Evidence formats supported in V1. Other formats require dedicated tested providers; unsupported required evidence fails closed.
type EvidencePayload ¶
type EvidencePayload struct {
// Format is the evidence encoding.
Format EvidenceFormat
// MediaType is the evidence media type.
MediaType string
// Data holds the evidence bytes.
Data []byte
}
EvidencePayload is freshly produced signature evidence, bounded by MaxEvidenceSize.
type EvidenceReader ¶
type EvidenceReader interface {
// ReadEvidence returns the evidence blobs bound to the pinned artifact. The evidence is
// untrusted until verified.
ReadEvidence(ctx context.Context, pinned *PinnedReference) ([]EvidenceBlob, error)
}
EvidenceReader is an optional Repository extension that exports the signature evidence stored for a pinned artifact, so a copy through the shared staging fallback can carry it along.
type EvidenceWriter ¶
type EvidenceWriter interface {
// WriteEvidence stores evidence for the pinned artifact and returns its stored descriptors.
WriteEvidence(ctx context.Context, pinned *PinnedReference, evidence []EvidenceBlob, lock LockHandle) ([]SignatureEvidence, error)
}
EvidenceWriter is an optional Repository extension that imports signature evidence for an artifact the repository already holds. It never changes the signed Record or native graph root.
type Exclusion ¶
type Exclusion struct {
// Path is the slash-separated source path relative to the source root. A directory is listed
// once, without its descendants.
Path string `json:"path"`
// Rule is the default rule that excluded the entry, for example ".terraform/**".
Rule string `json:"rule"`
}
Exclusion records one source entry that a kind-specific producer left out of the payload, and the visible rule that excluded it. Exclusions are reported with the plan; they are not part of the Record, so they never affect its digests.
type Execution ¶
type Execution struct {
// OperationID is the logical operation identifier. Empty means the service generates one.
OperationID string
// PreparedAt is the single UTC preparation time. Zero means the service reads its clock.
PreparedAt time.Time
// MaxAttempts overrides the number of transport attempts for this call. Zero keeps the
// service default. One disables transport retries.
MaxAttempts int
}
Execution carries the per-call execution settings that a wrapper (a workflow runner, a custom command, or a hook) supplies when it owns the retry policy. The zero value is the behavior of a standalone CLI call: the service generates a fresh operation identity and applies its own transport retry budget.
A wrapper that retries a whole operation captures one Execution before the first attempt and passes the same value on every attempt. The operation ID and the UTC preparation time then stay stable, so a publication keeps its creation time and a report can deduplicate attempts by the logical operation ID. The wrapper also sets Execution.MaxAttempts to 1, so the wrapper's retry budget and the service's transport retries never multiply.
type GraphSource ¶
type GraphSource interface {
// Root returns the original manifest or index descriptor.
Root() ocispec.Descriptor
// Fetch returns the raw bytes of a graph node by descriptor.
Fetch(ctx context.Context, descriptor ocispec.Descriptor) (io.ReadCloser, error)
// Successors lists the descriptors a node references (config, layers, children).
Successors(ctx context.Context, descriptor ocispec.Descriptor) ([]ocispec.Descriptor, error)
}
GraphSource exposes an existing OCI graph for transfer without importing a registry SDK.
type IdentityResolver ¶
IdentityResolver lazily resolves credentials for a named Atmos auth identity. Backends call it only when an operation needs credentials; constructing a repository, validating configuration, describing configuration, and dry runs never call it. The concrete credential type is owned by the backend that asked for it.
type InspectRequest ¶
type InspectRequest struct {
// Execution carries the wrapper-owned operation identity and retry budget.
Execution Execution
// Repository is the required configured repository alias.
Repository string
// Ref selects the artifact.
Ref Ref
}
InspectRequest inspects an artifact without downloading its payload.
type InspectResult ¶
type InspectResult struct {
// Operation is the typed operation result stored under StepResult.Metadata["artifact"].
Operation OperationResult `json:"operation"`
// Inspection is the metadata view.
Inspection Inspection `json:"inspection"`
// Verification is set when policy required or constrained verification; nil means unchecked.
Verification *VerificationResult `json:"verification,omitempty"`
}
InspectResult is the result of Service.Inspect.
type Inspection ¶
type Inspection struct {
// Pinned is the immutable reference that was inspected.
Pinned PinnedReference `json:"pinned"`
// Record is the portable Record; nil for a foreign OCI graph that carries none.
Record *Record `json:"record,omitempty"`
// Representation describes how the artifact is stored.
Representation Representation `json:"representation"`
// Evidence lists signature evidence found for the artifact. It is untrusted until verified.
Evidence []SignatureEvidence `json:"evidence,omitempty"`
}
Inspection is the metadata view of one artifact, available without downloading the payload.
type KindData ¶
type KindData []byte
KindData is optional, kind-specific record data held as canonical JSON bytes.
Design: a Record cannot carry map[string]any or float64 in its canonical path, yet kinds (for example legacy CI planfiles) need typed extra data. KindData is therefore a typed raw-JSON holder. NewKindData marshals a caller-owned typed value and immediately re-encodes it with CanonicalizeJSON, which sorts object keys, writes stable string escapes, and rejects floats, duplicate keys, and invalid UTF-8. A KindData value is always canonical, so it embeds into the Record bytes unchanged and participates in the intent and record digests byte-for-byte. Consumers read it back into their own typed struct with KindData.Decode.
func NewKindData ¶
NewKindData canonicalizes v, which should be a typed struct, into KindData.
func (KindData) Decode ¶
Decode unmarshals the kind data into v, a pointer to the kind's typed struct.
func (KindData) MarshalJSON ¶
MarshalJSON implements json.Marshaler, emitting the canonical bytes.
func (*KindData) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler, canonicalizing the input.
type KindDescriptor ¶
type KindDescriptor struct {
// Kind is the repository kind name, for example "aws/s3".
Kind string
// Capabilities are the capabilities known from configuration alone (supported packagings and
// lock scopes). A constructed repository's own Capabilities refine them.
Capabilities Capabilities
// DefaultPackaging is the packaging used when the configuration omits it.
DefaultPackaging Packaging
// PathOptions names the option keys that are local destination paths. Relative values resolve
// against the declaring configuration file when the configuration is loaded.
PathOptions []string
// AllowsPermissions reports that the kind accepts the `permissions` field.
AllowsPermissions bool
// AllowsCatalog reports that the kind accepts the `catalog` field.
AllowsCatalog bool
// NewOptions returns a fresh typed options struct for strict decoding and validation.
NewOptions func() Options
}
KindDescriptor is the static, network-free description of a repository kind. Configuration validation, path anchoring, and lock delegation checks use it before any backend exists or any credential is resolved.
The V1 kinds below have built-in descriptors so that validation works before backend packages register. A backend that registers its kind supplies its own descriptor, which then takes precedence (typically a copy of the built-in one with refinements).
func BuiltinKind ¶
func BuiltinKind(kind string) (*KindDescriptor, bool)
BuiltinKind returns the built-in descriptor of a V1 repository kind.
func LookupRepositoryKind ¶
func LookupRepositoryKind(kind string) (*KindDescriptor, bool)
LookupRepositoryKind looks up a kind in the process-wide registry.
func (*KindDescriptor) EffectivePackaging ¶
func (d *KindDescriptor) EffectivePackaging(configured string) Packaging
EffectivePackaging returns the configured packaging, or the kind's default when it is omitted.
func (*KindDescriptor) UsesLocalPath ¶
func (d *KindDescriptor) UsesLocalPath(option string) bool
UsesLocalPath reports whether the named option of the kind is a local destination path.
type Label ¶
type Label struct {
// Key is the label key.
Key string `json:"key"`
// Value is the label value.
Value string `json:"value"`
}
Label is an exact key/value selector or assignment.
type ListEntry ¶
type ListEntry struct {
// Pinned is the immutable reference.
Pinned PinnedReference `json:"pinned"`
// Name is the artifact name.
Name string `json:"name"`
// Version is the version label.
Version string `json:"version"`
// Kind is the artifact kind.
Kind string `json:"kind"`
// Description is the metadata description.
Description string `json:"description,omitempty"`
// Labels are the metadata labels.
Labels map[string]string `json:"labels,omitempty"`
// Documents are the document descriptors, never the Markdown itself.
Documents []Document `json:"documents,omitempty"`
// Repository is the configured repository alias the entry came from.
Repository string `json:"repository,omitempty"`
}
ListEntry summarizes one artifact in a listing.
type ListPage ¶
type ListPage struct {
// Entries are the page's artifacts, sorted lexically by name then version.
Entries []ListEntry
// NextCursor is empty when the page is the last.
NextCursor string
}
ListPage is one page of entries plus a cursor.
type ListQuery ¶
type ListQuery struct {
// Name restricts the listing to versions of one exact name; empty enumerates the collection.
Name string
// Labels keep only entries whose labels match every selector exactly.
Labels []Label
// Cursor is the opaque cursor from the previous page; empty starts at the beginning.
Cursor string
// PageSize bounds the page; zero lets the repository choose.
PageSize int
// Refresh bypasses cached discovery snapshots.
Refresh bool
// Known maps resolved digests to entries listed earlier (for example from a previous discovery
// snapshot). A repository may reuse a known entry instead of re-reading the metadata of a
// reference whose resolved digest is unchanged; it must still resolve every reference, so a
// disappeared or moved reference is never kept. Repositories that cannot reuse metadata ignore it.
Known map[digest.Digest]ListEntry
}
ListQuery selects one page of managed references. The service consumes pagination.
type ListRequest ¶
type ListRequest struct {
// Repositories restricts the listing; empty means all configured repositories.
Repositories []string
// Name restricts the listing to versions of one exact name.
Name string
// Labels keep only entries whose labels match every selector exactly.
Labels []Label
// Refresh bypasses cached discovery snapshots.
Refresh bool
}
ListRequest lists artifacts. List and search intentionally default to all configured repositories.
type ListResult ¶
type ListResult struct {
// Artifacts are the entries across the selected repositories, sorted lexically.
Artifacts []ListEntry `json:"artifacts"`
// Repositories reports per-repository outcomes.
Repositories []RepositoryListing `json:"repositories,omitempty"`
// Incomplete is true when at least one selected repository could not be listed, so Artifacts
// must not be read as the whole collection. Each failing repository carries an error diagnostic.
Incomplete bool `json:"incomplete,omitempty"`
}
ListResult is the result of Service.List and Service.Search. Its JSON name for the entries is "artifacts".
type LocalArchiveOptions ¶
type LocalArchiveOptions struct {
// Path is the destination root directory.
Path string `mapstructure:"path"`
// KeyPattern overrides the archive file path below the root.
KeyPattern string `mapstructure:"key_pattern"`
}
LocalArchiveOptions are the options of a local/archive repository.
func (*LocalArchiveOptions) Validate ¶
func (o *LocalArchiveOptions) Validate() error
Validate implements Options.
func (*LocalArchiveOptions) ValidateForPackaging ¶
func (o *LocalArchiveOptions) ValidateForPackaging(packaging Packaging) error
ValidateForPackaging implements PackagingValidator.
type LocalDirOptions ¶
type LocalDirOptions struct {
// Path is the destination root directory.
Path string `mapstructure:"path"`
// KeyPattern overrides the payload directory path below the root.
KeyPattern string `mapstructure:"key_pattern"`
}
LocalDirOptions are the options of a local/dir repository.
func (*LocalDirOptions) Validate ¶
func (o *LocalDirOptions) Validate() error
Validate implements Options.
func (*LocalDirOptions) ValidateForPackaging ¶
func (o *LocalDirOptions) ValidateForPackaging(packaging Packaging) error
ValidateForPackaging implements PackagingValidator.
type LockHandle ¶
type LockHandle interface {
// Resource returns the locked resource.
Resource() string
// Owner returns the owner recorded in the claim.
Owner() string
// Scope returns the actual scope provided, which results report.
Scope() LockScope
// Token returns the ownership token checked on renew and release.
Token() string
// ExpiresAt returns the lease expiry and whether the lock expires at all.
ExpiresAt() (time.Time, bool)
// Renew extends a leased lock; providers without leases return an unsupported-capability error.
Renew(ctx context.Context, lease time.Duration) error
// Release relinquishes the lock after checking the ownership token.
Release(ctx context.Context) error
}
LockHandle is an acquired, ownership-checked lock. Release verifies the ownership token and never releases another operation's claim. Providers never steal a lock automatically.
type LockNamespacer ¶
type LockNamespacer interface {
// LockNamespace returns a stable, credential-free identifier of the collection, for example a
// registry and prefix, a bucket and prefix, or an absolute directory.
LockNamespace() string
}
LockNamespacer is optionally implemented by repositories to name their collection for lock keys. When a repository delegates locking to another repository, the delegate's lock resource is scoped by this namespace, so unrelated collections that share one coordinator never contend and two aliases for the same collection always do. A repository without it is scoped by its alias.
type LockProvider ¶
type LockProvider interface {
// Lock acquires an ownership-checked lock satisfying request.Required, or returns a
// *CapabilityError wrapping ErrArtifactUnsupportedCapability when the guarantee is unavailable.
// It never steals another operation's lock and never silently downgrades the scope.
Lock(ctx context.Context, request LockRequest) (LockHandle, error)
}
LockProvider coordinates artifact mutations. Repositories implement it directly or by composing a shared provider (filesystem locks, S3 conditional owner claims, a delegated lock repository).
type LockRequest ¶
type LockRequest struct {
// Resource identifies what is being mutated, for example a canonical reference key.
Resource string
// Owner identifies the writer, for example host and process.
Owner string
// OperationID is the logical operation identifier recorded in the claim.
OperationID string
// Required is the minimum guarantee the caller needs. Empty means host scope.
Required LockScope
// Lease is the requested lease duration for providers that expire claims. V1 claims do not
// expire automatically, so zero means no expiry and providers without fencing must reject
// a non-zero lease with an unsupported-capability error.
Lease time.Duration
}
LockRequest asks a repository to coordinate a mutation of one resource. Multi-resource work acquires locks in canonical repository/resource order to avoid deadlocks.
type LockScope ¶
type LockScope string
LockScope is the strength of mutation coordination a lock provides.
const ( // LockScopeHost serializes writers on one host. It is the default for single-host use. LockScopeHost LockScope = "host" // LockScopeRepository serializes writers across hosts through the repository's own // coordination (for example S3 conditional owner claims or a configured lock repository). LockScopeRepository LockScope = "repository" )
Lock scopes. No S3 Object Lock retention, OCI tag, or local-cache lock is a distributed lease.
type Metadata ¶
type Metadata struct {
// Description is a short human-readable description.
Description string `json:"description,omitempty"`
// Labels are opaque string key/value pairs set by the user.
Labels map[string]string `json:"labels,omitempty"`
// Provenance is generated CI and source context. It is part of the record digest but excluded
// from the intent digest so that retries and no-op detection are not defeated by run IDs.
Provenance *Provenance `json:"provenance,omitempty"`
}
Metadata is the descriptive metadata of a Record. No stack, component, or SHA is required.
type MockCopier ¶
type MockCopier struct {
// contains filtered or unexported fields
}
MockCopier is a mock of Copier interface.
func NewMockCopier ¶
func NewMockCopier(ctrl *gomock.Controller) *MockCopier
NewMockCopier creates a new mock instance.
func (*MockCopier) CanCopyFrom ¶
func (m *MockCopier) CanCopyFrom(source Repository) bool
CanCopyFrom mocks base method.
func (*MockCopier) CopyFrom ¶
func (m *MockCopier) CopyFrom(ctx context.Context, source Repository, pinned PinnedReference, options CopyFromOptions) (*PublishResult, error)
CopyFrom mocks base method.
func (*MockCopier) EXPECT ¶
func (m *MockCopier) EXPECT() *MockCopierMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockCopierMockRecorder ¶
type MockCopierMockRecorder struct {
// contains filtered or unexported fields
}
MockCopierMockRecorder is the mock recorder for MockCopier.
func (*MockCopierMockRecorder) CanCopyFrom ¶
func (mr *MockCopierMockRecorder) CanCopyFrom(source any) *gomock.Call
CanCopyFrom indicates an expected call of CanCopyFrom.
type MockEvidenceReader ¶
type MockEvidenceReader struct {
// contains filtered or unexported fields
}
MockEvidenceReader is a mock of EvidenceReader interface.
func NewMockEvidenceReader ¶
func NewMockEvidenceReader(ctrl *gomock.Controller) *MockEvidenceReader
NewMockEvidenceReader creates a new mock instance.
func (*MockEvidenceReader) EXPECT ¶
func (m *MockEvidenceReader) EXPECT() *MockEvidenceReaderMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockEvidenceReader) ReadEvidence ¶
func (m *MockEvidenceReader) ReadEvidence(ctx context.Context, pinned *PinnedReference) ([]EvidenceBlob, error)
ReadEvidence mocks base method.
type MockEvidenceReaderMockRecorder ¶
type MockEvidenceReaderMockRecorder struct {
// contains filtered or unexported fields
}
MockEvidenceReaderMockRecorder is the mock recorder for MockEvidenceReader.
func (*MockEvidenceReaderMockRecorder) ReadEvidence ¶
func (mr *MockEvidenceReaderMockRecorder) ReadEvidence(ctx, pinned any) *gomock.Call
ReadEvidence indicates an expected call of ReadEvidence.
type MockEvidenceWriter ¶
type MockEvidenceWriter struct {
// contains filtered or unexported fields
}
MockEvidenceWriter is a mock of EvidenceWriter interface.
func NewMockEvidenceWriter ¶
func NewMockEvidenceWriter(ctrl *gomock.Controller) *MockEvidenceWriter
NewMockEvidenceWriter creates a new mock instance.
func (*MockEvidenceWriter) EXPECT ¶
func (m *MockEvidenceWriter) EXPECT() *MockEvidenceWriterMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockEvidenceWriter) WriteEvidence ¶
func (m *MockEvidenceWriter) WriteEvidence(ctx context.Context, pinned *PinnedReference, evidence []EvidenceBlob, lock LockHandle) ([]SignatureEvidence, error)
WriteEvidence mocks base method.
type MockEvidenceWriterMockRecorder ¶
type MockEvidenceWriterMockRecorder struct {
// contains filtered or unexported fields
}
MockEvidenceWriterMockRecorder is the mock recorder for MockEvidenceWriter.
func (*MockEvidenceWriterMockRecorder) WriteEvidence ¶
func (mr *MockEvidenceWriterMockRecorder) WriteEvidence(ctx, pinned, evidence, lock any) *gomock.Call
WriteEvidence indicates an expected call of WriteEvidence.
type MockGraphSource ¶
type MockGraphSource struct {
// contains filtered or unexported fields
}
MockGraphSource is a mock of GraphSource interface.
func NewMockGraphSource ¶
func NewMockGraphSource(ctrl *gomock.Controller) *MockGraphSource
NewMockGraphSource creates a new mock instance.
func (*MockGraphSource) EXPECT ¶
func (m *MockGraphSource) EXPECT() *MockGraphSourceMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockGraphSource) Fetch ¶
func (m *MockGraphSource) Fetch(ctx context.Context, descriptor v1.Descriptor) (io.ReadCloser, error)
Fetch mocks base method.
func (*MockGraphSource) Root ¶
func (m *MockGraphSource) Root() v1.Descriptor
Root mocks base method.
func (*MockGraphSource) Successors ¶
func (m *MockGraphSource) Successors(ctx context.Context, descriptor v1.Descriptor) ([]v1.Descriptor, error)
Successors mocks base method.
type MockGraphSourceMockRecorder ¶
type MockGraphSourceMockRecorder struct {
// contains filtered or unexported fields
}
MockGraphSourceMockRecorder is the mock recorder for MockGraphSource.
func (*MockGraphSourceMockRecorder) Fetch ¶
func (mr *MockGraphSourceMockRecorder) Fetch(ctx, descriptor any) *gomock.Call
Fetch indicates an expected call of Fetch.
func (*MockGraphSourceMockRecorder) Root ¶
func (mr *MockGraphSourceMockRecorder) Root() *gomock.Call
Root indicates an expected call of Root.
func (*MockGraphSourceMockRecorder) Successors ¶
func (mr *MockGraphSourceMockRecorder) Successors(ctx, descriptor any) *gomock.Call
Successors indicates an expected call of Successors.
type MockLockHandle ¶
type MockLockHandle struct {
// contains filtered or unexported fields
}
MockLockHandle is a mock of LockHandle interface.
func NewMockLockHandle ¶
func NewMockLockHandle(ctrl *gomock.Controller) *MockLockHandle
NewMockLockHandle creates a new mock instance.
func (*MockLockHandle) EXPECT ¶
func (m *MockLockHandle) EXPECT() *MockLockHandleMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockLockHandle) ExpiresAt ¶
func (m *MockLockHandle) ExpiresAt() (time.Time, bool)
ExpiresAt mocks base method.
func (*MockLockHandle) Release ¶
func (m *MockLockHandle) Release(ctx context.Context) error
Release mocks base method.
func (*MockLockHandle) Resource ¶
func (m *MockLockHandle) Resource() string
Resource mocks base method.
type MockLockHandleMockRecorder ¶
type MockLockHandleMockRecorder struct {
// contains filtered or unexported fields
}
MockLockHandleMockRecorder is the mock recorder for MockLockHandle.
func (*MockLockHandleMockRecorder) ExpiresAt ¶
func (mr *MockLockHandleMockRecorder) ExpiresAt() *gomock.Call
ExpiresAt indicates an expected call of ExpiresAt.
func (*MockLockHandleMockRecorder) Owner ¶
func (mr *MockLockHandleMockRecorder) Owner() *gomock.Call
Owner indicates an expected call of Owner.
func (*MockLockHandleMockRecorder) Release ¶
func (mr *MockLockHandleMockRecorder) Release(ctx any) *gomock.Call
Release indicates an expected call of Release.
func (*MockLockHandleMockRecorder) Renew ¶
func (mr *MockLockHandleMockRecorder) Renew(ctx, lease any) *gomock.Call
Renew indicates an expected call of Renew.
func (*MockLockHandleMockRecorder) Resource ¶
func (mr *MockLockHandleMockRecorder) Resource() *gomock.Call
Resource indicates an expected call of Resource.
func (*MockLockHandleMockRecorder) Scope ¶
func (mr *MockLockHandleMockRecorder) Scope() *gomock.Call
Scope indicates an expected call of Scope.
func (*MockLockHandleMockRecorder) Token ¶
func (mr *MockLockHandleMockRecorder) Token() *gomock.Call
Token indicates an expected call of Token.
type MockLockProvider ¶
type MockLockProvider struct {
// contains filtered or unexported fields
}
MockLockProvider is a mock of LockProvider interface.
func NewMockLockProvider ¶
func NewMockLockProvider(ctrl *gomock.Controller) *MockLockProvider
NewMockLockProvider creates a new mock instance.
func (*MockLockProvider) EXPECT ¶
func (m *MockLockProvider) EXPECT() *MockLockProviderMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockLockProvider) Lock ¶
func (m *MockLockProvider) Lock(ctx context.Context, request LockRequest) (LockHandle, error)
Lock mocks base method.
type MockLockProviderMockRecorder ¶
type MockLockProviderMockRecorder struct {
// contains filtered or unexported fields
}
MockLockProviderMockRecorder is the mock recorder for MockLockProvider.
type MockProducer ¶
type MockProducer struct {
// contains filtered or unexported fields
}
MockProducer is a mock of Producer interface.
func NewMockProducer ¶
func NewMockProducer(ctrl *gomock.Controller) *MockProducer
NewMockProducer creates a new mock instance.
func (*MockProducer) EXPECT ¶
func (m *MockProducer) EXPECT() *MockProducerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockProducer) Prepare ¶
func (m *MockProducer) Prepare(ctx context.Context, request PrepareRequest) (*PreparedArtifact, error)
Prepare mocks base method.
type MockProducerMockRecorder ¶
type MockProducerMockRecorder struct {
// contains filtered or unexported fields
}
MockProducerMockRecorder is the mock recorder for MockProducer.
func (*MockProducerMockRecorder) Kind ¶
func (mr *MockProducerMockRecorder) Kind() *gomock.Call
Kind indicates an expected call of Kind.
type MockRepository ¶
type MockRepository struct {
// contains filtered or unexported fields
}
MockRepository is a mock of Repository interface.
func NewMockRepository ¶
func NewMockRepository(ctrl *gomock.Controller) *MockRepository
NewMockRepository creates a new mock instance.
func (*MockRepository) Capabilities ¶
func (m *MockRepository) Capabilities() Capabilities
Capabilities mocks base method.
func (*MockRepository) Delete ¶
func (m *MockRepository) Delete(ctx context.Context, pinned PinnedReference, options DeleteOptions) (*DeleteResult, error)
Delete mocks base method.
func (*MockRepository) EXPECT ¶
func (m *MockRepository) EXPECT() *MockRepositoryMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockRepository) Inspect ¶
func (m *MockRepository) Inspect(ctx context.Context, pinned PinnedReference) (*Inspection, error)
Inspect mocks base method.
func (*MockRepository) Lock ¶
func (m *MockRepository) Lock(ctx context.Context, request LockRequest) (LockHandle, error)
Lock mocks base method.
func (*MockRepository) OpenDocument ¶
func (m *MockRepository) OpenDocument(ctx context.Context, pinned PinnedReference, role DocumentRole) (*DocumentStream, error)
OpenDocument mocks base method.
func (*MockRepository) Pin ¶
func (m *MockRepository) Pin(ctx context.Context, ref Ref) (PinnedReference, error)
Pin mocks base method.
func (*MockRepository) Publish ¶
func (m *MockRepository) Publish(ctx context.Context, prepared *PreparedArtifact, options PublishOptions) (*PublishResult, error)
Publish mocks base method.
func (*MockRepository) Read ¶
func (m *MockRepository) Read(ctx context.Context, pinned PinnedReference) (*Content, error)
Read mocks base method.
func (*MockRepository) Resolve ¶
func (m *MockRepository) Resolve(ctx context.Context, ref Ref) (PinnedReference, error)
Resolve mocks base method.
func (*MockRepository) Sign ¶
func (m *MockRepository) Sign(ctx context.Context, subject SignatureSubject, signer Signer, options SignOptions) ([]SignatureEvidence, error)
Sign mocks base method.
func (*MockRepository) Verify ¶
func (m *MockRepository) Verify(ctx context.Context, subject SignatureSubject, policy VerificationPolicy) (*VerificationResult, error)
Verify mocks base method.
type MockRepositoryMockRecorder ¶
type MockRepositoryMockRecorder struct {
// contains filtered or unexported fields
}
MockRepositoryMockRecorder is the mock recorder for MockRepository.
func (*MockRepositoryMockRecorder) Capabilities ¶
func (mr *MockRepositoryMockRecorder) Capabilities() *gomock.Call
Capabilities indicates an expected call of Capabilities.
func (*MockRepositoryMockRecorder) Delete ¶
func (mr *MockRepositoryMockRecorder) Delete(ctx, pinned, options any) *gomock.Call
Delete indicates an expected call of Delete.
func (*MockRepositoryMockRecorder) Inspect ¶
func (mr *MockRepositoryMockRecorder) Inspect(ctx, pinned any) *gomock.Call
Inspect indicates an expected call of Inspect.
func (*MockRepositoryMockRecorder) List ¶
func (mr *MockRepositoryMockRecorder) List(ctx, query any) *gomock.Call
List indicates an expected call of List.
func (*MockRepositoryMockRecorder) Lock ¶
func (mr *MockRepositoryMockRecorder) Lock(ctx, request any) *gomock.Call
Lock indicates an expected call of Lock.
func (*MockRepositoryMockRecorder) OpenDocument ¶
func (mr *MockRepositoryMockRecorder) OpenDocument(ctx, pinned, role any) *gomock.Call
OpenDocument indicates an expected call of OpenDocument.
func (*MockRepositoryMockRecorder) Pin ¶
func (mr *MockRepositoryMockRecorder) Pin(ctx, ref any) *gomock.Call
Pin indicates an expected call of Pin.
func (*MockRepositoryMockRecorder) Publish ¶
func (mr *MockRepositoryMockRecorder) Publish(ctx, prepared, options any) *gomock.Call
Publish indicates an expected call of Publish.
func (*MockRepositoryMockRecorder) Read ¶
func (mr *MockRepositoryMockRecorder) Read(ctx, pinned any) *gomock.Call
Read indicates an expected call of Read.
func (*MockRepositoryMockRecorder) Resolve ¶
func (mr *MockRepositoryMockRecorder) Resolve(ctx, ref any) *gomock.Call
Resolve indicates an expected call of Resolve.
type MockService ¶
type MockService struct {
// contains filtered or unexported fields
}
MockService is a mock of Service interface.
func NewMockService ¶
func NewMockService(ctrl *gomock.Controller) *MockService
NewMockService creates a new mock instance.
func (*MockService) Copy ¶
func (m *MockService) Copy(ctx context.Context, request CopyRequest) (*OperationResult, error)
Copy mocks base method.
func (*MockService) Delete ¶
func (m *MockService) Delete(ctx context.Context, request DeleteRequest) (*OperationResult, error)
Delete mocks base method.
func (*MockService) EXPECT ¶
func (m *MockService) EXPECT() *MockServiceMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockService) Inspect ¶
func (m *MockService) Inspect(ctx context.Context, request InspectRequest) (*InspectResult, error)
Inspect mocks base method.
func (*MockService) List ¶
func (m *MockService) List(ctx context.Context, request ListRequest) (*ListResult, error)
List mocks base method.
func (*MockService) Pin ¶
func (m *MockService) Pin(ctx context.Context, request PinRequest) (*PinResult, error)
Pin mocks base method.
func (*MockService) Publish ¶
func (m *MockService) Publish(ctx context.Context, request PublishRequest) (*OperationResult, error)
Publish mocks base method.
func (*MockService) Pull ¶
func (m *MockService) Pull(ctx context.Context, request PullRequest) (*OperationResult, error)
Pull mocks base method.
func (*MockService) Search ¶
func (m *MockService) Search(ctx context.Context, request SearchRequest) (*ListResult, error)
Search mocks base method.
func (*MockService) ShowDocument ¶
func (m *MockService) ShowDocument(ctx context.Context, request ShowDocumentRequest) (*DocumentResult, error)
ShowDocument mocks base method.
func (*MockService) Sign ¶
func (m *MockService) Sign(ctx context.Context, request SignRequest) (*SignResult, error)
Sign mocks base method.
func (*MockService) Verify ¶
func (m *MockService) Verify(ctx context.Context, request VerifyRequest) (*VerifyResult, error)
Verify mocks base method.
type MockServiceMockRecorder ¶
type MockServiceMockRecorder struct {
// contains filtered or unexported fields
}
MockServiceMockRecorder is the mock recorder for MockService.
func (*MockServiceMockRecorder) Copy ¶
func (mr *MockServiceMockRecorder) Copy(ctx, request any) *gomock.Call
Copy indicates an expected call of Copy.
func (*MockServiceMockRecorder) Delete ¶
func (mr *MockServiceMockRecorder) Delete(ctx, request any) *gomock.Call
Delete indicates an expected call of Delete.
func (*MockServiceMockRecorder) Inspect ¶
func (mr *MockServiceMockRecorder) Inspect(ctx, request any) *gomock.Call
Inspect indicates an expected call of Inspect.
func (*MockServiceMockRecorder) List ¶
func (mr *MockServiceMockRecorder) List(ctx, request any) *gomock.Call
List indicates an expected call of List.
func (*MockServiceMockRecorder) Pin ¶
func (mr *MockServiceMockRecorder) Pin(ctx, request any) *gomock.Call
Pin indicates an expected call of Pin.
func (*MockServiceMockRecorder) Publish ¶
func (mr *MockServiceMockRecorder) Publish(ctx, request any) *gomock.Call
Publish indicates an expected call of Publish.
func (*MockServiceMockRecorder) Pull ¶
func (mr *MockServiceMockRecorder) Pull(ctx, request any) *gomock.Call
Pull indicates an expected call of Pull.
func (*MockServiceMockRecorder) Search ¶
func (mr *MockServiceMockRecorder) Search(ctx, request any) *gomock.Call
Search indicates an expected call of Search.
func (*MockServiceMockRecorder) ShowDocument ¶
func (mr *MockServiceMockRecorder) ShowDocument(ctx, request any) *gomock.Call
ShowDocument indicates an expected call of ShowDocument.
type MockSigner ¶
type MockSigner struct {
// contains filtered or unexported fields
}
MockSigner is a mock of Signer interface.
func NewMockSigner ¶
func NewMockSigner(ctrl *gomock.Controller) *MockSigner
NewMockSigner creates a new mock instance.
func (*MockSigner) EXPECT ¶
func (m *MockSigner) EXPECT() *MockSignerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockSigner) Formats ¶
func (m *MockSigner) Formats() []EvidenceFormat
Formats mocks base method.
func (*MockSigner) Sign ¶
func (m *MockSigner) Sign(ctx context.Context, subject SignatureSubject) (*EvidencePayload, error)
Sign mocks base method.
type MockSignerMockRecorder ¶
type MockSignerMockRecorder struct {
// contains filtered or unexported fields
}
MockSignerMockRecorder is the mock recorder for MockSigner.
func (*MockSignerMockRecorder) Formats ¶
func (mr *MockSignerMockRecorder) Formats() *gomock.Call
Formats indicates an expected call of Formats.
type MockVerifier ¶
type MockVerifier struct {
// contains filtered or unexported fields
}
MockVerifier is a mock of Verifier interface.
func NewMockVerifier ¶
func NewMockVerifier(ctrl *gomock.Controller) *MockVerifier
NewMockVerifier creates a new mock instance.
func (*MockVerifier) EXPECT ¶
func (m *MockVerifier) EXPECT() *MockVerifierMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockVerifier) Formats ¶
func (m *MockVerifier) Formats() []EvidenceFormat
Formats mocks base method.
func (*MockVerifier) Verify ¶
func (m *MockVerifier) Verify(ctx context.Context, subject SignatureSubject, evidence []EvidenceBlob, policy VerificationPolicy) (*VerificationResult, error)
Verify mocks base method.
type MockVerifierMockRecorder ¶
type MockVerifierMockRecorder struct {
// contains filtered or unexported fields
}
MockVerifierMockRecorder is the mock recorder for MockVerifier.
func (*MockVerifierMockRecorder) Formats ¶
func (mr *MockVerifierMockRecorder) Formats() *gomock.Call
Formats indicates an expected call of Formats.
type OCILayoutOptions ¶
type OCILayoutOptions struct {
// Path is the OCI image layout directory.
Path string `mapstructure:"path"`
}
OCILayoutOptions are the options of an oci/layout repository.
func (*OCILayoutOptions) Validate ¶
func (o *OCILayoutOptions) Validate() error
Validate implements Options.
type OCIRegistryOptions ¶
type OCIRegistryOptions struct {
// Registry is the registry host, with an optional port, for example ghcr.io.
Registry string `mapstructure:"registry"`
// Prefix is the collection root path below the registry, for example acme/atmos.
Prefix string `mapstructure:"prefix"`
}
OCIRegistryOptions are the options of an oci/registry repository. The prefix is an Atmos collection-root convention, not an ORAS namespace field: Atmos maps a collection and artifact name onto an OCI repository path below it.
func (*OCIRegistryOptions) Validate ¶
func (o *OCIRegistryOptions) Validate() error
Validate implements Options.
type OperationResult ¶
type OperationResult struct {
// OperationID is the logical operation identifier.
OperationID string `json:"operation_id"`
// Action is the operation performed.
Action Action `json:"action"`
// Outcome classifies the result.
Outcome Outcome `json:"outcome"`
// Repository is the configured repository alias the operation targeted.
Repository string `json:"repository,omitempty"`
// Requested is the reference as requested by the caller.
Requested string `json:"requested_ref,omitempty"`
// Ref is the resolved reference.
Ref string `json:"ref,omitempty"`
// Location is the primary resolved storage location.
Location string `json:"location,omitempty"`
// Aliases lists additional locations or tags that resolve to the same content.
Aliases []string `json:"aliases,omitempty"`
// ResolvedDigest is the OCI manifest/index digest, or the record digest for local and S3.
ResolvedDigest digest.Digest `json:"resolved_digest,omitempty"`
// RecordDigest is the digest of the canonical Record bytes.
RecordDigest digest.Digest `json:"record_digest,omitempty"`
// ContentDigest is the portable content digest from the Record.
ContentDigest digest.Digest `json:"content_digest,omitempty"`
// RepresentationDigest is the checksum of the transferred payload representation.
RepresentationDigest digest.Digest `json:"representation_digest,omitempty"`
// Size is the transferred or described payload size in bytes.
Size int64 `json:"size,omitempty"`
// SizeMeasured distinguishes a measured empty payload from an unavailable size.
SizeMeasured bool `json:"-"`
// Duration is the wall-clock duration of the operation.
Duration time.Duration `json:"duration_ns,omitempty"`
// LockScope is the actual lock scope that coordinated a mutation.
LockScope LockScope `json:"lock_scope,omitempty"`
// Diagnostics are non-fatal messages.
Diagnostics []Diagnostic `json:"diagnostics,omitempty"`
}
OperationResult is the typed result of one operation. Its JSON field names match the named step outputs and structured CLI output; optional values are omitted rather than filled with misleading empty strings.
type Options ¶
type Options interface {
// Validate checks required options and value shapes.
Validate() error
}
Options is a typed, validated view of one repository kind's `options` map. The configuration schema keeps `options` a generic map so it never depends on a backend; each kind decodes it into its own struct with DecodeOptions and checks it with Validate. Validate never performs network access, credential resolution, or directory creation.
type Outcome ¶
type Outcome string
Outcome is the result classification of an operation.
const ( // OutcomeCreated means new state was written. OutcomeCreated Outcome = "created" // OutcomeUnchanged means the same intent already existed and nothing was written. OutcomeUnchanged Outcome = "unchanged" // OutcomeReplaced means existing state was replaced under force. OutcomeReplaced Outcome = "replaced" // OutcomeDeleted means state was removed. OutcomeDeleted Outcome = "deleted" // OutcomeRead means state was read or materialized without mutation. OutcomeRead Outcome = "read" // OutcomeDryRun means the operation was validated and planned but nothing was written. OutcomeDryRun Outcome = "dry-run" // OutcomeFailed means the operation did not complete. The service leaves the outcome empty on // failure so that a failure is never mistaken for success; command envelopes report this value. OutcomeFailed Outcome = "failed" )
Operation outcomes. A no-op returns the existing Record unchanged.
type Packaging ¶
type Packaging string
Packaging identifies how a file payload is stored in a repository.
const ( // PackagingNone stores copied files (local directories, S3 object-per-file). PackagingNone Packaging = "none" // PackagingTar stores one uncompressed tar archive. PackagingTar Packaging = "tar" // PackagingTgz stores one gzip-compressed tar archive. PackagingTgz Packaging = "tgz" // PackagingZip stores one zip archive. PackagingZip Packaging = "zip" // PackagingCatalog stores one catalog JSON document as the direct payload layer. Only Records // of kind "catalog" use it. PackagingCatalog Packaging = "catalog" // PackagingOCIGraph identifies an existing native OCI graph carried unchanged. PackagingOCIGraph Packaging = "oci-graph" )
Payload packaging modes.
type PackagingValidator ¶
type PackagingValidator interface {
// ValidateForPackaging checks the options against the effective packaging.
ValidateForPackaging(packaging Packaging) error
}
PackagingValidator is implemented by Options that depend on the effective packaging, for example to check that a key_pattern extension agrees with an archive format.
type PinRequest ¶
type PinRequest struct {
// Execution carries the wrapper-owned operation identity and retry budget.
Execution Execution
// Repository is the required configured repository alias.
Repository string
// Ref selects the artifact.
Ref Ref
}
PinRequest creates an immutable reference for consumer lockfiles.
type PinResult ¶
type PinResult struct {
// Operation is the typed operation result.
Operation OperationResult `json:"operation"`
// Pinned is the immutable reference.
Pinned PinnedReference `json:"pinned"`
}
PinResult is the result of Service.Pin.
type PinnedReference ¶
type PinnedReference struct {
// Ref is the reference that was pinned, as requested.
Ref Ref `json:"ref"`
// Repository is the repository locator (a registry path, bucket and prefix, or directory),
// never credentials.
Repository string `json:"repository"`
// ResolvedDigest is the OCI manifest/index digest, or the record digest for local and S3.
ResolvedDigest digest.Digest `json:"resolved_digest"`
// RecordDigest is the digest of the canonical Record bytes, when a Record is bound.
RecordDigest digest.Digest `json:"record_digest,omitempty"`
// ContentDigest is the portable content digest from the Record, when a Record is bound.
ContentDigest digest.Digest `json:"content_digest,omitempty"`
// Evidence lists the signature evidence descriptors known at pin time.
Evidence []ocispec.Descriptor `json:"evidence,omitempty"`
// Platform is the selected platform when a multi-platform index was narrowed.
Platform *ocispec.Platform `json:"platform,omitempty"`
}
PinnedReference is an immutable reference suitable for consumer lockfiles. It is not a write lock and not a substitute for signature verification; trust policy is reevaluated on use.
type PrepareRequest ¶
type PrepareRequest struct {
// Source is the local source file or directory.
Source string
// Name is the explicit artifact name; empty lets the producer supply one.
Name string
// Version is the explicit version; empty lets the producer supply one or the operation fails.
Version string
// Kind is the artifact kind; empty means [KindFiles].
Kind string
// Metadata is the effective user metadata (description, labels) merged by the service.
Metadata Metadata
// Readme overrides the README source path, relative to the source directory.
Readme string
// Changelog overrides the CHANGELOG source path, relative to the source directory.
Changelog string
// Packaging is the target repository's effective packaging mode.
Packaging Packaging
// OperationID is the logical operation identifier.
OperationID string
// PreparedAt is the single UTC preparation time.
PreparedAt time.Time
}
PrepareRequest carries everything a Producer needs. The service captures PreparedAt (UTC) and OperationID once, before the first attempt, and reuses them on every retry.
type PreparedArtifact ¶
type PreparedArtifact struct {
// Record is the sealed Record to publish.
Record Record
// IntentDigest is the Record's intent digest.
IntentDigest digest.Digest
// OperationID is the logical operation identifier, stable across retries.
OperationID string
// PreparedAt is the single UTC preparation time.
PreparedAt time.Time
// Packaging is the packaging mode of the staged payload.
Packaging Packaging
// Blobs are the staged payload and document blobs.
Blobs []StagedBlob
// Exclusions lists the source entries a kind-specific producer left out of the payload.
Exclusions []Exclusion
// Cleanup releases temporary resources owned by this operation; may be nil.
Cleanup func() error
// contains filtered or unexported fields
}
PreparedArtifact is the output of a Producer: a sealed Record plus staged blobs. The preparer captured one UTC preparation time and one logical operation ID before the first attempt.
A PreparedArtifact owns temporary resources. Whoever finally consumes it must call Close, which runs the cleanup function exactly once. It must not be copied after first use.
func (*PreparedArtifact) Close ¶
func (p *PreparedArtifact) Close() error
Close releases the temporary resources owned by the PreparedArtifact. It is idempotent: the cleanup function runs at most once and later calls return the first result.
type Producer ¶
type Producer interface {
// Kind returns the artifact kind this producer supplies, for example "files".
Kind() string
// Prepare reads the source and returns a stable, sealed PreparedArtifact.
Prepare(ctx context.Context, request PrepareRequest) (*PreparedArtifact, error)
}
Producer turns a source into a sealed Record plus staged blobs. Producers walk sources with lstat, never follow links outside the source, and never mutate the user's source tree. The caller owns the returned PreparedArtifact and must Close it.
type ProducerRegistry ¶
type ProducerRegistry struct {
// contains filtered or unexported fields
}
ProducerRegistry maps artifact kinds to the Producer that prepares them. The generic files producer is registered by a composition root; kind-specific producers (scaffold, component, and so on) register the same way and add their own validation and exclusions.
func NewProducerRegistry ¶
func NewProducerRegistry() *ProducerRegistry
NewProducerRegistry returns an empty registry.
func (*ProducerRegistry) Kinds ¶
func (r *ProducerRegistry) Kinds() []string
Kinds returns the registered kinds, sorted.
func (*ProducerRegistry) Lookup ¶
func (r *ProducerRegistry) Lookup(kind string) (Producer, bool)
Lookup returns the producer for kind; an empty kind means KindFiles.
func (*ProducerRegistry) Register ¶
func (r *ProducerRegistry) Register(producer Producer) error
Register adds a producer under its Kind. A duplicate kind or an invalid kind is an error.
type Provenance ¶
type Provenance struct {
// CI describes the CI run that produced the artifact.
CI *CIProvenance `json:"ci,omitempty"`
// Source describes the source tree the artifact was built from.
Source *SourceProvenance `json:"source,omitempty"`
}
Provenance carries optional CI and source context captured at publication time.
type PublishOptions ¶
type PublishOptions struct {
// ExpectedPrior is the current reference the service observed under the writer guard; nil
// means the reference must not exist. Repositories use it for conditional updates.
ExpectedPrior *PinnedReference
// Force permits replacing a conflicting reference. It has already been checked by the service.
Force bool
// Lock is the writer lock already held by the service; nil if the repository locks internally.
Lock LockHandle
}
PublishOptions control one repository publication.
type PublishRequest ¶
type PublishRequest struct {
// Execution carries the wrapper-owned operation identity and retry budget.
Execution Execution
// Repository is the required configured repository alias.
Repository string
// Source is the local source file or directory.
Source string
// Name is the explicit artifact name. Precedence: explicit, producer metadata, source basename.
Name string
// Version is the explicit version. Precedence: explicit, producer metadata; otherwise fail.
Version string
// Kind is the artifact kind; empty means [KindFiles].
Kind string
// Metadata is the explicit user metadata (description and labels).
Metadata Metadata
// Readme overrides the README source path, relative to the source directory.
Readme string
// Changelog overrides the CHANGELOG source path, relative to the source directory.
Changelog string
// Force permits replacing an existing different artifact where the repository allows it.
Force bool
// DryRun validates and plans without writing.
DryRun bool
}
PublishRequest publishes a local source to one repository.
type PublishResult ¶
type PublishResult struct {
// Outcome is created, unchanged, or replaced.
Outcome Outcome
// Pinned is the immutable reference of the published artifact.
Pinned PinnedReference
// Representation describes the stored form.
Representation Representation
// Location is the primary resolved location.
Location string
// Aliases lists additional locations or tags resolving to the same content.
Aliases []string
// LockScope is the actual lock scope that coordinated the write.
LockScope LockScope
}
PublishResult is the outcome of a repository publication.
type PullRequest ¶
type PullRequest struct {
// Execution carries the wrapper-owned operation identity and retry budget.
Execution Execution
// Repository is the required configured repository alias.
Repository string
// Ref selects the artifact.
Ref Ref
// Destination is the output directory.
Destination string
// Force permits overwriting existing destination content.
Force bool
}
PullRequest materializes an artifact into a local directory.
type Record ¶
type Record struct {
// SchemaVersion is always [SchemaVersion] (1).
SchemaVersion int `json:"schema_version"`
// Name is the artifact name, e.g. "components/terraform/vpc".
Name string `json:"name"`
// Version is the explicit version label.
Version string `json:"version"`
// Kind is the artifact kind, e.g. "files" or "component/terraform".
Kind string `json:"kind"`
// CreatedAt is the creation time, captured once per publication in UTC.
CreatedAt Timestamp `json:"created_at"`
// Metadata is the user-visible description, labels, and optional provenance.
Metadata Metadata `json:"metadata"`
// Inventory lists every payload entry, sorted by path in the canonical form.
Inventory []Entry `json:"inventory"`
// Documents lists the README and CHANGELOG descriptors, sorted by role in the canonical form.
Documents []Document `json:"documents"`
// ContentDigest is the SHA-256 of the canonical inventory and document descriptors.
ContentDigest digest.Digest `json:"content_digest"`
// KindData is optional kind-specific data. It is held as canonical JSON; see [KindData].
KindData KindData `json:"kind_data,omitempty"`
}
Record is the portable, canonical description of one published artifact. It is independent of the repository alias, credentials, resolved storage paths, upload duration, and archive or OCI envelope digests; those belong to Representation and OperationResult.
A Record never contains its own hash. Serialize it with Record.Canonical; the struct's field order below is the canonical field order and is frozen by test vectors.
func DecodeRecord ¶
DecodeRecord strictly parses canonical Record bytes. It rejects oversize input, unknown fields, invalid records, and any bytes that are not exactly the canonical serialization of the decoded Record, so the record digest of the stored bytes is always the digest of the decoded value.
func ReadRecord ¶
ReadRecord reads and strictly decodes a Record from r, buffering at most MaxRecordSize bytes. It returns the canonical bytes alongside the Record so callers can compute the record digest of exactly what was stored.
func (*Record) Canonical ¶
Canonical returns the canonical Record bytes: sorted keys and arrays, UTF-8, integer sizes and modes, UTC RFC3339 seconds, no insignificant whitespace, and no trailing newline. The same bytes are stored as the OCI config blob and in local and S3 record files. The Record is validated first, and records larger than MaxRecordSize are rejected.
func (*Record) Clone ¶
Clone returns a Record that shares no maps, slices, or pointers with r, so a caller can keep either copy and edit the other without changing the first.
func (*Record) IntentDigest ¶
IntentDigest returns the intent_digest: the SHA-256 of the canonical JSON object holding name, version, kind, content_digest, the effective user metadata (description and labels), and the kind data. It excludes created_at and generated provenance so that a retry of the same intent yields the same digest and a no-op can be detected.
func (*Record) RecordDigest ¶
RecordDigest returns the SHA-256 of the full canonical Record bytes, including created_at.
type Ref ¶
type Ref struct {
// Name is the slash-separated relative artifact name, e.g. "components/terraform/vpc".
Name string `json:"name"`
// Version is the explicit version label. Mutually exclusive with Digest.
Version string `json:"version,omitempty"`
// Digest is an immutable record or manifest digest. Mutually exclusive with Version.
Digest digest.Digest `json:"digest,omitempty"`
}
Ref addresses an artifact by name and exactly one of version or digest. The repository alias is a separate request field and never part of a Ref.
The textual forms are "name:version" and "name@sha256:<hex>". There is no implicit "latest".
type Repository ¶
type Repository interface {
LockProvider
// Capabilities describes the repository without network access.
Capabilities() Capabilities
// Resolve resolves a reference once and returns a pinned handle used for all subsequent reads.
Resolve(ctx context.Context, ref Ref) (PinnedReference, error)
// Inspect returns the metadata view of a pinned artifact without downloading the payload.
Inspect(ctx context.Context, pinned PinnedReference) (*Inspection, error)
// OpenDocument opens one document without downloading the payload. A missing optional
// document returns an error wrapping ErrArtifactDocumentMissing.
OpenDocument(ctx context.Context, pinned PinnedReference, role DocumentRole) (*DocumentStream, error)
// Read returns verified, closeable content streams or an OCI graph source for a pinned artifact.
Read(ctx context.Context, pinned PinnedReference) (*Content, error)
// Publish stores a prepared artifact. The expected prior reference and force policy have already
// been checked by the service under the writer guard.
Publish(ctx context.Context, prepared *PreparedArtifact, options PublishOptions) (*PublishResult, error)
// List returns one page of managed references. Pagination is consumed by the service.
List(ctx context.Context, query ListQuery) (*ListPage, error)
// Delete removes a pinned artifact within an explicit scope after checking the expected current reference.
Delete(ctx context.Context, pinned PinnedReference, options DeleteOptions) (*DeleteResult, error)
// Pin resolves a reference into an immutable PinnedReference suitable for consumer lockfiles.
// It acquires no write lock and is not a substitute for signature verification.
Pin(ctx context.Context, ref Ref) (PinnedReference, error)
// Sign asks signer to sign the subject and stores the returned evidence, returning its descriptors.
Sign(ctx context.Context, subject SignatureSubject, signer Signer, options SignOptions) ([]SignatureEvidence, error)
// Verify authenticates stored evidence against policy. It never trusts metadata claims, catalog
// entries, labels, or cached "verified" booleans.
Verify(ctx context.Context, subject SignatureSubject, policy VerificationPolicy) (*VerificationResult, error)
}
Repository is the storage contract implemented by every backend (local directory, local archive, S3, OCI layout, OCI registry). Repositories own storage mechanics and capabilities; the service owns name and version selection, producer preparation, metadata, digest pinning, conflict policy, retries, and result aggregation. Signatures, verification, pinning, and locks are repository contracts for every backend, never OCI-only service branches.
An unavailable capability returns a *CapabilityError, never a successful no-op. Backend errors are wrapped in the common sentinels (errors/errors.go) while retaining their causes.
func NewRepository ¶
func NewRepository(ctx context.Context, alias string, cfg *schema.ArtifactRepositoryConfig, opts ...RepositoryOption) (Repository, error)
NewRepository constructs a repository from the process-wide registry.
type RepositoryFactory ¶
type RepositoryFactory func(ctx context.Context, alias string, cfg *schema.ArtifactRepositoryConfig, opts ...RepositoryOption) (Repository, error)
RepositoryFactory constructs a repository. It validates nothing the registry has not already validated, must not touch the network, resolve credentials, or create directories, and returns a repository whose Capabilities() is available immediately.
type RepositoryListing ¶
type RepositoryListing struct {
// Repository is the configured repository alias.
Repository string `json:"repository"`
// Count is the number of entries returned from the repository.
Count int `json:"count"`
// Source says where the entries came from: "live" (read from the repository), "cache" (a
// discovery snapshot), or "catalog" (the repository's configured catalog).
Source string `json:"source,omitempty"`
// FetchedAt is when a cached or catalog snapshot was fetched, in RFC 3339 UTC.
FetchedAt string `json:"fetched_at,omitempty"`
// Diagnostics explain capability or refresh problems.
Diagnostics []Diagnostic `json:"diagnostics,omitempty"`
}
RepositoryListing reports the outcome of listing one repository, so a failing or incapable repository is explained rather than silently omitted.
type RepositoryLookup ¶
type RepositoryLookup func(alias string) (Repository, error)
RepositoryLookup returns another configured repository by alias, used for delegated locking.
type RepositoryOption ¶
type RepositoryOption func(*RepositoryOptions)
RepositoryOption configures construction of a repository.
func WithIdentityResolver ¶
func WithIdentityResolver(resolver IdentityResolver) RepositoryOption
WithIdentityResolver supplies the lazy identity resolver.
func WithRepositoryLookup ¶
func WithRepositoryLookup(lookup RepositoryLookup) RepositoryOption
WithRepositoryLookup supplies the lookup used to find delegated repositories.
type RepositoryOptions ¶
type RepositoryOptions struct {
// ResolveIdentity lazily resolves the repository's identity. It may be nil.
ResolveIdentity IdentityResolver
// LookupRepository finds another configured repository (for example a lock delegate). It may be nil.
LookupRepository RepositoryLookup
}
RepositoryOptions are the construction options a factory receives.
func ApplyRepositoryOptions ¶
func ApplyRepositoryOptions(opts ...RepositoryOption) RepositoryOptions
ApplyRepositoryOptions folds construction options into a RepositoryOptions value for factories.
type RepositoryRegistry ¶
type RepositoryRegistry struct {
// contains filtered or unexported fields
}
RepositoryRegistry maps repository kinds to descriptors and factories. There is no central backend switch: backend packages register their own kind from a composition root. It is safe for concurrent use.
func DefaultRepositoryRegistry ¶
func DefaultRepositoryRegistry() *RepositoryRegistry
DefaultRepositoryRegistry returns the process-wide registry.
func NewRepositoryRegistry ¶
func NewRepositoryRegistry() *RepositoryRegistry
NewRepositoryRegistry returns an empty registry.
func (*RepositoryRegistry) IsRegistered ¶
func (r *RepositoryRegistry) IsRegistered(kind string) bool
IsRegistered reports whether a backend registered a factory for the kind.
func (*RepositoryRegistry) Kinds ¶
func (r *RepositoryRegistry) Kinds() []string
Kinds returns the sorted names of every known kind: the registered ones plus the built-in V1 set.
func (*RepositoryRegistry) Lookup ¶
func (r *RepositoryRegistry) Lookup(kind string) (*KindDescriptor, bool)
Lookup returns the descriptor of a kind: the registered descriptor when a backend registered the kind, otherwise the built-in V1 descriptor. The boolean is false for an unknown kind.
func (*RepositoryRegistry) New ¶
func (r *RepositoryRegistry) New(ctx context.Context, alias string, cfg *schema.ArtifactRepositoryConfig, opts ...RepositoryOption) (Repository, error)
New validates the repository configuration against its kind and constructs the repository through the registered factory. An unknown kind is a configuration error; a known V1 kind whose backend is not registered in this build is an unsupported-capability error.
func (*RepositoryRegistry) Register ¶
func (r *RepositoryRegistry) Register(desc *KindDescriptor, factory RepositoryFactory) error
Register adds a kind. It rejects an empty kind, a nil factory, and a kind that is already registered.
func (*RepositoryRegistry) Reset ¶
func (r *RepositoryRegistry) Reset()
Reset removes every registered kind. It exists for tests that register fake backends.
type Representation ¶
type Representation struct {
// Packaging is the payload packaging mode.
Packaging Packaging `json:"packaging"`
// Payload lists the payload blob descriptors (archive, per-file objects, or image layers).
Payload []ocispec.Descriptor `json:"payload,omitempty"`
// Documents lists the README and CHANGELOG blob descriptors stored alongside the payload.
Documents []ocispec.Descriptor `json:"documents,omitempty"`
// Locator is the backend-specific location (path, object key, or registry reference).
Locator string `json:"locator"`
// RecordDigest is the digest of the canonical Record bytes this representation belongs to.
RecordDigest digest.Digest `json:"record_digest"`
// RepresentationDigest is the checksum of an archive or other transferred payload representation.
RepresentationDigest digest.Digest `json:"representation_digest,omitempty"`
// OriginalRoot is the original OCI manifest or index descriptor when a native graph is carried.
OriginalRoot *ocispec.Descriptor `json:"original_root,omitempty"`
}
Representation describes how one Record is physically stored by a repository. It is mutable storage metadata and is never part of the Record bytes.
type S3Options ¶
type S3Options struct {
// Bucket is the S3 bucket name.
Bucket string `mapstructure:"bucket"`
// Prefix is the collection root below the bucket.
Prefix string `mapstructure:"prefix"`
// Region is the bucket region.
Region string `mapstructure:"region"`
// Tags are S3 object tags applied to every object of a publication. They are not artifact labels.
Tags map[string]string `mapstructure:"tags"`
// KeyPattern overrides the object key below the prefix.
KeyPattern string `mapstructure:"key_pattern"`
// Endpoint overrides the S3 endpoint URL, for example an S3-compatible emulator such as Floci.
// It never carries credentials; those come from the repository identity.
Endpoint string `mapstructure:"endpoint"`
// PathStyle forces path-style (true) or virtual-hosted-style (false) addressing. Nil keeps the
// default: path-style whenever an endpoint override applies, virtual-hosted otherwise.
PathStyle *bool `mapstructure:"path_style"`
}
S3Options are the options of an aws/s3 repository.
func (*S3Options) ValidateForPackaging ¶
ValidateForPackaging implements PackagingValidator.
type SearchRequest ¶
type SearchRequest struct {
// Repositories restricts the search; empty means all configured repositories.
Repositories []string
// Query is the search text matched against names, kinds, descriptions, and labels.
Query string
// Labels keep only entries whose labels match every selector exactly.
Labels []Label
// Refresh bypasses cached discovery snapshots.
Refresh bool
}
SearchRequest searches artifacts by text.
type Service ¶
type Service interface {
// Publish prepares the source and stores it in one repository.
Publish(ctx context.Context, request PublishRequest) (*OperationResult, error)
// Pull materializes an artifact into a local directory after verifying every consumed descriptor.
Pull(ctx context.Context, request PullRequest) (*OperationResult, error)
// Copy transfers an artifact between repositories, evaluating both source and destination policy.
Copy(ctx context.Context, request CopyRequest) (*OperationResult, error)
// Inspect returns the metadata view without downloading the payload.
Inspect(ctx context.Context, request InspectRequest) (*InspectResult, error)
// List enumerates artifacts across the selected repositories.
List(ctx context.Context, request ListRequest) (*ListResult, error)
// Search filters enumerated artifacts by text.
Search(ctx context.Context, request SearchRequest) (*ListResult, error)
// Delete removes an artifact within the repository's declared delete capability.
Delete(ctx context.Context, request DeleteRequest) (*OperationResult, error)
// ShowDocument reads one README or CHANGELOG without downloading the payload.
ShowDocument(ctx context.Context, request ShowDocumentRequest) (*DocumentResult, error)
// Sign adds signature evidence to a digest reference.
Sign(ctx context.Context, request SignRequest) (*SignResult, error)
// Verify requires a trusted valid signature for the artifact.
Verify(ctx context.Context, request VerifyRequest) (*VerifyResult, error)
// Pin returns an immutable reference for consumer lockfiles.
Pin(ctx context.Context, request PinRequest) (*PinResult, error)
}
Service is the repository-independent artifact API consumed by commands, steps, hooks, and CI adapters. This package defines only the interface and its request and result types; the implementation (preparation, packaging, conflict policy, retries) lives in the service package.
Every method takes a context first and a typed request struct, and returns a typed result plus an error wrapping the sentinels in errors/errors.go. Display format never changes semantics.
type ShowDocumentRequest ¶
type ShowDocumentRequest struct {
// Execution carries the wrapper-owned operation identity and retry budget.
Execution Execution
// Repository is the required configured repository alias.
Repository string
// Ref selects the artifact.
Ref Ref
// Role is readme or changelog.
Role DocumentRole
}
ShowDocumentRequest reads one package document.
type SignOptions ¶
type SignOptions struct {
// OperationID is the logical operation identifier.
OperationID string
// Lock is the writer lock already held by the service.
Lock LockHandle
}
SignOptions control evidence storage.
type SignRequest ¶
type SignRequest struct {
// Execution carries the wrapper-owned operation identity and retry budget.
Execution Execution
// Repository is the required configured repository alias.
Repository string
// Ref must be a digest reference; sign accepts digest references only.
Ref Ref
}
SignRequest adds signature evidence to an immutable subject.
type SignResult ¶
type SignResult struct {
// Operation is the typed operation result.
Operation OperationResult `json:"operation"`
// Subject is the signed subject.
Subject SignatureSubject `json:"subject"`
// Evidence lists the stored evidence descriptors.
Evidence []SignatureEvidence `json:"evidence"`
}
SignResult is the result of Service.Sign.
type SignatureEvidence ¶
type SignatureEvidence struct {
// Subject is the subject the evidence claims to cover.
Subject SignatureSubject `json:"subject"`
// Format is the evidence encoding.
Format EvidenceFormat `json:"format"`
// Descriptor identifies the evidence blob (media type, digest, size).
Descriptor ocispec.Descriptor `json:"descriptor"`
// Locator is the backend-specific storage location, for example
// ".atmos-artifacts/v1/signatures/<subject-kind>/<subject-digest>/<evidence-digest>.json".
Locator string `json:"locator,omitempty"`
}
SignatureEvidence locates stored evidence for a subject. It is untrusted until verified.
type SignatureSubject ¶
type SignatureSubject struct {
// Kind is record or oci-root.
Kind SubjectKind `json:"kind"`
// Digest is the immutable subject digest (record digest or OCI root digest).
Digest digest.Digest `json:"digest"`
// MediaType is the subject media type.
MediaType string `json:"media_type"`
// Size is the subject size in bytes.
Size int64 `json:"size"`
}
SignatureSubject is the immutable thing a signature covers.
func (SignatureSubject) Validate ¶
func (s SignatureSubject) Validate() error
Validate checks the subject is well formed.
type Signer ¶
type Signer interface {
// Formats lists the evidence formats the signer can produce.
Formats() []EvidenceFormat
// Sign signs the immutable subject and returns evidence for the repository to store.
Sign(ctx context.Context, subject SignatureSubject) (*EvidencePayload, error)
}
Signer produces signature evidence for a subject. V1 reuses the managed Cosign authoring path behind this interface; registry authentication stays separate from signing identity, and no custom cryptography is implemented.
type SignerClaim ¶
type SignerClaim struct {
// Identity is the certificate identity (SAN) for keyless signing; empty for key signing.
Identity string `json:"identity,omitempty"`
// Issuer is the OIDC issuer for keyless signing; empty for key signing.
Issuer string `json:"issuer,omitempty"`
// KeyID is the fingerprint of the trusted public key for key-based signing.
KeyID string `json:"key_id,omitempty"`
}
SignerClaim is an authenticated signer identity extracted by a verifier. Metadata claims, labels, catalog entries, and cached booleans never produce claims.
type SourceProvenance ¶
type SourceProvenance struct {
// Repository is the source repository identifier or URL (without credentials).
Repository string `json:"repository,omitempty"`
// Commit is the source commit SHA.
Commit string `json:"commit,omitempty"`
// Ref is the branch or tag name.
Ref string `json:"ref,omitempty"`
}
SourceProvenance identifies the source revision an artifact was built from.
type StagedBlob ¶
type StagedBlob struct {
// Descriptor identifies the blob by media type, digest, and size.
Descriptor ocispec.Descriptor
// Role is payload or document.
Role BlobRole
// DocumentRole is the document role when Role is [BlobDocument].
DocumentRole DocumentRole
// Path is the inventory path for per-file payloads; empty for archives.
Path string
// Open returns a new reader positioned at the start of the blob. The caller closes it.
Open func(ctx context.Context) (io.ReadCloser, error)
}
StagedBlob is one blob ready to be uploaded. Open returns a fresh reader each time, so a retry within one invocation reuses the same prepared content.
type SubjectKind ¶
type SubjectKind string
SubjectKind identifies what a signature is bound to.
const ( // SubjectRecord is the canonical portable Record of an Atmos file package. Evidence survives // representation changes because the Record binds name, version, metadata, inventory, // content_digest, and document digests. SubjectRecord SubjectKind = "record" // SubjectOCIRoot is the original OCI manifest or index digest of a foreign image or an // existing plugin. It is never rewritten on copy and never replaced by an archive checksum. SubjectOCIRoot SubjectKind = "oci-root" )
Signature subject kinds.
type Timestamp ¶
Timestamp is an instant serialized as a UTC RFC3339 string with second precision. Sub-second precision is discarded on serialization so that an in-memory value and the value decoded from its canonical bytes always produce identical digests.
func NewTimestamp ¶
NewTimestamp converts t to a Timestamp normalized to UTC and truncated to whole seconds.
func (Timestamp) MarshalJSON ¶
MarshalJSON implements json.Marshaler using the canonical layout.
func (*Timestamp) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler. Only the canonical layout is accepted.
type TrustSet ¶
type TrustSet struct {
// Identities are trusted certificate identities.
Identities []TrustedIdentity `json:"identities,omitempty"`
// Keys are operator-managed public-key file paths.
Keys []string `json:"keys,omitempty"`
}
TrustSet is one set of acceptable signers. Within a trust set any one signer satisfies it.
type TrustedIdentity ¶
type TrustedIdentity struct {
// Identity is the expected certificate identity.
Identity string `json:"identity"`
// Issuer is the expected OIDC issuer.
Issuer string `json:"issuer"`
}
TrustedIdentity is a certificate identity and issuer pair that may satisfy a trust set.
type VerificationPolicy ¶
type VerificationPolicy struct {
// RequireSignature makes a missing or invalid signature a failure.
RequireSignature bool `json:"require_signature"`
// TrustSets are the sets that must each be satisfied by at least one valid permitted signature.
TrustSets []TrustSet `json:"trust_sets,omitempty"`
// Offline forbids network access; only preserved evidence and provisioned trust material are used.
Offline bool `json:"offline"`
}
VerificationPolicy is the effective policy passed to Verify. When a global and a repository trust restriction both exist, the policy lists both TrustSets and every one must be satisfied; they are never unioned into a weaker policy.
func (*VerificationPolicy) Clone ¶
func (p *VerificationPolicy) Clone() VerificationPolicy
Clone returns a VerificationPolicy that shares no slice with p, so editing the trust sets of a description handed to a caller never reaches the configured policy.
func (VerificationPolicy) Fingerprint ¶
func (p VerificationPolicy) Fingerprint() (string, error)
Fingerprint returns a stable SHA-256 fingerprint of the policy, independent of the order of trust sets, identities, and keys, for recording in verification results.
func (VerificationPolicy) HasTrustConstraints ¶
func (p VerificationPolicy) HasTrustConstraints() bool
HasTrustConstraints reports whether the policy supplies any trust material. Without it a verifier reports unchecked rather than verified.
type VerificationResult ¶
type VerificationResult struct {
// Subject is the verified subject.
Subject SignatureSubject `json:"subject"`
// PolicyFingerprint is [VerificationPolicy.Fingerprint] of the policy that was applied.
PolicyFingerprint string `json:"policy_fingerprint,omitempty"`
// Claims are the verified signer claims.
Claims []SignerClaim `json:"claims,omitempty"`
// EvidenceDigests lists the digests of the evidence blobs that were considered.
EvidenceDigests []digest.Digest `json:"evidence_digests,omitempty"`
// Status is verified, unchecked, or failed.
Status VerificationStatus `json:"status"`
// Diagnostics describes the failure reason and any bounded malformed or unsupported evidence.
Diagnostics []Diagnostic `json:"diagnostics,omitempty"`
}
VerificationResult is the authenticated result of verifying a subject against a policy.
type VerificationStatus ¶
type VerificationStatus string
VerificationStatus is the outcome of a verification.
const ( // VerificationVerified means a valid permitted signature satisfied every required trust set. VerificationVerified VerificationStatus = "verified" // VerificationUnchecked means no trust configuration was supplied, so nothing was claimed. VerificationUnchecked VerificationStatus = "unchecked" // VerificationFailed means required verification did not succeed. VerificationFailed VerificationStatus = "failed" )
Verification statuses.
type Verifier ¶
type Verifier interface {
// Formats lists the evidence formats the verifier understands. Required evidence in any other
// format fails closed.
Formats() []EvidenceFormat
// Verify checks subject binding, cryptographic validity, signer or key trust, and the
// applicable log, certificate, and signing-time proofs. At least one valid permitted signature
// must satisfy each required trust set; unrelated invalid attachments cannot override valid
// matching evidence. A public-key signature never satisfies an identity/issuer requirement.
Verify(ctx context.Context, subject SignatureSubject, evidence []EvidenceBlob, policy VerificationPolicy) (*VerificationResult, error)
}
Verifier authenticates stored evidence against a policy. Repository adapters fetch evidence and invoke a Verifier; they may register additional native formats with the same result contract.
type VerifyRequest ¶
type VerifyRequest struct {
// Execution carries the wrapper-owned operation identity and retry budget.
Execution Execution
// Repository is the required configured repository alias.
Repository string
// Ref selects the artifact.
Ref Ref
}
VerifyRequest verifies an artifact's signature evidence against the effective policy.
type VerifyResult ¶
type VerifyResult struct {
// Operation is the typed operation result.
Operation OperationResult `json:"operation"`
// Verification is the authenticated verification result.
Verification VerificationResult `json:"verification"`
}
VerifyResult is the result of Service.Verify.
Source Files
¶
- canonical.go
- canonicaljson.go
- capabilities.go
- clone.go
- constants.go
- copier.go
- digest.go
- doc.go
- entry.go
- entry_symlink.go
- errors.go
- evidence.go
- execution.go
- kinddata.go
- kinds.go
- labels.go
- lock.go
- lockprovider.go
- mock_copier.go
- mock_evidence.go
- mock_lockprovider.go
- mock_producer.go
- mock_repository.go
- mock_service.go
- mock_signer.go
- mock_verifier.go
- operation.go
- options.go
- packaging.go
- permissions.go
- pinned.go
- policy.go
- prepared.go
- producer.go
- producers.go
- record.go
- redact.go
- redact_grammar.go
- redact_scrub.go
- ref.go
- registry.go
- repository.go
- repository_types.go
- representation.go
- requests.go
- results.go
- service.go
- signature.go
- signer.go
- timestamp.go
- verifier.go
Directories
¶
| Path | Synopsis |
|---|---|
|
Package artifacttest provides test support for artifact repositories and the artifact service: a minimal in-memory Repository that implements the full artifact.Repository contract with failure injection, a fake signer and evidence format, and RunRepositoryConformance, the shared conformance suite every backend (local directory, local archive, S3, OCI layout, OCI registry) runs against its own implementation.
|
Package artifacttest provides test support for artifact repositories and the artifact service: a minimal in-memory Repository that implements the full artifact.Repository contract with failure injection, a fake signer and evidence format, and RunRepositoryConformance, the shared conformance suite every backend (local directory, local archive, S3, OCI layout, OCI registry) runs against its own implementation. |
|
Package blob is the transport-only object I/O layer shared by artifact repositories and the legacy CI artifact adapters.
|
Package blob is the transport-only object I/O layer shared by artifact repositories and the legacy CI artifact adapters. |
|
blobtest
Package blobtest is the shared conformance suite for blob.Store implementations.
|
Package blobtest is the shared conformance suite for blob.Store implementations. |
|
local
Package local is the filesystem implementation of blob.Store.
|
Package local is the filesystem implementation of blob.Store. |
|
s3
Package s3 is the AWS SDK v2 implementation of blob.Store, plus the shared S3 client construction used by the legacy CI artifact adapter.
|
Package s3 is the AWS SDK v2 implementation of blob.Store, plus the shared S3 client construction used by the legacy CI artifact adapter. |
|
s3/s3test
Package s3test is an in-process, S3-compatible HTTP server for tests.
|
Package s3test is an in-process, S3-compatible HTTP server for tests. |
|
Package compat holds test-only compatibility fixtures that freeze the byte-level behavior of the existing CI planfile archive format and the existing plugin OCI release format before the artifact implementation replaces any of their code paths.
|
Package compat holds test-only compatibility fixtures that freeze the byte-level behavior of the existing CI planfile archive format and the existing plugin OCI release format before the artifact implementation replaces any of their code paths. |
|
Package compose is the composition root of the artifact subsystem.
|
Package compose is the composition root of the artifact subsystem. |
|
Package config decodes, validates, and interprets the `artifacts` section of atmos.yaml.
|
Package config decodes, validates, and interprets the `artifacts` section of atmos.yaml. |
|
Package discovery serves artifact List and Search from a source-scoped discovery cache and optional catalogs, without ever downloading a payload.
|
Package discovery serves artifact List and Search from a source-scoped discovery cache and optional catalogs, without ever downloading a payload. |
|
cache
Package cache provides neutral, source-scoped discovery snapshots shared by plugin discovery and artifact discovery.
|
Package cache provides neutral, source-scoped discovery snapshots shared by plugin discovery and artifact discovery. |
|
catalog
Package catalog maintains optional artifact catalogs: discovery snapshots published as generic artifact Records of kind "catalog" (artifact type application/vnd.atmos.artifact.catalog.v1) with one direct JSON payload layer (application/vnd.atmos.artifact.catalog.v1+json).
|
Package catalog maintains optional artifact catalogs: discovery snapshots published as generic artifact Records of kind "catalog" (artifact type application/vnd.atmos.artifact.catalog.v1) with one direct JSON payload layer (application/vnd.atmos.artifact.catalog.v1+json). |
|
internal/testkit
Package testkit provides in-process registries and publication helpers for discovery and catalog tests: an OCI registry that counts every request, repositories bound to it, and a deterministic way to publish small packages.
|
Package testkit provides in-process registries and publication helpers for discovery and catalog tests: an OCI registry that counts every request, repositories bound to it, and a deterministic way to publish small packages. |
|
Package fixtures builds the artifact test fixtures described by the artifact validation plan ("File package" and "Invalid package") with Go code inside a caller-supplied temporary directory.
|
Package fixtures builds the artifact test fixtures described by the artifact validation plan ("File package" and "Invalid package") with Go code inside a caller-supplied temporary directory. |
|
Package invoke is the transport-neutral request and result mapping of the artifact operations.
|
Package invoke is the transport-neutral request and result mapping of the artifact operations. |
|
Package layout defines the backend-neutral record layout shared by the local directory, local archive, and S3 artifact repositories.
|
Package layout defines the backend-neutral record layout shared by the local directory, local archive, and S3 artifact repositories. |
|
Package linkpath resolves symlink chains physically so containment checks can see where a link really points, including links whose final components do not exist yet.
|
Package linkpath resolves symlink chains physically so containment checks can see where a link really points, including links whose final components do not exist yet. |
|
Package local implements the local directory (local/dir) and local archive (local/archive) artifact repositories behind artifact.Repository.
|
Package local implements the local directory (local/dir) and local archive (local/archive) artifact repositories behind artifact.Repository. |
|
Package materialize extracts verified artifact content into a local directory.
|
Package materialize extracts verified artifact content into a local directory. |
|
Package oci implements the oci/registry and oci/layout artifact repositories on the pkg/oci transport boundary.
|
Package oci implements the oci/registry and oci/layout artifact repositories on the pkg/oci transport boundary. |
|
Package produce implements the generic "files" artifact producer and the seams that kind-specific producers (scaffold, component, and so on) reuse.
|
Package produce implements the generic "files" artifact producer and the seams that kind-specific producers (scaffold, component, and so on) reuse. |
|
Package redacttest holds the credential-bearing inputs that every URL redaction helper must handle.
|
Package redacttest holds the credential-bearing inputs that every URL redaction helper must handle. |
|
Package report renders the results of artifact operations as CI job summaries and CI output variables.
|
Package report renders the results of artifact operations as CI job summaries and CI output variables. |
|
Package roundtriptest publishes artifacts to an in-process OCI registry so that tests of the existing consumers (component source provisioning, scaffold generation, and vendoring) can prove a published package works through them.
|
Package roundtriptest publishes artifacts to an in-process OCI registry so that tests of the existing consumers (component source provisioning, scaffold generation, and vendoring) can prove a published package works through them. |
|
Package s3 implements the aws/s3 artifact repository behind artifact.Repository.
|
Package s3 implements the aws/s3 artifact repository behind artifact.Repository. |
|
Package scaffold validates scaffold sources for publication.
|
Package scaffold validates scaffold sources for publication. |
|
Package service implements artifact.Service: the repository-independent orchestration of publish, pull, copy, inspect, list, search, delete, document reads, sign, verify, and pin over artifact.Repository implementations.
|
Package service implements artifact.Service: the repository-independent orchestration of publish, pull, copy, inspect, list, search, delete, document reads, sign, verify, and pin over artifact.Repository implementations. |
|
Package sigstore provides the ready-to-use artifact.Signer and artifact.Verifier for Sigstore bundle evidence.
|
Package sigstore provides the ready-to-use artifact.Signer and artifact.Verifier for Sigstore bundle evidence. |
|
Package snapshot captures a local source file or directory into bounded disk staging and produces a canonical inventory of it.
|
Package snapshot captures a local source file or directory into bounded disk staging and produces a canonical inventory of it. |