Skip to content
This repository has been archived by the owner on Apr 25, 2023. It is now read-only.

Commit

Permalink
Merge branch 'release-0.1.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
romank87 committed Feb 12, 2016
2 parents 77f4c3e + d1e77df commit 21e4bdd
Show file tree
Hide file tree
Showing 42 changed files with 608 additions and 222 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Change Log

## [0.1.5](https://github.com/grammarly/rocker-compose/tree/0.1.5) (2016-02-12)

[Full Changelog](https://github.com/grammarly/rocker-compose/compare/0.1.4...0.1.5)

**Implemented enhancements:**

- New S3 naming schema support [\#42](https://github.com/grammarly/rocker-compose/pull/42)

## [0.1.4](https://github.com/grammarly/rocker-compose/tree/HEAD) (2016-02-08)

[Full Changelog](https://github.com/grammarly/rocker-compose/compare/0.1.3...0.1.4)
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.4
0.1.5
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ import (
"github.com/codegangsta/cli"
"github.com/fsouza/go-dockerclient"
"github.com/go-yaml/yaml"
"github.com/grammarly/rocker/src/dockerclient"
"github.com/grammarly/rocker/src/rocker/debugtrap"
"github.com/grammarly/rocker/src/rocker/dockerclient"
"github.com/grammarly/rocker/src/rocker/template"
"github.com/grammarly/rocker/src/rocker/textformatter"
"github.com/grammarly/rocker/src/template"
)

var (
Expand Down
13 changes: 7 additions & 6 deletions src/compose/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ import (
"os"
"time"

"github.com/grammarly/rocker/src/rocker/dockerclient"
"github.com/grammarly/rocker/src/rocker/imagename"
"github.com/grammarly/rocker/src/rocker/storage/s3"
"github.com/grammarly/rocker/src/rocker/template"
"github.com/grammarly/rocker/src/dockerclient"
"github.com/grammarly/rocker/src/imagename"
"github.com/grammarly/rocker/src/storage/s3"
"github.com/grammarly/rocker/src/template"
"github.com/kr/pretty"

log "github.com/Sirupsen/logrus"
Expand Down Expand Up @@ -715,7 +715,7 @@ func (client *DockerClient) resolveVersions(local, hub bool, vars template.Vars,
}

// looking locally first
candidate := container.Image.ResolveVersion(images)
candidate := container.Image.ResolveVersion(images, true)

// in case we want to include external images as well, pulling list of available
// images from repository or central docker hub
Expand All @@ -739,13 +739,14 @@ func (client *DockerClient) resolveVersions(local, hub bool, vars template.Vars,
log.Debugf("remote: %v", remote)

// Re-Resolve having hub tags
candidate = container.Image.ResolveVersion(append(images, remote...))
candidate = container.Image.ResolveVersion(append(images, remote...), false)
}

if candidate == nil {
err = fmt.Errorf("Image not found: %s", container.Image)
return
}
candidate.IsOldS3Name = container.Image.IsOldS3Name

log.Infof("Resolve %s --> %s", container.Image, candidate.GetTag())

Expand Down
6 changes: 3 additions & 3 deletions src/compose/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ import (

log "github.com/Sirupsen/logrus"
"github.com/fsouza/go-dockerclient"
"github.com/grammarly/rocker/src/rocker/dockerclient"
"github.com/grammarly/rocker/src/rocker/imagename"
"github.com/grammarly/rocker/src/rocker/template"
"github.com/grammarly/rocker/src/dockerclient"
"github.com/grammarly/rocker/src/imagename"
"github.com/grammarly/rocker/src/rocker/test"
"github.com/grammarly/rocker/src/template"
"github.com/kr/pretty"
"github.com/stretchr/testify/assert"
)
Expand Down
2 changes: 1 addition & 1 deletion src/compose/compose.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (

log "github.com/Sirupsen/logrus"
"github.com/fsouza/go-dockerclient"
"github.com/grammarly/rocker/src/rocker/template"
"github.com/grammarly/rocker/src/template"
"github.com/kr/pretty"
)

Expand Down
4 changes: 2 additions & 2 deletions src/compose/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ import (
"regexp"
"strings"

"github.com/grammarly/rocker/src/rocker/imagename"
"github.com/grammarly/rocker/src/rocker/template"
"github.com/grammarly/rocker/src/imagename"
"github.com/grammarly/rocker/src/template"
"github.com/mitchellh/go-homedir"

"github.com/fsouza/go-dockerclient"
Expand Down
2 changes: 1 addition & 1 deletion src/compose/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"strings"
"testing"

"github.com/grammarly/rocker/src/rocker/template"
"github.com/grammarly/rocker/src/template"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion src/compose/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"time"

"github.com/go-yaml/yaml"
"github.com/grammarly/rocker/src/rocker/imagename"
"github.com/grammarly/rocker/src/imagename"

log "github.com/Sirupsen/logrus"
"github.com/fsouza/go-dockerclient"
Expand Down
64 changes: 32 additions & 32 deletions src/compose/diff_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import (
"github.com/grammarly/rocker-compose/src/compose/config"
"testing"

"github.com/grammarly/rocker/src/rocker/imagename"
"github.com/grammarly/rocker/src/rocker/template"
"github.com/grammarly/rocker/src/imagename"
"github.com/grammarly/rocker/src/template"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
)
Expand All @@ -38,9 +38,9 @@ func TestComparatorSameValue(t *testing.T) {
func TestDiffCreateAll(t *testing.T) {
cmp := NewDiff("test")
containers := []*Container{}
c1 := newContainer("test", "1", config.ContainerName{"test", "2"}, config.ContainerName{"test", "3"})
c2 := newContainer("test", "2", config.ContainerName{"test", "4"})
c3 := newContainer("test", "3", config.ContainerName{"test", "4"})
c1 := newContainer("test", "1", config.ContainerName{Namespace: "test", Name: "2"}, config.ContainerName{Namespace: "test", Name: "3"})
c2 := newContainer("test", "2", config.ContainerName{Namespace: "test", Name: "4"})
c3 := newContainer("test", "3", config.ContainerName{Namespace: "test", Name: "4"})
c4 := newContainer("test", "4")
containers = append(containers, c1, c2, c3, c4)
actions, _ := cmp.Diff(containers, []*Container{})
Expand Down Expand Up @@ -157,8 +157,8 @@ func TestDiffEnsureFewExternalDependencies(t *testing.T) {
c1 := newContainer("metrics", "1")
c2 := newContainer("metrics", "2")
c3 := newContainer("metrics", "3")
c4 := newContainer("test", "1", config.ContainerName{"metrics", "1"},
config.ContainerName{"metrics", "2"}, config.ContainerName{"metrics", "3"})
c4 := newContainer("test", "1", config.ContainerName{Namespace: "metrics", Name: "1"},
config.ContainerName{Namespace: "metrics", Name: "2"}, config.ContainerName{Namespace: "metrics", Name: "3"})
actions, _ := cmp.Diff([]*Container{c4}, []*Container{c1, c2, c3})
mock := clientMock{}
mock.On("EnsureContainerExist", c1).Return(nil)
Expand Down Expand Up @@ -188,9 +188,9 @@ func TestDiffFailInMiddle(t *testing.T) {

func TestDiffFailInDependent(t *testing.T) {
cmp := NewDiff("test")
c1 := newContainer("test", "1", config.ContainerName{"test", "2"})
c1 := newContainer("test", "1", config.ContainerName{Namespace: "test", Name: "2"})
c2 := newContainer("test", "2")
c3 := newContainer("test", "3", config.ContainerName{"test", "2"})
c3 := newContainer("test", "3", config.ContainerName{Namespace: "test", Name: "2"})
actions, _ := cmp.Diff([]*Container{c1, c2, c3}, []*Container{})
mock := clientMock{}
mock.On("RunContainer", c2).Return(fmt.Errorf("fail"))
Expand All @@ -201,7 +201,7 @@ func TestDiffFailInDependent(t *testing.T) {

func TestDiffInDependent(t *testing.T) {
cmp := NewDiff("test")
c1 := newContainer("test", "1", config.ContainerName{"test", "2"})
c1 := newContainer("test", "1", config.ContainerName{Namespace: "test", Name: "2"})
c2 := newContainer("test", "2")
c2x := newContainer("test", "2")
c2x.Config.Labels = map[string]string{"test": "test2"}
Expand All @@ -224,17 +224,17 @@ func TestDiffInDependentNet(t *testing.T) {
}
c1 := &Container{
State: &ContainerState{Running: true},
Name: &config.ContainerName{"test", "1"},
Name: &config.ContainerName{Namespace: "test", Name: "1"},
Config: &config.Container{Net: c2NetName},
}
c2 := &Container{
State: &ContainerState{Running: true},
Name: &config.ContainerName{"test", "2"},
Name: &config.ContainerName{Namespace: "test", Name: "2"},
Config: &config.Container{},
}
c2x := &Container{
State: &ContainerState{Running: true},
Name: &config.ContainerName{"test", "2"},
Name: &config.ContainerName{Namespace: "test", Name: "2"},
Config: &config.Container{Labels: map[string]string{"test": "test2"}},
}
actions, _ := cmp.Diff([]*Container{c1, c2x}, []*Container{c1, c2})
Expand All @@ -256,7 +256,7 @@ func TestDiffInDependentExternalNet(t *testing.T) {
}
c1 := &Container{
State: &ContainerState{Running: true},
Name: &config.ContainerName{"test", "1"},
Name: &config.ContainerName{Namespace: "test", Name: "1"},
Config: &config.Container{Net: c2NetName},
}
c2 := newContainer("external", "2")
Expand All @@ -271,9 +271,9 @@ func TestDiffInDependentExternalNet(t *testing.T) {
func TestDiffForCycles(t *testing.T) {
cmp := NewDiff("test")
containers := []*Container{}
c1 := newContainer("test", "1", config.ContainerName{"test", "2"})
c2 := newContainer("test", "2", config.ContainerName{"test", "3"})
c3 := newContainer("test", "3", config.ContainerName{"test", "1"})
c1 := newContainer("test", "1", config.ContainerName{Namespace: "test", Name: "2"})
c2 := newContainer("test", "2", config.ContainerName{Namespace: "test", Name: "3"})
c3 := newContainer("test", "3", config.ContainerName{Namespace: "test", Name: "1"})
containers = append(containers, c1, c2, c3)
_, err := cmp.Diff(containers, []*Container{c1, c3})
assert.Error(t, err)
Expand All @@ -286,12 +286,12 @@ func TestDiffDifferentConfig(t *testing.T) {
cpusetCpus2 := "0-4"
c1x := &Container{
State: &ContainerState{Running: true},
Name: &config.ContainerName{"test", "1"},
Name: &config.ContainerName{Namespace: "test", Name: "1"},
Config: &config.Container{CpusetCpus: &cpusetCpus1},
}
c1y := &Container{
State: &ContainerState{Running: true},
Name: &config.ContainerName{"test", "1"},
Name: &config.ContainerName{Namespace: "test", Name: "1"},
Config: &config.Container{CpusetCpus: &cpusetCpus2},
}
containers = append(containers, c1x)
Expand All @@ -308,7 +308,7 @@ func TestDiffForExternalDependencies(t *testing.T) {
cmp := NewDiff("test")
containers := []*Container{}
c1 := newContainer("test", "1")
c2 := newContainer("test", "2", config.ContainerName{"metrics", "1"})
c2 := newContainer("test", "2", config.ContainerName{Namespace: "metrics", Name: "1"})
m1 := newContainer("metrics", "1")
containers = append(containers, c1, c2)
actions, _ := cmp.Diff(containers, []*Container{m1})
Expand All @@ -324,9 +324,9 @@ func TestDiffForExternalDependencies(t *testing.T) {
func TestDiffCreateRemoving(t *testing.T) {
cmp := NewDiff("test")
containers := []*Container{}
c1 := newContainer("test", "1", config.ContainerName{"test", "2"}, config.ContainerName{"test", "3"})
c2 := newContainer("test", "2", config.ContainerName{"test", "4"})
c3 := newContainer("test", "3", config.ContainerName{"test", "4"})
c1 := newContainer("test", "1", config.ContainerName{Namespace: "test", Name: "2"}, config.ContainerName{Namespace: "test", Name: "3"})
c2 := newContainer("test", "2", config.ContainerName{Namespace: "test", Name: "4"})
c3 := newContainer("test", "3", config.ContainerName{Namespace: "test", Name: "4"})
c4 := newContainer("test", "4")
c5 := newContainer("test", "5")
containers = append(containers, c1, c2, c3, c4)
Expand All @@ -345,9 +345,9 @@ func TestDiffCreateRemoving(t *testing.T) {
func TestDiffCreateSome(t *testing.T) {
cmp := NewDiff("test")
containers := []*Container{}
c1 := newContainer("test", "1", config.ContainerName{"test", "2"}, config.ContainerName{"test", "3"})
c2 := newContainer("test", "2", config.ContainerName{"test", "4"})
c3 := newContainer("test", "3", config.ContainerName{"test", "4"})
c1 := newContainer("test", "1", config.ContainerName{Namespace: "test", Name: "2"}, config.ContainerName{Namespace: "test", Name: "3"})
c2 := newContainer("test", "2", config.ContainerName{Namespace: "test", Name: "4"})
c3 := newContainer("test", "3", config.ContainerName{Namespace: "test", Name: "4"})
c4 := newContainer("test", "4")
containers = append(containers, c1, c2, c3, c4)
actions, _ := cmp.Diff(containers, []*Container{c1})
Expand All @@ -362,7 +362,7 @@ func TestDiffCreateSome(t *testing.T) {

func TestWaitForStart(t *testing.T) {
cmp := NewDiff("test")
c1 := newContainerWaitFor("test", "1", config.ContainerName{"test", "2"})
c1 := newContainerWaitFor("test", "1", config.ContainerName{Namespace: "test", Name: "2"})
c2 := newContainer("test", "2")
actions, _ := cmp.Diff([]*Container{c1, c2}, []*Container{})
mock := clientMock{}
Expand All @@ -376,7 +376,7 @@ func TestWaitForStart(t *testing.T) {

func TestWaitForNotRestart(t *testing.T) {
cmp := NewDiff("test")
c1 := newContainerWaitFor("test", "1", config.ContainerName{"test", "2"})
c1 := newContainerWaitFor("test", "1", config.ContainerName{Namespace: "test", Name: "2"})
c2 := newContainer("test", "2")
c2x := newContainer("test", "2")
c2x.Config.Labels = map[string]string{"test": "test2"}
Expand All @@ -394,12 +394,12 @@ func TestDiffRecovery(t *testing.T) {
cmp := NewDiff("")
c1x := &Container{
State: &ContainerState{Running: true},
Name: &config.ContainerName{"test", "1"},
Name: &config.ContainerName{Namespace: "test", Name: "1"},
Config: &config.Container{},
}
c1y := &Container{
State: &ContainerState{Running: false},
Name: &config.ContainerName{"test", "1"},
Name: &config.ContainerName{Namespace: "test", Name: "1"},
Config: &config.Container{},
}
actions, _ := cmp.Diff([]*Container{c1x}, []*Container{c1y})
Expand All @@ -415,7 +415,7 @@ func newContainer(namespace string, name string, dependencies ...config.Containe
State: &ContainerState{
Running: true,
},
Name: &config.ContainerName{namespace, name},
Name: &config.ContainerName{Namespace: namespace, Name: name},
Config: &config.Container{
VolumesFrom: dependencies,
}}
Expand All @@ -426,7 +426,7 @@ func newContainerWaitFor(namespace string, name string, dependencies ...config.C
State: &ContainerState{
Running: true,
},
Name: &config.ContainerName{namespace, name},
Name: &config.ContainerName{Namespace: namespace, Name: name},
Config: &config.Container{
WaitFor: dependencies,
}}
Expand Down
6 changes: 3 additions & 3 deletions src/compose/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ import (
"github.com/docker/docker/pkg/jsonmessage"
"github.com/docker/docker/pkg/term"
"github.com/fsouza/go-dockerclient"
"github.com/grammarly/rocker/src/rocker/dockerclient"
"github.com/grammarly/rocker/src/rocker/imagename"
"github.com/grammarly/rocker/src/rocker/storage/s3"
"github.com/grammarly/rocker/src/dockerclient"
"github.com/grammarly/rocker/src/imagename"
"github.com/grammarly/rocker/src/storage/s3"
)

const emptyImageName = "gliderlabs/alpine:3.2"
Expand Down
2 changes: 1 addition & 1 deletion src/compose/docker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"testing"

"github.com/fsouza/go-dockerclient"
"github.com/grammarly/rocker/src/rocker/dockerclient"
"github.com/grammarly/rocker/src/dockerclient"
)

func TestEntrypointOverride(t *testing.T) {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 21e4bdd

Please sign in to comment.