Skip to content

Commit

Permalink
Merge pull request #358 from goreleaser/docker-snapshot
Browse files Browse the repository at this point in the history
fixed docker version name when snapshots
  • Loading branch information
caarlos0 committed Sep 14, 2017
2 parents 17e9e6c + f4c7982 commit 250e78d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pipeline/docker/docker.go
Expand Up @@ -61,7 +61,7 @@ func (Pipe) Run(ctx *context.Context) error {
func doRun(ctx *context.Context, folder string, docker config.Docker, binary context.Binary) error {
var root = filepath.Join(ctx.Config.Dist, folder)
var dockerfile = filepath.Join(root, filepath.Base(docker.Dockerfile))
var image = fmt.Sprintf("%s:%s", docker.Image, ctx.Git.CurrentTag)
var image = fmt.Sprintf("%s:%s", docker.Image, ctx.Version)

if err := os.Link(docker.Dockerfile, dockerfile); err != nil {
return errors.Wrap(err, "failed to link dockerfile")
Expand Down
8 changes: 3 additions & 5 deletions pipeline/docker/docker_test.go
Expand Up @@ -27,9 +27,7 @@ func TestRunPipe(t *testing.T) {
// this might fail as the image doesnt exist yet, so lets ignore the error
_ = exec.Command("docker", "rmi", "goreleaser/test_run_pipe:v1.0.0").Run()
var ctx = &context.Context{
Git: context.GitInfo{
CurrentTag: "v1.0.0",
},
Version: "1.0.0",
Publish: true,
Config: config.Project{
ProjectName: "mybin",
Expand Down Expand Up @@ -59,12 +57,12 @@ func TestRunPipe(t *testing.T) {
// this might should not fail as the image should have been created when
// the step ran
assert.NoError(
exec.Command("docker", "rmi", "goreleaser/test_run_pipe:v1.0.0").Run(),
exec.Command("docker", "rmi", "goreleaser/test_run_pipe:1.0.0").Run(),
)
// the test_run_pipe_nope image should not have been created, so deleting
// it should fail
assert.Error(
exec.Command("docker", "rmi", "goreleaser/test_run_pipe_nope:v1.0.0").Run(),
exec.Command("docker", "rmi", "goreleaser/test_run_pipe_nope:1.0.0").Run(),
)
}

Expand Down

0 comments on commit 250e78d

Please sign in to comment.