1
0
mirror of https://github.com/containers/buildah.git synced 2025-07-31 15:24:26 +03:00

remove dependency on openshift struct

use of github.com/openshift/api/config/v1 is costly in size, something around 10MB.  removal of this dependancy and using a locally defined struct took the buildah executable size from around 38MB to around 27MB.  This also hits libpod and allows it also shed that size as well.

Signed-off-by: Brent Baude <bbaude@redhat.com>
This commit is contained in:
Brent Baude
2020-05-22 14:27:40 -05:00
parent 75e94a2e0e
commit 8b360f6e04
193 changed files with 6 additions and 135654 deletions

View File

@ -24,7 +24,6 @@ import (
"github.com/containers/storage/pkg/archive"
"github.com/containers/storage/pkg/stringid"
digest "github.com/opencontainers/go-digest"
configv1 "github.com/openshift/api/config/v1"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
)
@ -181,7 +180,12 @@ func checkRegistrySourcesAllows(forWhat string, dest types.ImageReference) error
}
if registrySources, ok := os.LookupEnv("BUILD_REGISTRY_SOURCES"); ok && len(registrySources) > 0 {
var sources configv1.RegistrySources
// Use local struct instead of github.com/openshift/api/config/v1 RegistrySources
var sources struct {
InsecureRegistries []string `json:"insecureRegistries,omitempty"`
BlockedRegistries []string `json:"blockedRegistries,omitempty"`
AllowedRegistries []string `json:"allowedRegistries,omitempty"`
}
if err := json.Unmarshal([]byte(registrySources), &sources); err != nil {
return errors.Wrapf(err, "error parsing $BUILD_REGISTRY_SOURCES (%q) as JSON", registrySources)
}