Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 05e8e1e

Browse files
committed
ci(images): publish chronologically-orderable master-<epoch>-<sha> tags
The existing master push pipeline produces `master` (rolling) and `sha-<short>` tags. Neither is orderable by build time, so downstream GitOps that want to auto-bump to the newest master build (e.g. Flux ImagePolicy) can't pick the latest from the tag list — alphabetical sort over hex shas is effectively random, and the rolling `master` tag can't be referenced as an immutable bump target. Add a third tag of the form `master-<epoch>-<sha>` (Unix epoch in seconds + short sha), gated on default-branch pushes via metadata- action's `is_default_branch` predicate. The sha is retained for traceability; the epoch makes the tags numerically orderable, so a Flux ImagePolicy like filterTags: pattern: '^master-(?P<ts>[0-9]+)-[a-f0-9]+$' extract: '$ts' policy: numerical: order: asc will reliably bump to the newest master build. Applied to both image_build.yml (OCI labels stay consistent) and image_merge.yml (the actual tag publisher via buildx imagetools).
1 parent a7f6cc8 commit 05e8e1e

2 files changed

Lines changed: 2 additions & 0 deletions

File tree

.github/workflows/image_build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ jobs:
106106
type=ref,event=branch
107107
type=semver,pattern={{raw}}
108108
type=sha
109+
type=raw,value={{branch}}-{{date 'X'}}-{{sha}},enable={{is_default_branch}}
109110
flavor: |
110111
latest=${{ inputs.tag-latest }}
111112
suffix=${{ inputs.tag-suffix }},onlatest=true

.github/workflows/image_merge.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ jobs:
8080
type=ref,event=branch
8181
type=semver,pattern={{raw}}
8282
type=sha
83+
type=raw,value={{branch}}-{{date 'X'}}-{{sha}},enable={{is_default_branch}}
8384
flavor: |
8485
latest=${{ inputs.tag-latest }}
8586
suffix=${{ inputs.tag-suffix }},onlatest=true

0 commit comments

Comments
 (0)