Commit 0f1e8475 authored by Kamil Trzciński's avatar Kamil Trzciński 🔴

Fix code compilation

parent 40b5a461
......@@ -5,7 +5,6 @@ import (
"errors"
log "github.com/sirupsen/logrus"
"gitlab.com/gitlab-org/gitlab-runner/common"
)
type ExecutorData interface{}
......@@ -76,7 +75,7 @@ func validateExecutorProvider(provider ExecutorProvider) error {
return errors.New("cannot create executor")
}
if provider.GetFeatures(&common.FeaturesInfo{}) != nil {
if provider.GetFeatures(&FeaturesInfo{}) != nil {
return errors.New("cannot get features")
}
......
......@@ -64,9 +64,32 @@ func (_m *MockExecutorProvider) Create() Executor {
return r0
}
// GetDefaultShell provides a mock function with given fields:
func (_m *MockExecutorProvider) GetDefaultShell() string {
ret := _m.Called()
var r0 string
if rf, ok := ret.Get(0).(func() string); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(string)
}
return r0
}
// GetFeatures provides a mock function with given fields: features
func (_m *MockExecutorProvider) GetFeatures(features *FeaturesInfo) {
_m.Called(features)
func (_m *MockExecutorProvider) GetFeatures(features *FeaturesInfo) error {
ret := _m.Called(features)
var r0 error
if rf, ok := ret.Get(0).(func(*FeaturesInfo) error); ok {
r0 = rf(features)
} else {
r0 = ret.Error(0)
}
return r0
}
// Release provides a mock function with given fields: config, data
......
package executors
import "gitlab.com/gitlab-org/gitlab-runner/common"
import (
"errors"
"gitlab.com/gitlab-org/gitlab-runner/common"
)
type DefaultExecutorProvider struct {
Creator func() common.Executor
......@@ -27,10 +31,13 @@ func (e DefaultExecutorProvider) Release(config *common.RunnerConfig, data commo
return nil
}
func (e DefaultExecutorProvider) GetFeatures(features *common.FeaturesInfo) {
if e.FeaturesUpdater != nil {
e.FeaturesUpdater(features)
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 {
......
......@@ -405,8 +405,12 @@ func (m *machineProvider) CanCreate() bool {
return m.provider.CanCreate()
}
func (m *machineProvider) GetFeatures(features *common.FeaturesInfo) {
m.provider.GetFeatures(features)
func (m *machineProvider) GetFeatures(features *common.FeaturesInfo) error {
return m.provider.GetFeatures(features)
}
func (m *machineProvider) GetDefaultShell() string {
return m.provider.GetDefaultShell()
}
func (m *machineProvider) Create() common.Executor {
......
......@@ -551,6 +551,6 @@ func init() {
common.RegisterExecutor("kubernetes", executors.DefaultExecutorProvider{
Creator: createFn,
FeaturesUpdater: featuresFn,
DefaultShellName: options.Shell.Shell,
DefaultShellName: executorOptions.Shell.Shell,
})
}
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