Skip to content

Commit 2f56dd5

Browse files
committed
add tags
Signed-off-by: Henrique Goncalves <[email protected]>
1 parent 79aaeef commit 2f56dd5

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

config/sync.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ var (
3737
"targets": []string{
3838
"docker.io/library/ubuntu",
3939
},
40+
"tags": []string{},
4041
"mutableTags": []string{
4142
"latest",
4243
},

internal/sync/images.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,15 @@ func SyncImage(ctx context.Context, image *structs.Image) error {
132132
DockerAuthConfig: srcAuth,
133133
}
134134

135-
srcTags, err := docker.GetRepositoryTags(ctx, srcCtx, srcRef)
136-
if err != nil {
137-
return err
135+
var srcTags []string
136+
137+
if len(image.Tags) > 0 {
138+
srcTags = image.Tags
139+
} else {
140+
srcTags, err = docker.GetRepositoryTags(ctx, srcCtx, srcRef)
141+
if err != nil {
142+
return err
143+
}
138144
}
139145

140146
if len(srcTags) == 0 {

structs/image.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ type Image struct {
1111
Targets []string `json:"targets" yaml:"targets"`
1212
MutableTags []string `json:"mutableTags" yaml:"mutableTags"`
1313
IgnoredTags []string `json:"ignoredTags" yaml:"ignoredTags"`
14+
Tags []string `json:"tags" yaml:"tags"`
1415
SrcRef types.ImageReference `json:"-" yaml:"-"`
1516
}
1617

0 commit comments

Comments
 (0)