Documentation
¶
Overview ¶
Package compose is the composition root of the artifact subsystem. It wires the five repository kinds (local/dir, local/archive, aws/s3, oci/registry, oci/layout), one shared signature verifier, the signer, the plugin-release immutability policy, the Atmos auth identity resolver, the OCI registry transport, and the lock-delegation repository lookup into an artifact.Service built from the `artifacts` section of the Atmos configuration.
Nothing here runs at import time and nothing is eager: building a Composition validates the configuration (no network, no credentials, no directory creation) and returns. Repositories are constructed when an operation opens them, and identities are resolved only when a backend first needs credentials, so describing configuration, dry runs, and validation never authenticate.
The package imports no CLI, runner, hook, plugin, or CI packages. Dependencies that live there, such as the managed Cosign signer and the plugin-aware registry authentication preparation, are injected by the caller with WithBlobSigner and WithRegistryPreparation.
Index ¶
- func NewIdentityResolver(config *schema.AtmosConfiguration) artifact.IdentityResolver
- func NewTransportFactory(config *schema.AtmosConfiguration, preparation registryauth.Preparation) artifactoci.TransportFactory
- type Composition
- type Option
- func WithBlobSigner(blob signature.BlobSigner) Option
- func WithCatalogOptions(opts ...catalog.Option) Option
- func WithDiscoveryOptions(opts ...discovery.Option) Option
- func WithIdentityResolver(resolver artifact.IdentityResolver) Option
- func WithImmutabilityPolicy(policy service.ImmutabilityPolicy) Option
- func WithLocalOptions(opts ...local.Option) Option
- func WithOCIOptions(opts ...oci.Option) Option
- func WithProducers(producers *artifact.ProducerRegistry) Option
- func WithRegistry(registry *artifact.RepositoryRegistry) Option
- func WithRegistryPreparation(preparation registryauth.Preparation) Option
- func WithS3Options(opts ...s3.Option) Option
- func WithServiceOptions(opts ...service.Option) Option
- func WithSigner(signer artifact.Signer) Option
- func WithTransportFactory(factory oci.TransportFactory) Option
- func WithVerifier(verifier artifact.Verifier) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewIdentityResolver ¶
func NewIdentityResolver(config *schema.AtmosConfiguration) artifact.IdentityResolver
NewIdentityResolver returns the default lazy resolver: it does nothing until a backend asks for credentials, then authenticates the named Atmos identity on an isolated manager and returns the credential type of the identity's cloud (AWS, Azure, or GCP). Repository options never carry credentials, and an identity that resolves to no usable credentials fails closed.
func NewTransportFactory ¶
func NewTransportFactory(config *schema.AtmosConfiguration, preparation registryauth.Preparation) artifactoci.TransportFactory
NewTransportFactory returns the default OCI registry transport factory. It builds the same client the plugin installer uses: Docker and GHCR credentials with the shared Atmos keyring as a fallback, and, when the repository configures an `identity`, that Atmos auth identity bound to the repository's exact registry host. A configured identity never falls through to ambient credentials, and its credentials are never presented to another registry. Constructing the client authenticates nothing; the identity authenticates on the first registry request. The preparation, when non-nil, lets an identity provided by an installed auth plugin authenticate. For an identity-bound registry, an injected cloud IdentityResolver is rejected; use a custom transport factory to define how that resolver supplies registry credentials.
Types ¶
type Composition ¶
type Composition struct {
// Service is the repository-independent artifact API.
Service artifact.Service
// Repositories resolves configured aliases. Describing an alias never authenticates; opening
// one constructs it, and its identity is resolved only when an operation needs credentials.
Repositories *service.ConfigRepositories
// Registry holds the registered repository kinds.
Registry *artifact.RepositoryRegistry
// Catalogs builds and maintains the optional catalog of a configured repository. It reads
// artifact metadata only and never publishes, signs, or deletes an artifact.
Catalogs *catalog.Service
}
Composition is the wired artifact subsystem for one configuration.
func New ¶
func New(atmosConfig *schema.AtmosConfiguration, opts ...Option) (*Composition, error)
New wires the artifact service from the `artifacts` section of the configuration. It validates the configuration and registers every repository kind, but performs no network access, resolves no credentials, and creates no directories. A nil configuration is an empty one.
The same verifier instance serves every repository kind, so one trust policy governs local directories and archives, S3 buckets, and OCI registries and layouts alike. Verification policy (the global requirements and each repository's own) is combined by the service, and a repository can strengthen but never weaken the global policy.
type Option ¶
type Option func(*settings)
Option customizes a composition.
func WithBlobSigner ¶
func WithBlobSigner(blob signature.BlobSigner) Option
WithBlobSigner supplies the Cosign-style blob signer behind the Sigstore signer, typically the managed Cosign authoring path. Without a signer, sign reports an unsupported capability.
func WithCatalogOptions ¶
WithCatalogOptions passes options to the catalog service, for example a clock or lock owner.
func WithDiscoveryOptions ¶
WithDiscoveryOptions passes options to the discovery cache, for example a cache directory, a clock, or a policy.
func WithIdentityResolver ¶
func WithIdentityResolver(resolver artifact.IdentityResolver) Option
WithIdentityResolver replaces the lazy identity resolver handed to every backend. The default resolves an Atmos auth identity into the credential type its cloud backend expects. The default OCI registry transport uses registry authentication instead and rejects an injected resolver for identity-bound registries; use WithTransportFactory to implement a custom binding.
func WithImmutabilityPolicy ¶
func WithImmutabilityPolicy(policy service.ImmutabilityPolicy) Option
WithImmutabilityPolicy replaces the immutable-format admission policy. The default protects plugin releases from any generic overwrite or delete.
func WithLocalOptions ¶
WithLocalOptions passes options to the local/dir and local/archive kinds.
func WithOCIOptions ¶
WithOCIOptions passes options to the oci/registry and oci/layout kinds, for example an injected transport.
func WithProducers ¶
func WithProducers(producers *artifact.ProducerRegistry) Option
WithProducers supplies the producer registry used to prepare artifacts. The default has only the generic files producer.
func WithRegistry ¶
func WithRegistry(registry *artifact.RepositoryRegistry) Option
WithRegistry registers the repository kinds in the given registry instead of a new private one. A kind that is already registered is an error.
func WithRegistryPreparation ¶
func WithRegistryPreparation(preparation registryauth.Preparation) Option
WithRegistryPreparation supplies the plugin-aware preparation the default registry authentication runs when an identity needs an installed auth plugin.
func WithS3Options ¶
WithS3Options passes options to the aws/s3 kind, for example an injected object store.
func WithServiceOptions ¶
WithServiceOptions passes options to the artifact service, for example a clock or retry policy.
func WithSigner ¶
WithSigner replaces the signer used by sign. It takes precedence over WithBlobSigner.
func WithTransportFactory ¶
func WithTransportFactory(factory oci.TransportFactory) Option
WithTransportFactory replaces the per-repository OCI registry transport factory. The default binds a repository's identity to its registry host through the shared registry authentication.
func WithVerifier ¶
WithVerifier replaces the signature verifier shared by every repository kind. The default verifies Sigstore bundles and public-key bundles against the configured trust policy.