# CI tags main branch builds as main-<short-sha>-<unix-timestamp>. Which ImagePolicy reliably picks the newest build?

Flux CD, Medium (Advanced), Integration. https://k8wiz.com/uquiz/ci-tags-main-branch-builds-as-main-short-sha-unix-timestamp-which-imagepolicy-reliably-picks-the-newest-build

- A. filterTags.pattern '^main-' with policy.alphabetical.order: asc
- B. policy.semver.range: '>=0.0.0' with no filterTags
- C. filterTags extracting the commit SHA, with policy.numerical.order: asc
- D. filterTags extracting the timestamp, with policy.numerical.order: asc

**Answer:** filterTags extracting the timestamp, with policy.numerical.order: asc

**Explanation:** A pattern such as '^main-[a-fA-F0-9]+-(?P<ts>[1-9][0-9]*)' with extract: '$ts' hands only the timestamp to the policy, and a numerical policy with order asc picks the highest one. Sorting full tags alphabetically orders them by commit SHA, which is random. These tags are not semver, so a semver range never matches them.
