registry

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 8, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanonicalPath added in v0.2.0

func CanonicalPath(path string) string

CanonicalPath makes two spellings of the same directory comparable: absolute, cleaned, and with symlinks resolved.

Resolving matters because the answer decides whether a directory counts as registered, and registration is what devvault requires before it mounts any credentials. On macOS /tmp and /var are symlinks, so a registry entry recorded as /var/x and a working directory reported as /private/var/x are the same directory; without resolving, devvault would treat a registered project as unregistered and refuse to work with it.

A path that does not exist cannot be resolved, in which case the cleaned absolute form is the best available answer.

func ForgetImage added in v0.5.0

func ForgetImage(reg *Registry, id, name string) bool

ForgetImage drops name from the images recorded for a project and reports whether the registry changed. It is what `devvault images prune` calls after the container runtime removed the image, so the record never outlives what it describes.

func Home

func Home() (string, error)

func MakeID

func MakeID(customer, name string) string

func Path

func Path() (string, error)

func RecordImage added in v0.5.0

func RecordImage(reg *Registry, id, name string) bool

RecordImage adds name to the images recorded for a project and reports whether the registry changed.

The list is kept sorted and free of duplicates: rebuilding the same project must not grow the entry, and a stable order keeps the YAML diff of ~/.devvault/projects.yaml readable. A record for an unknown project is dropped instead of silently creating a registry entry — the same rule SetTrustedDigests follows, because registration is the user's assertion and never a side effect of another command.

func RecordedImages added in v0.5.0

func RecordedImages(reg Registry, id string) []string

RecordedImages returns the images devvault recorded building for a project. The result is a copy and is never nil, so a caller can read it without touching the registry it came from.

func Save

func Save(reg Registry) error

func SetTrustedDigests added in v0.2.0

func SetTrustedDigests(reg *Registry, id string, files map[string]string) bool

SetTrustedDigests replaces the approved digests of a project. It reports whether the project exists; approvals for unknown projects are dropped instead of silently creating a registry entry.

func TrustedDigests added in v0.2.0

func TrustedDigests(reg Registry, id string) map[string]string

TrustedDigests returns the approved file digests of a project. The result is a copy and is never nil, so callers can read it without a registry lock.

func Upsert

func Upsert(reg *Registry, id string, project Project)

func UpsertCredentialSet

func UpsertCredentialSet(reg *Registry, customerID, setID string, set CredentialSet)

func UpsertCustomer

func UpsertCustomer(reg *Registry, id string, customer Customer)

Types

type CredentialSet

type CredentialSet struct {
	Profile    string `yaml:"profile"`
	Mount      string `yaml:"mount"`
	AuthMethod string `yaml:"auth_method"`
}

func ResolveCredentialSet

func ResolveCredentialSet(reg Registry, project Project) (CredentialSet, bool)

type Customer

type Customer struct {
	Name             string                   `yaml:"name,omitempty"`
	DefaultWorkspace string                   `yaml:"default_workspace,omitempty"`
	CredentialSets   map[string]CredentialSet `yaml:"credential_sets,omitempty"`
}

type GitInfo

type GitInfo struct {
	Provider    string `yaml:"provider,omitempty"`
	Host        string `yaml:"host,omitempty"`
	Owner       string `yaml:"owner,omitempty"`
	Repo        string `yaml:"repo,omitempty"`
	URL         string `yaml:"url,omitempty"`
	CloneMethod string `yaml:"clone_method,omitempty"`
	Local       bool   `yaml:"local,omitempty"`
}

type Project

type Project struct {
	Alias         string       `yaml:"alias,omitempty"`
	Customer      string       `yaml:"customer"`
	Name          string       `yaml:"name"`
	CredentialSet string       `yaml:"credential_set,omitempty"`
	Path          string       `yaml:"path"`
	GitURL        string       `yaml:"git_url,omitempty"`
	Git           GitInfo      `yaml:"git,omitempty"`
	Backend       string       `yaml:"backend,omitempty"`
	LastOpened    time.Time    `yaml:"last_opened,omitempty"`
	Trust         *TrustRecord `yaml:"trust,omitempty"`
	// Images holds the container images devvault recorded having built for this
	// project, sorted and without duplicates. It is the only evidence devvault
	// accepts that an image is its own: images live in the shared storage of the
	// container runtime next to images devvault never created, and a name that
	// merely looks like devvault's is not proof of anything, because
	// `docker.image_name` is freely configurable. `devvault images prune` deletes
	// nothing that is not in this list.
	Images []string `yaml:"images,omitempty"`
}

func FindByPath added in v0.2.0

func FindByPath(reg Registry, path string) (string, Project, bool)

FindByPath returns the project registered for path. Callers that only know where a repository lives — not under which id it was registered — use it to reach the user-owned data for that repository.

func InferProject

func InferProject(path string) (Project, string, error)

func Resolve

func Resolve(reg Registry, key string) (string, Project, error)

type Registry

type Registry struct {
	Active    string              `yaml:"active"`
	Customers map[string]Customer `yaml:"customers,omitempty"`
	Projects  map[string]Project  `yaml:"projects"`
}

func Load

func Load() (Registry, error)

type TrustRecord added in v0.2.0

type TrustRecord struct {
	ApprovedAt time.Time `yaml:"approved_at"`
	// Files maps a repository-relative path to "sha256:<hex>".
	Files map[string]string `yaml:"files"`
}

TrustRecord holds the digests of the devvault-managed repository files the user approved for a project. It lives in the user-owned registry, never in the repository, so a repository can never approve itself.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL