Skip to content
Snippets Groups Projects
Unverified Commit 62067e15 authored by Steve Xuereb's avatar Steve Xuereb Committed by Steve Xuereb
Browse files

Register new executor `docker-windows`

The docker executor for windows needs to have different kind of default
values just as build dir and shell. The simplest and most static way to
do this is by creating a new executor `docker-windows` this will allow
us to disable certain features for windows and have specific
settings.  For more background why this was chosen please check
!1296 (comment 159005963)

reference #3896
parent 02d9f103
No related branches found
No related tags found
1 merge request!1296Update docker executor Executor Options initialization
......@@ -6,6 +6,7 @@ import (
"sync"
"github.com/docker/docker/api/types"
"gitlab.com/gitlab-org/gitlab-runner/common"
"gitlab.com/gitlab-org/gitlab-runner/executors"
)
......@@ -102,6 +103,11 @@ func (s *commandExecutor) Run(cmd common.ExecutorCommand) error {
}
func init() {
initializeLinuxDockerExecutor()
initializeWindowsDockerExecutor()
}
func initializeLinuxDockerExecutor() {
options := executors.ExecutorOptions{
DefaultCustomBuildsDirEnabled: true,
DefaultBuildsDir: "/builds",
......@@ -141,3 +147,44 @@ func init() {
DefaultShellName: options.Shell.Shell,
})
}
func initializeWindowsDockerExecutor() {
options := executors.ExecutorOptions{
DefaultCustomBuildsDirEnabled: true,
DefaultBuildsDir: `C:\builds`,
DefaultCacheDir: `C:\cache`,
SharedBuildsDir: false,
Shell: common.ShellScriptInfo{
Shell: "powershell",
Type: common.NormalShell,
RunnerCommand: "gitlab-runner-helper",
},
ShowHostname: true,
}
creator := func() common.Executor {
e := &commandExecutor{
executor: executor{
AbstractExecutor: executors.AbstractExecutor{
ExecutorOptions: options,
},
},
}
e.SetCurrentStage(common.ExecutorStageCreated)
return e
}
featuresUpdater := func(features *common.FeaturesInfo) {
features.Variables = true
features.Image = true
features.Services = true
features.Session = false
features.Terminal = false
}
common.RegisterExecutor("docker-windows", executors.DefaultExecutorProvider{
Creator: creator,
FeaturesUpdater: featuresUpdater,
DefaultShellName: options.Shell.Shell,
})
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment