From 2526fb17c5183c0d62500ad458c71806a16a0a76 Mon Sep 17 00:00:00 2001 From: Henrik Jonsson Date: Wed, 1 Apr 2015 18:21:33 +0200 Subject: [PATCH] if publish.docker.email is unspecified, pass in -e ' ' to avoid having the line end up as 'docker login -u foo -p bar -e someregistry', which is interpreted as 'log in user foo with pass bar and email someregistry to https://index.docker.io/v1/' (c.f. 'docker help login') --- plugin/publish/docker.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugin/publish/docker.go b/plugin/publish/docker.go index 7cafb35b..3ab7bdb8 100644 --- a/plugin/publish/docker.go +++ b/plugin/publish/docker.go @@ -94,8 +94,14 @@ func (d *Docker) Write(f *buildfile.Buildfile) { // Login? if d.RegistryLogin == true { + // If email is unspecified, pass in -e ' ' to avoid having + // registry URL interpreted as email, which will fail cryptically. + emailOpt := "' '" + if d.Email != "" { + emailOpt = d.Email + } f.WriteCmdSilent(fmt.Sprintf("docker login -u %s -p %s -e %s %s", - d.Username, d.Password, d.Email, d.RegistryLoginUrl)) + d.Username, d.Password, emailOpt, d.RegistryLoginUrl)) } // Tag and push all tags