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)
| 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. |
| 105 | func 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 | |
| 128 | func groupUrls(urls []string) ([]string, []string) { |
| 129 | imgs := make([]string, 0, len(urls)) |