mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-03-17 20:47:50 +02:00
feat: allow env vars for docker tag_template
Add env var support for the Docker tag_template field incl. test.
This commit is contained in:
parent
1c2afe148f
commit
25e1cddc1b
@ -95,9 +95,11 @@ func tagName(ctx *context.Context, docker config.Docker) (string, error) {
|
||||
}
|
||||
data := struct {
|
||||
Version, Tag string
|
||||
Env map[string]string
|
||||
}{
|
||||
Version: ctx.Version,
|
||||
Tag: ctx.Git.CurrentTag,
|
||||
Env: ctx.Env,
|
||||
}
|
||||
err = t.Execute(&out, data)
|
||||
return out.String(), err
|
||||
|
@ -53,7 +53,7 @@ func TestRunPipe(t *testing.T) {
|
||||
Dockerfile: "testdata/Dockerfile",
|
||||
Binary: "mybin",
|
||||
Latest: true,
|
||||
TagTemplate: "{{.Tag}}",
|
||||
TagTemplate: "{{.Tag}}-{{.Env.FOO}}",
|
||||
},
|
||||
err: "",
|
||||
},
|
||||
@ -82,7 +82,7 @@ func TestRunPipe(t *testing.T) {
|
||||
},
|
||||
}
|
||||
var images = []string{
|
||||
"localhost:5000/goreleaser/test_run_pipe:v1.0.0",
|
||||
"localhost:5000/goreleaser/test_run_pipe:v1.0.0-123",
|
||||
"localhost:5000/goreleaser/test_run_pipe:latest",
|
||||
}
|
||||
// this might fail as the image doesnt exist yet, so lets ignore the error
|
||||
@ -105,6 +105,7 @@ func TestRunPipe(t *testing.T) {
|
||||
docker.docker,
|
||||
},
|
||||
},
|
||||
Env: map[string]string{"FOO": "123"},
|
||||
}
|
||||
for _, plat := range []string{"linuxamd64", "linux386", "darwinamd64"} {
|
||||
ctx.AddBinary(plat, "mybin", "mybin", binPath)
|
||||
|
Loading…
x
Reference in New Issue
Block a user