Commit 207d21c5 authored by Kamil Trzciński's avatar Kamil Trzciński 🔴

Refactor executor options

parent 0b5a4000
......@@ -63,15 +63,19 @@ func (s *DockerCommandExecutor) Start() error {
}
func init() {
options := executors.ExecutorOptions{
DefaultBuildsDir: "/builds",
SharedBuildsDir: false,
DefaultShell: "bash",
ShellType: common.NormalShell,
ShowHostname: true,
}
common.RegisterExecutor("docker", func() common.Executor {
return &DockerCommandExecutor{
DockerExecutor: DockerExecutor{
AbstractExecutor: executors.AbstractExecutor{
DefaultBuildsDir: "/builds",
SharedBuildsDir: false,
DefaultShell: "bash",
ShellType: common.NormalShell,
ShowHostname: true,
ExecutorOptions: options,
},
},
}
......
......@@ -65,15 +65,19 @@ func (s *DockerSSHExecutor) Cleanup() {
}
func init() {
options := executors.ExecutorOptions{
DefaultBuildsDir: "builds",
SharedBuildsDir: false,
DefaultShell: "bash",
ShellType: common.LoginShell,
ShowHostname: true,
}
common.RegisterExecutor("docker-ssh", func() common.Executor {
return &DockerSSHExecutor{
DockerExecutor: DockerExecutor{
AbstractExecutor: executors.AbstractExecutor{
DefaultBuildsDir: "builds",
SharedBuildsDir: false,
DefaultShell: "bash",
ShellType: common.LoginShell,
ShowHostname: true,
ExecutorOptions: options,
},
},
}
......
......@@ -13,12 +13,16 @@ import (
"path/filepath"
)
type AbstractExecutor struct {
type ExecutorOptions struct {
DefaultBuildsDir string
SharedBuildsDir bool
DefaultShell string
ShellType common.ShellType
ShowHostname bool
}
type AbstractExecutor struct {
ExecutorOptions
Config *common.RunnerConfig
Build *common.Build
BuildCanceled chan bool
......
......@@ -314,14 +314,18 @@ func (s *ParallelsExecutor) Cleanup() {
}
func init() {
options := executors.ExecutorOptions{
DefaultBuildsDir: "builds",
SharedBuildsDir: false,
DefaultShell: "bash",
ShellType: common.LoginShell,
ShowHostname: true,
}
common.RegisterExecutor("parallels", func() common.Executor {
return &ParallelsExecutor{
AbstractExecutor: executors.AbstractExecutor{
DefaultBuildsDir: "builds",
SharedBuildsDir: false,
DefaultShell: "bash",
ShellType: common.LoginShell,
ShowHostname: true,
ExecutorOptions: options,
},
}
})
......
......@@ -89,14 +89,18 @@ func (s *ShellExecutor) Cleanup() {
}
func init() {
options := executors.ExecutorOptions{
DefaultBuildsDir: "builds",
SharedBuildsDir: true,
DefaultShell: common.GetDefaultShell(),
ShellType: common.LoginShell,
ShowHostname: false,
}
common.RegisterExecutor("shell", func() common.Executor {
return &ShellExecutor{
AbstractExecutor: executors.AbstractExecutor{
DefaultBuildsDir: "builds",
SharedBuildsDir: true,
DefaultShell: common.GetDefaultShell(),
ShellType: common.LoginShell,
ShowHostname: false,
ExecutorOptions: options,
},
}
})
......
......@@ -64,14 +64,18 @@ func (s *SSHExecutor) Cleanup() {
}
func init() {
options := executors.ExecutorOptions{
DefaultBuildsDir: "builds",
SharedBuildsDir: true,
DefaultShell: "bash",
ShellType: common.LoginShell,
ShowHostname: true,
}
common.RegisterExecutor("ssh", func() common.Executor {
return &SSHExecutor{
AbstractExecutor: executors.AbstractExecutor{
DefaultBuildsDir: "builds",
SharedBuildsDir: true,
DefaultShell: "bash",
ShellType: common.LoginShell,
ShowHostname: true,
ExecutorOptions: options,
},
}
})
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment