| 35 | ) |
| 36 | |
| 37 | func trackBundleCmd(track trackBundleFn, pullImage pullImageFn, pushImage pushImageFn) *cobra.Command { |
| 38 | params := struct { |
| 39 | bundles []string |
| 40 | gits []string |
| 41 | input string |
| 42 | prune bool |
| 43 | replace bool |
| 44 | output string |
| 45 | freshen bool |
| 46 | inEffectDays int |
| 47 | }{ |
| 48 | prune: true, |
| 49 | inEffectDays: 60, |
| 50 | } |
| 51 | |
| 52 | cmd := &cobra.Command{ |
| 53 | Use: "bundle", |
| 54 | Short: "Record tracking information about Tekton bundles", |
| 55 | |
| 56 | Long: hd.Doc(` |
| 57 | Record tracking information about Tekton bundles |
| 58 | |
| 59 | Each Tekton Bundle is expected to be a proper OCI image reference. They |
| 60 | may contain a tag, a digest, or both. If a digest is not provided, this |
| 61 | command will query the registry to determine its value. Either a tag |
| 62 | or a digest is required. |
| 63 | |
| 64 | The output is meant to assist enforcement of policies that ensure the |
| 65 | most recent Tekton Bundle is used. Each entry contains an "expires_on" |
| 66 | date which indicates when that specific bundle version should no longer |
| 67 | be used. When a new entry is introduced, an expiration date is added to |
| 68 | the previous newest entry. |
| 69 | |
| 70 | If --prune is set, on by default, expired entries are removed. |
| 71 | Any entry with an expires_on date in the future (or no expires_on date) |
| 72 | is considered current and will not be pruned. |
| 73 | `), |
| 74 | |
| 75 | Example: hd.Doc(` |
| 76 | Track multiple bundles: |
| 77 | |
| 78 | ec track bundle --bundle <IMAGE1> --bundle <IMAGE2> |
| 79 | |
| 80 | Save tracking information into a new tracking file: |
| 81 | |
| 82 | ec track bundle --bundle <IMAGE1> --output <path/to/new/file> |
| 83 | |
| 84 | Save tracking information into an image registry: |
| 85 | |
| 86 | ec track bundle --bundle <IMAGE1> --output <oci:registry.io/repository/image:tag> |
| 87 | |
| 88 | Extend an existing tracking file with a new bundle: |
| 89 | |
| 90 | ec track bundle --bundle <IMAGE1> --input <path/to/input/file> |
| 91 | |
| 92 | Extend an existing tracking file with a new bundle and save changes: |
| 93 | |
| 94 | ec track bundle --bundle <IMAGE1> --input <path/to/input/file> --replace |