fix: panic when building offline and syntax error in registry config (#1086)

This commit is contained in:
Mercurio
2022-05-29 16:26:18 +01:00
committed by GitHub
parent f7fee49704
commit aaef8e2664
2 changed files with 6 additions and 4 deletions
+1
View File
@@ -91,6 +91,7 @@ func buildahRegistrySync() error {
[[registry]]
prefix = "localhost"
location = "localhost"
[[registry.mirror]]
location = "docker.io/lameleg"
+5 -4
View File
@@ -93,10 +93,6 @@ func (is *DefaultImageSaver) SaveImages(images []string, dir string, platform v1
tmpnameds := nameds
numCh <- struct{}{}
eg.Go(func() error {
defer func() {
<-numCh
mu.Unlock()
}()
auth := is.auths[tmpnameds[0].domain]
if auth.ServerAddress == "" {
auth.ServerAddress = tmpnameds[0].domain
@@ -106,6 +102,11 @@ func (is *DefaultImageSaver) SaveImages(images []string, dir string, platform v1
return fmt.Errorf("init registry error: %v", err)
}
mu.Lock()
defer func() {
<-numCh
mu.Unlock()
}()
err = is.save(tmpnameds, platform, registry)
if err != nil {
logger.Warn("save domain %s image %s error: %v", tmpnameds[0].domain, tmpnameds[0].FullName(), err)