forked from gitlabhq/gitlab-runner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
default_executor_provider.go
45 lines (35 loc) · 991 Bytes
/
default_executor_provider.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package executors
import (
"errors"
"gitlab.com/gitlab-org/gitlab-runner/common"
)
type DefaultExecutorProvider struct {
Creator func() common.Executor
FeaturesUpdater func(features *common.FeaturesInfo)
DefaultShellName string
}
func (e DefaultExecutorProvider) CanCreate() bool {
return e.Creator != nil
}
func (e DefaultExecutorProvider) Create() common.Executor {
if e.Creator == nil {
return nil
}
return e.Creator()
}
func (e DefaultExecutorProvider) Acquire(config *common.RunnerConfig) (common.ExecutorData, error) {
return nil, nil
}
func (e DefaultExecutorProvider) Release(config *common.RunnerConfig, data common.ExecutorData) error {
return nil
}
func (e DefaultExecutorProvider) GetFeatures(features *common.FeaturesInfo) error {
if e.FeaturesUpdater == nil {
return errors.New("cannot evaluate features")
}
e.FeaturesUpdater(features)
return nil
}
func (e DefaultExecutorProvider) GetDefaultShell() string {
return e.DefaultShellName
}