Documentation
¶
Overview ¶
Package config decodes, validates, and interprets the `artifacts` section of atmos.yaml.
It is separate from pkg/artifact so that the domain package stays free of configuration policy, while pkg/config (the loader) and the artifact service share one implementation of:
- strict decoding of the raw section into schema.ArtifactConfig, including rejecting unquoted numeric permissions that YAML would silently turn into the wrong octal value;
- whole-configuration validation (kinds, per-kind options, packaging, permissions, catalogs, identities, labels, verification policy, and delegated lock chains);
- the effective verification policy model, where a global requirement can be strengthened but never weakened by a repository and both trust sets must be satisfied;
- anchoring relative local paths to the configuration file that declared them.
Validation performs no network access, resolves no credentials, and creates no directories. An `identity` is only checked for shape (and, when the caller supplies a lookup, existence); it is resolved lazily by the operation that needs credentials.
Repository kinds ¶
Kind names are checked against artifact.RepositoryRegistry, which returns a registered backend's descriptor when one exists and otherwise the documented static set of V1 kinds (local/dir, local/archive, aws/s3, oci/registry, oci/layout). Validation therefore works before backend packages register, and a backend that registers a kind refines the descriptor rather than changing the accepted names.
Index ¶
- func AnchorPath(origin schema.ArtifactConfigOrigin, p string) (string, error)
- func CombinePolicy(global, repo *schema.ArtifactVerificationConfig) artifact.VerificationPolicy
- func Decode(raw map[string]any) (schema.ArtifactConfig, error)
- func EffectivePolicy(cfg *schema.ArtifactConfig, alias string) (artifact.VerificationPolicy, error)
- func NewOrigin(file string, remote bool) schema.ArtifactConfigOrigin
- func Validate(cfg *schema.ArtifactConfig, opts ...Option) error
- type LockPlan
- type Option
- type Validator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AnchorPath ¶
func AnchorPath(origin schema.ArtifactConfigOrigin, p string) (string, error)
AnchorPath returns the absolute, cleaned form of p. An absolute path is only cleaned. A relative path resolves against the directory of the configuration file that declared it, so the result does not depend on the working directory or on which file was merged last.
A relative path declared by a remote import cannot be anchored: its local copy lives in an ephemeral download directory that must never become a write root. A relative path with no known declaring file is likewise rejected. In both cases the caller must provide an absolute path or override the value in a locally declared configuration file.
func CombinePolicy ¶
func CombinePolicy(global, repo *schema.ArtifactVerificationConfig) artifact.VerificationPolicy
CombinePolicy combines a global and a repository policy level. Either may be nil.
func Decode ¶
func Decode(raw map[string]any) (schema.ArtifactConfig, error)
Decode strictly decodes a raw `artifacts` section (as parsed from YAML, with original key spelling) into the schema type. Unknown fields, mistyped values, and non-string permissions are errors, so `permissions: 0600` (which YAML reads as the integer 384) never silently becomes the wrong mode. A nil or empty section decodes to the zero value.
func EffectivePolicy ¶
func EffectivePolicy(cfg *schema.ArtifactConfig, alias string) (artifact.VerificationPolicy, error)
EffectivePolicy returns the verification policy that applies to a repository.
A global requirement can be strengthened but never weakened: RequireSignature is true when either level requires it. Within one trust set any configured signer satisfies it; when both the global and the repository define trust (identities or keys), the policy carries two trust sets and both must be satisfied, so a repository can narrow trust but never widen it. The global trust set comes first.
Types ¶
type LockPlan ¶
type LockPlan struct {
// Provider is the alias of the repository that provides the lock. It is the repository itself
// unless locking is delegated.
Provider string
// Required is the minimum scope mutations need.
Required artifact.LockScope
// Chain lists the aliases visited from the repository to the provider, in order.
Chain []string
}
LockPlan is the resolved lock coordination of one repository.
func ResolveLockPlan ¶
func ResolveLockPlan(cfg *schema.ArtifactConfig, alias string) (LockPlan, error)
ResolveLockPlan follows `locking.repository` delegation from alias to the repository that provides the lock and reports the required scope. It fails on an unknown delegate, on a cycle, and on an invalid scope. It does not check the provider's capability; Validator.Validate does.
type Option ¶
type Option func(*Validator)
Option configures a Validator.
func WithIdentityLookup ¶
WithIdentityLookup also checks that each referenced identity exists. Without it only the shape of the identity name is checked: identities are resolved lazily and may be provisioned later.
func WithRegistry ¶
func WithRegistry(registry *artifact.RepositoryRegistry) Option
WithRegistry validates kinds against a specific registry instead of the process-wide one.
type Validator ¶
type Validator struct {
// contains filtered or unexported fields
}
Validator validates artifact configuration. The zero value is not usable; use NewValidator.
func (*Validator) Validate ¶
func (v *Validator) Validate(cfg *schema.ArtifactConfig) error
Validate checks the global verification policy and every repository, returning all problems joined in a deterministic order. Every error wraps errUtils.ErrArtifactConfigInvalid. It performs no network access, credential resolution, or directory creation.
func (*Validator) ValidateRepository ¶
func (v *Validator) ValidateRepository(cfg *schema.ArtifactConfig, alias string) error
ValidateRepository validates one repository in the context of the whole configuration, which the lock delegation and verification checks need.