Skip to content

Commit

Permalink
fix(build, buildah): prefix registries mirrors with https
Browse files Browse the repository at this point in the history
Signed-off-by: Ilya Lesikov <ilya@lesikov.com>
  • Loading branch information
ilya-lesikov committed May 30, 2024
1 parent 5eca75d commit 969bde0
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pkg/docker_registry/generic_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"
"net/url"
"strings"
"sync"

"github.com/google/go-containerregistry/pkg/name"
Expand Down Expand Up @@ -143,7 +144,14 @@ func (api *genericApi) getOrCreateRegistryMirrors(ctx context.Context) ([]string
}

mirrorsFromEnv := util.PredefinedValuesByEnvNamePrefix("WERF_CONTAINER_REGISTRY_MIRROR_")
mirrors = append(mirrors, mirrorsFromEnv...)

for _, mirror := range mirrorsFromEnv {
if !strings.HasPrefix("http://", mirror) && !strings.HasPrefix("https://", mirror) {
mirror = "https://" + mirror
}

mirrors = append(mirrors, mirror)
}

api.mirrors = &mirrors
}
Expand Down

0 comments on commit 969bde0

Please sign in to comment.