From 65f4cdc24e06acc131eba6f22db0e46a3c6ca43a Mon Sep 17 00:00:00 2001 From: Jason Hall Date: Fri, 7 Jan 2022 14:54:01 +0000 Subject: [PATCH] Add KANIKO_REGISTRY_MIRROR env var --- cmd/executor/cmd/root.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/executor/cmd/root.go b/cmd/executor/cmd/root.go index 90ae82b4e8..fc0aa16f55 100644 --- a/cmd/executor/cmd/root.go +++ b/cmd/executor/cmd/root.go @@ -218,6 +218,11 @@ func addKanikoOptionsFlags() { RootCmd.PersistentFlags().BoolVarP(&opts.CacheCopyLayers, "cache-copy-layers", "", false, "Caches copy layers") RootCmd.PersistentFlags().VarP(&opts.IgnorePaths, "ignore-path", "", "Ignore these paths when taking a snapshot. Set it repeatedly for multiple paths.") RootCmd.PersistentFlags().BoolVarP(&opts.ForceBuildMetadata, "force-build-metadata", "", false, "Force add metadata layers to build image") + + // Allow setting --registry-mirror using an environment variable. + if val, ok := os.LookupEnv("KANIKO_REGISTRY_MIRROR"); ok { + opts.RegistryMirrors.Set(val) + } } // addHiddenFlags marks certain flags as hidden from the executor help text