Skip to content

Commit 83444bc

Browse files
authored
Merge pull request #196 from nicholasSUSE/fix-regsync-deny-tag
removing deny tags when there is a tag to sync
2 parents 7aed8c7 + 0fa7dc6 commit 83444bc

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

pkg/regsync/generateconfig.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ func GenerateConfigFile() error {
8787
return err
8888
}
8989

90-
// Create the regsync config file
90+
// Create the first regsync config file for tracking images and tags on prime registry
9191
if err := createRegSyncConfigFile(imageTagMap); err != nil {
9292
return err
9393
}
@@ -282,16 +282,18 @@ sync:`)
282282
fmt.Fprintln(file)
283283
fmt.Fprintln(file, " type: repository")
284284
fmt.Fprintln(file, " tags:")
285-
fmt.Fprintln(file, " deny:")
286-
fmt.Fprintln(file, ` - "*"`)
287-
fmt.Fprintln(file, " allow:")
288285

289286
// We collect all tags and then sort them so there is consistency
290287
// in the update of the regsync file always.
291288
tags := make([]string, 0)
292289
tags = append(tags, imageTagMap[repo]...)
290+
if len(tags) == 0 {
291+
fmt.Fprintln(file, " deny:")
292+
fmt.Fprintln(file, ` - "*"`)
293+
continue
294+
}
293295
sort.Strings(tags)
294-
296+
fmt.Fprintln(file, " allow:")
295297
for _, tag := range tags {
296298
if tag == "" {
297299
continue // skip empty tag

0 commit comments

Comments
 (0)