Documentation ¶
Overview ¶
Package index implements the index struct and its logic.
Index ¶
- type CosignSignature
- type Entry
- type Index
- func (i *Index) EntryByName(name string) (*Entry, bool)
- func (i *Index) Normalize() error
- func (i *Index) Read(path string) error
- func (i *Index) ReadBytes(bytes []byte) error
- func (i *Index) Remove(entry *Entry) error
- func (i *Index) SearchByKeywords(minScore float64, keywords ...string) []*Entry
- func (i *Index) Upsert(entry *Entry)
- func (i *Index) Write(path string) error
- type Maintainer
- type MergedIndexes
- type Signature
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CosignSignature ¶
type CosignSignature struct { CertificateOidcIssuer string `yaml:"certificate-oidc-issuer"` CertificateOidcIssuerRegexp string `yaml:"certificate-oidc-issuer-regexp"` CertificateIdentity string `yaml:"certificate-identity"` CertificateIdentityRegexp string `yaml:"certificate-identity-regexp"` CertificateGithubWorkflow string `yaml:"certificate-github-workflow"` }
CosignSignature contains certificate information for cosign keyless signature verification, equivalent to the cosign command line arguments.
type Entry ¶
type Entry struct { // Mandatory fields Name string `yaml:"name"` Type string `yaml:"type"` Registry string `yaml:"registry"` Repository string `yaml:"repository"` Signature *Signature `yaml:"signature,omitempty"` // Optional fields Description string `yaml:"description"` Home string `yaml:"home"` Keywords []string `yaml:"keywords"` License string `yaml:"license"` Maintainers Maintainer `yaml:"maintainers"` Sources []string `yaml:"sources"` }
Entry describes an entry of the index stored remotely and cached locally.
type Index ¶
Index represents an index.
func (*Index) EntryByName ¶
EntryByName returns a Entry by passing its name.
func (*Index) Normalize ¶
Normalize the index to the canonical form (i.e., entries sorted by name, lexically byte-wise in ascending order).
Since only one possible representation of a normalized index exists, a digest of a normalized index is suitable for integrity checking or similar purposes. Return an error if the index is not in a consistent state.
func (*Index) SearchByKeywords ¶
SearchByKeywords search for entries matching the given keywords in MergedIndexes. minScore is the minimum score to consider a match between a name of an artifact and a keyword. if minScore is not reached, we fallback to a simple partial matching on keywords.
type Maintainer ¶
Maintainer represents an index maintainer.
type MergedIndexes ¶
type MergedIndexes struct { Index // contains filtered or unexported fields }
MergedIndexes is used to aggregate all indexes and perform search operations.
func NewMergedIndexes ¶
func NewMergedIndexes() *MergedIndexes
NewMergedIndexes initializes a MergedIndex.
func (*MergedIndexes) IndexByEntry ¶
func (m *MergedIndexes) IndexByEntry(entry *Entry) *Index
IndexByEntry is used to retrieve the original index from an entry in MergedIndexes.
func (*MergedIndexes) Merge ¶
func (m *MergedIndexes) Merge(indexes ...*Index)
Merge creates a new index by merging all the indexes that are passed. Orders matters. Be sure to pass an ordered list of indexes. For our use case, sort by added time.
func (*MergedIndexes) ResolveReference ¶
func (m *MergedIndexes) ResolveReference(name string) (string, error)
ResolveReference is a helper function that parse with the following logic:
if name is the name of an artifact, it will use the merged index to compute its reference. The tag latest is always appended. e.g "cloudtrail" -> "ghcr.io/falcosecurity/plugins/cloudtrail:latest" if instead a tag or a digest is specified, the name will be used to look up into mergedIndexes, then the tag or digest will be appended. e.g "cloudtrail:0.5.1" -> "ghcr.io/falcosecurity/plugins/cloudtrail:0.5.1" e.g "cloudtrail@sha256:123abc..." -> "ghcr.io/falcosecurity/plugins/cloudtrail@sha256:123abc...
if name is a reference without tag or digest, tag latest is appended. e.g. "ghcr.io/falcosecurity/plugins/cloudtrail" -> "ghcr.io/falcosecurity/plugins/cloudtrail:latest"
if name is a complete reference, it will be returned as is.
func (*MergedIndexes) SignatureForIndexRef ¶
func (m *MergedIndexes) SignatureForIndexRef(name string) *Signature
SignatureForIndexRef is a helper function that will identify signature data if available for the specified name corresponding to an entry in the index. Returns nil if not found or if the specified name is a full reference.
type Signature ¶
type Signature struct {
Cosign *CosignSignature `yaml:"cosign,omitempty"`
}
Signature represents all the metadata necessary to perform signature verification.