runservice: add option to define custom container entrypoint

This commit is contained in:
Simone Gotti 2019-03-13 12:12:32 +01:00
parent 16ac6ada66
commit b05b377d31
4 changed files with 10 additions and 1 deletions

View File

@ -71,6 +71,7 @@ type Container struct {
Environment map[string]string `yaml:"environment,omitempty"`
User string `yaml:"user"`
Privileged bool `yaml:"privileged"`
Entrypoint string `yaml:"entrypoint"`
}
type Pipeline struct {

View File

@ -37,6 +37,7 @@ func genRuntime(c *config.Config, runtimeName string) *rstypes.Runtime {
Environment: cc.Environment,
User: cc.User,
Privileged: cc.Privileged,
Entrypoint: cc.Entrypoint,
})
}
return &rstypes.Runtime{

View File

@ -438,6 +438,12 @@ func (e *Executor) executeTask(ctx context.Context, et *types.ExecutorTask) {
return
}
cmd := []string{toolboxContainerPath, "sleeper"}
if et.Containers[0].Entrypoint != "" {
cmd = strings.Split(et.Containers[0].Entrypoint, " ")
log.Infof("cmd: %v", cmd)
}
log.Debugf("starting pod")
podConfig := &driver.PodConfig{
Labels: createTaskLabels(et.ID),
@ -445,7 +451,7 @@ func (e *Executor) executeTask(ctx context.Context, et *types.ExecutorTask) {
Containers: []*driver.ContainerConfig{
{
Image: et.Containers[0].Image,
Cmd: []string{toolboxContainerPath, "sleeper"},
Cmd: cmd,
Env: et.Containers[0].Environment,
WorkingDir: et.WorkingDir,
User: et.Containers[0].User,

View File

@ -425,6 +425,7 @@ type Container struct {
Environment map[string]string `json:"environment,omitempty"`
User string `json:"user,omitempty"`
Privileged bool `json:"privileged"`
Entrypoint string `json:"entrypoint"`
}
type Workspace []WorkspaceLevel