Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrBreak error to break walk ErrBreak = stderrors.New("break") // ErrSkip error to skip walk the children of the artifact ErrSkip = stderrors.New("skip") )
View Source
var ( // Ctl is a global artifact controller instance Ctl = NewController() )
Functions ¶
Types ¶
type Abstractor ¶
type Abstractor interface { // AbstractMetadata abstracts the metadata for the specific artifact type into the artifact model, AbstractMetadata(ctx context.Context, artifact *artifact.Artifact) error }
Abstractor abstracts the metadata of artifact
type AdditionLink ¶
type AdditionLink struct { HREF string `json:"href"` Absolute bool `json:"absolute"` // specify the href is an absolute URL or not }
AdditionLink is a link via that the addition can be fetched
type ArtOption ¶
type ArtOption struct { Tags []string Accs []*accessorymodel.AccessoryData }
type Artifact ¶
type Artifact struct { artifact.Artifact Tags []*tag.Tag `json:"tags"` // the list of tags that attached to the artifact AdditionLinks map[string]*AdditionLink `json:"addition_links"` // the resource link for build history(image), values.yaml(chart), dependency(chart), etc Labels []*model.Label `json:"labels"` Accessories []accessoryModel.Accessory `json:"-"` }
Artifact is the overall view of artifact
func (*Artifact) AbstractLabelNames ¶
AbstractLabelNames abstracts the label names from the artifact.
func (*Artifact) SetAdditionLink ¶
SetAdditionLink set a addition link
func (*Artifact) SetSBOMAdditionLink ¶
SetSBOMAdditionLink set the link of SBOM addition
func (*Artifact) UnmarshalJSON ¶
UnmarshalJSON to customize the accessories unmarshal
type Controller ¶
type Controller interface { // Ensure the artifact specified by the digest exists under the repository, // creates it if it doesn't exist. If tags are provided, ensure they exist // and are attached to the artifact. If the tags don't exist, create them first. // The "created" will be set as true when the artifact is created Ensure(ctx context.Context, repository, digest string, option *ArtOption) (created bool, id int64, err error) // Count returns the total count of artifacts according to the query. // The artifacts that referenced by others and without tags are not counted Count(ctx context.Context, query *q.Query) (total int64, err error) // List artifacts according to the query, specify the properties returned with option // The artifacts that referenced by others and without tags are not returned List(ctx context.Context, query *q.Query, option *Option) (artifacts []*Artifact, err error) // Get the artifact specified by ID, specify the properties returned with option Get(ctx context.Context, id int64, option *Option) (artifact *Artifact, err error) // Get the artifact specified by repository name and reference, the reference can be tag or digest, // specify the properties returned with option GetByReference(ctx context.Context, repository, reference string, option *Option) (artifact *Artifact, err error) // Delete the artifact specified by artifact ID Delete(ctx context.Context, id int64) (err error) // Copy the artifact specified by "srcRepo" and "reference" into the repository specified by "dstRepo" Copy(ctx context.Context, srcRepo, reference, dstRepo string) (id int64, err error) // UpdatePullTime updates the pull time for the artifact. If the tagID is provides, update the pull // time of the tag as well UpdatePullTime(ctx context.Context, artifactID int64, tagID int64, time time.Time) (err error) // GetAddition returns the addition of the artifact. // The addition is different according to the artifact type: // build history for image; values.yaml, readme and dependencies for chart, etc GetAddition(ctx context.Context, artifactID int64, additionType string) (addition *processor.Addition, err error) // AddLabel to the specified artifact AddLabel(ctx context.Context, artifactID int64, labelID int64) (err error) // RemoveLabel from the specified artifact RemoveLabel(ctx context.Context, artifactID int64, labelID int64) (err error) // Walk walks the artifact tree rooted at root, calling walkFn for each artifact in the tree, including root. Walk(ctx context.Context, root *Artifact, walkFn func(*Artifact) error, option *Option) error // HasUnscannableLayer check artifact with digest if has unscannable layer HasUnscannableLayer(ctx context.Context, dgst string) (bool, error) // ListWithLatest list the artifacts when the latest_in_repository in the query was set ListWithLatest(ctx context.Context, query *q.Query, option *Option) (artifacts []*Artifact, err error) }
Controller defines the operations related with artifacts and tags
func NewController ¶
func NewController() Controller
NewController creates an instance of the default artifact controller
Click to show internal directories.
Click to hide internal directories.