Skip to content

Commit 2515b53

Browse files
committed
feat: add mutable tags support for image synchronization
1 parent a0f5f91 commit 2515b53

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

config/sync.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ var (
3737
"targets": []string{
3838
"docker.io/library/ubuntu",
3939
},
40+
"mutableTags": []string{
41+
"latest",
42+
},
4043
},
4144
}),
4245
WithValidImages())

internal/sync/images.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ func SyncImage(ctx context.Context, image *structs.Image) error {
199199
}
200200

201201
for _, dst := range image.Targets {
202-
if slices.Contains(dstTags, fmt.Sprintf("%s:%s", dst, tag)) {
202+
if !slices.Contains(image.MutableTags, tag) && slices.Contains(dstTags, fmt.Sprintf("%s:%s", dst, tag)) {
203203
log.Info().
204204
Str("image", image.Source).
205205
Str("tag", tag).

structs/image.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ import (
77
)
88

99
type Image struct {
10-
Source string `json:"source" yaml:"source"`
11-
Targets []string `json:"targets" yaml:"targets"`
12-
Auths map[string]remote.Option `json:"-" yaml:"-"`
10+
Source string `json:"source" yaml:"source"`
11+
Targets []string `json:"targets" yaml:"targets"`
12+
MutableTags []string `json:"mutableTags" yaml:"mutableTags"`
13+
Auths map[string]remote.Option `json:"-" yaml:"-"`
1314
}
1415

1516
func (i *Image) GetSource() string {

0 commit comments

Comments
 (0)