Merge pull request #3631 from t-tran/master
Make docker-push only pushes the specified tag but not all
This commit is contained in:
commit
fcfca92ddd
|
@ -2,7 +2,6 @@ package dockerpush
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/mitchellh/packer/builder/docker"
|
"github.com/mitchellh/packer/builder/docker"
|
||||||
"github.com/mitchellh/packer/common"
|
"github.com/mitchellh/packer/common"
|
||||||
|
@ -81,18 +80,9 @@ func (p *PostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifact) (pac
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the name. We strip off any tags from the name because the
|
// Get the name.
|
||||||
// push doesn't use those.
|
|
||||||
name := artifact.Id()
|
name := artifact.Id()
|
||||||
|
|
||||||
if i := strings.Index(name, "/"); i >= 0 {
|
|
||||||
// This should always be true because the / is required. But we have
|
|
||||||
// to get the index to this so we don't accidentally strip off the port
|
|
||||||
if j := strings.Index(name[i:], ":"); j >= 0 {
|
|
||||||
name = name[:i+j]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ui.Message("Pushing: " + name)
|
ui.Message("Pushing: " + name)
|
||||||
if err := driver.Push(name); err != nil {
|
if err := driver.Push(name); err != nil {
|
||||||
return nil, false, err
|
return nil, false, err
|
||||||
|
|
|
@ -108,7 +108,7 @@ func TestPostProcessor_PostProcess_tags(t *testing.T) {
|
||||||
if !driver.PushCalled {
|
if !driver.PushCalled {
|
||||||
t.Fatal("should call push")
|
t.Fatal("should call push")
|
||||||
}
|
}
|
||||||
if driver.PushName != "hashicorp/ubuntu" {
|
if driver.PushName != "hashicorp/ubuntu:precise" {
|
||||||
t.Fatalf("bad name: %s", driver.PushName)
|
t.Fatalf("bad name: %s", driver.PushName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue