Merge pull request #111 from sgotti/runconfig_set_default_shell
runconfig: set task default shell
This commit is contained in:
commit
bbd287845f
|
@ -26,6 +26,10 @@ import (
|
||||||
errors "golang.org/x/xerrors"
|
errors "golang.org/x/xerrors"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
defaultShell = "/bin/sh -e"
|
||||||
|
)
|
||||||
|
|
||||||
func genRuntime(c *config.Config, ce *config.Runtime, variables map[string]string) *rstypes.Runtime {
|
func genRuntime(c *config.Config, ce *config.Runtime, variables map[string]string) *rstypes.Runtime {
|
||||||
containers := []*rstypes.Container{}
|
containers := []*rstypes.Container{}
|
||||||
for _, cc := range ce.Containers {
|
for _, cc := range ce.Containers {
|
||||||
|
@ -206,6 +210,10 @@ func GenRunConfigTasks(uuid util.UUIDGenerator, c *config.Config, runName string
|
||||||
DockerRegistriesAuth: make(map[string]rstypes.DockerRegistryAuth),
|
DockerRegistriesAuth: make(map[string]rstypes.DockerRegistryAuth),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if t.Shell == "" {
|
||||||
|
t.Shell = defaultShell
|
||||||
|
}
|
||||||
|
|
||||||
if c.DockerRegistriesAuth != nil {
|
if c.DockerRegistriesAuth != nil {
|
||||||
for regname, auth := range c.DockerRegistriesAuth {
|
for regname, auth := range c.DockerRegistriesAuth {
|
||||||
t.DockerRegistriesAuth[regname] = rstypes.DockerRegistryAuth{
|
t.DockerRegistriesAuth[regname] = rstypes.DockerRegistryAuth{
|
||||||
|
|
|
@ -801,6 +801,7 @@ func TestGenRunConfig(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Shell: "/bin/sh -e",
|
||||||
Environment: map[string]string{
|
Environment: map[string]string{
|
||||||
"ENV01": "ENV01",
|
"ENV01": "ENV01",
|
||||||
"ENVFROMVARIABLE01": "VARVALUE01",
|
"ENVFROMVARIABLE01": "VARVALUE01",
|
||||||
|
@ -876,6 +877,7 @@ func TestGenRunConfig(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Shell: "/bin/sh -e",
|
||||||
Environment: map[string]string{},
|
Environment: map[string]string{},
|
||||||
Steps: rstypes.Steps{
|
Steps: rstypes.Steps{
|
||||||
&rstypes.RunStep{BaseStep: rstypes.BaseStep{Type: "run", Name: "command01"}, Command: "command01", Environment: map[string]string{}},
|
&rstypes.RunStep{BaseStep: rstypes.BaseStep{Type: "run", Name: "command01"}, Command: "command01", Environment: map[string]string{}},
|
||||||
|
@ -973,6 +975,7 @@ func TestGenRunConfig(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Shell: "/bin/sh -e",
|
||||||
Environment: map[string]string{},
|
Environment: map[string]string{},
|
||||||
Steps: rstypes.Steps{
|
Steps: rstypes.Steps{
|
||||||
&rstypes.RunStep{BaseStep: rstypes.BaseStep{Type: "run", Name: "command01"}, Command: "command01", Environment: map[string]string{}},
|
&rstypes.RunStep{BaseStep: rstypes.BaseStep{Type: "run", Name: "command01"}, Command: "command01", Environment: map[string]string{}},
|
||||||
|
|
|
@ -109,6 +109,8 @@ func (e *Executor) doRunStep(ctx context.Context, s *types.RunStep, t *types.Exe
|
||||||
}
|
}
|
||||||
defer outf.Close()
|
defer outf.Close()
|
||||||
|
|
||||||
|
// TODO(sgotti) this line is used only for old runconfig versions that don't
|
||||||
|
// set a task default shell in the runconfig
|
||||||
shell := defaultShell
|
shell := defaultShell
|
||||||
if t.Shell != "" {
|
if t.Shell != "" {
|
||||||
shell = t.Shell
|
shell = t.Shell
|
||||||
|
|
Loading…
Reference in New Issue