Bump to Buildah v1.8.2

As the title suggests.

Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
This commit is contained in:
TomSweeneyRedHat
2019-05-03 19:24:19 -04:00
parent 4aa90145bf
commit 066c9277af
4 changed files with 31 additions and 5 deletions

View File

@ -287,8 +287,8 @@ func SystemContextFromOptions(c *cobra.Command) (*types.SystemContext, error) {
ctx.SignaturePolicyPath = sigPolicy
}
authfile, err := c.Flags().GetString("authfile")
if err == nil && c.Flag("authfile").Changed {
ctx.AuthFilePath = authfile
if err == nil {
ctx.AuthFilePath = getAuthFile(authfile)
}
regConf, err := c.Flags().GetString("registries-conf")
if err == nil && c.Flag("registries-conf").Changed {
@ -302,6 +302,13 @@ func SystemContextFromOptions(c *cobra.Command) (*types.SystemContext, error) {
return ctx, nil
}
func getAuthFile(authfile string) string {
if authfile != "" {
return authfile
}
return os.Getenv("REGISTRY_AUTH_FILE")
}
func parseCreds(creds string) (string, string) {
if creds == "" {
return "", ""
@ -576,3 +583,22 @@ func IsolationOption(c *cobra.Command) (buildah.Isolation, error) {
}
return defaultIsolation()
}
// ScrubServer removes 'http://' or 'https://' from the front of the
// server/registry string if either is there. This will be mostly used
// for user input from 'buildah login' and 'buildah logout'.
func ScrubServer(server string) string {
server = strings.TrimPrefix(server, "https://")
return strings.TrimPrefix(server, "http://")
}
// RegistryFromFullName gets the registry from the input. If the input is of the form
// quay.io/myuser/myimage, it will parse it and just return quay.io
// It also returns true if a full image name was given
func RegistryFromFullName(input string) string {
split := strings.Split(input, "/")
if len(split) > 1 {
return split[0]
}
return split[0]
}