Skip to content

Commit 4139a7f

Browse files
committed
feat: RegistryMaps
1 parent da95f80 commit 4139a7f

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

envbuilder.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,23 @@ func run(ctx context.Context, opts options.Options, execArgs *execArgsInfo) erro
529529
if val, ok := os.LookupEnv("KANIKO_REGISTRY_MIRROR"); ok {
530530
registryMirror = strings.Split(val, ";")
531531
}
532+
registryMap := make(map[string][]string)
533+
if val, ok := os.LookupEnv("KANIKO_REGISTRY_MAP"); ok {
534+
if val != "" {
535+
var pairs []string
536+
if strings.Contains(val, ";") {
537+
pairs = strings.Split(val, ";")
538+
} else {
539+
pairs = []string{val}
540+
}
541+
for _, kv := range pairs {
542+
valueSplit := strings.SplitN(kv, "=", 2)
543+
if len(valueSplit) > 1 {
544+
registryMap[valueSplit[0]] = append(registryMap[valueSplit[0]], valueSplit[1])
545+
}
546+
}
547+
}
548+
}
532549
var destinations []string
533550
if opts.CacheRepo != "" {
534551
destinations = append(destinations, opts.CacheRepo)
@@ -572,6 +589,7 @@ func run(ctx context.Context, opts options.Options, execArgs *execArgsInfo) erro
572589
// Related to PR #114
573590
// https://github.com/coder/envbuilder/pull/114
574591
RegistryMirrors: registryMirror,
592+
RegistryMaps: registryMap,
575593
},
576594
SrcContext: buildParams.BuildContext,
577595

0 commit comments

Comments
 (0)