Flux CD
Medium
Integration
CI tags main branch builds as main-<short-sha>-<unix-timestamp>. Which ImagePolicy reliably picks the newest build?
Select your answer:
Show answer and explanation
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.
More medium Flux CD questions
- A Kustomization must only be applied after another Kustomization that installs CRDs is ready. Which field do you set?
- What does spec.wait: true do on a Flux Kustomization?
- How do you substitute a per-cluster value such as ${cluster_region} into the manifests a Flux Kustomization applies?
- How does Flux decrypt Secrets that are stored encrypted with SOPS in Git?
- What does the --no-cross-namespace-refs=true flag on the Flux controllers do?
- How can a Kustomization apply resources with a tenant's limited permissions instead of kustomize-controller's own?