MCPcopy Create free account
hub / github.com/conforma/cli / Track

Function Track

internal/tracker/tracker.go:105–126  ·  view source on GitHub ↗

Track implements the common workflow of loading an existing tracker file and adding records to one of its collections. Each url is expected to reference a valid Tekton bundle. Each bundle may be added to none, 1, or 2 collections depending on the Tekton resource types they include.

(ctx context.Context, urls []string, input []byte, prune bool, freshen bool, inEffectDays int)

Source from the content-addressed store, hash-verified

103// Each url is expected to reference a valid Tekton bundle. Each bundle may be added
104// to none, 1, or 2 collections depending on the Tekton resource types they include.
105func Track(ctx context.Context, urls []string, input []byte, prune bool, freshen bool, inEffectDays int) ([]byte, error) {
106 t, err := newTracker(input)
107 if err != nil {
108 return nil, err
109 }
110
111 imageUrls, gitUrls := groupUrls(urls)
112
113 if err := t.trackImageReferences(ctx, imageUrls, freshen); err != nil {
114 return nil, err
115 }
116
117 if err := t.trackGitReferences(ctx, gitUrls, freshen); err != nil {
118 return nil, err
119 }
120
121 t.filterBundles(prune)
122
123 t.setExpiration(inEffectDays)
124
125 return t.Output()
126}
127
128func groupUrls(urls []string) ([]string, []string) {
129 imgs := make([]string, 0, len(urls))

Callers 2

TestTrackFunction · 0.85
TestInEffectDaysFunction · 0.85

Calls 7

newTrackerFunction · 0.85
groupUrlsFunction · 0.85
trackImageReferencesMethod · 0.80
trackGitReferencesMethod · 0.80
filterBundlesMethod · 0.80
setExpirationMethod · 0.80
OutputMethod · 0.80

Tested by 2

TestTrackFunction · 0.68
TestInEffectDaysFunction · 0.68