github.com/nilium/gitlab-runner@v12.5.0+incompatible/executors/default_executor_provider.go (about)

     1  package executors
     2  
     3  import (
     4  	"errors"
     5  
     6  	"gitlab.com/gitlab-org/gitlab-runner/common"
     7  )
     8  
     9  type DefaultExecutorProvider struct {
    10  	Creator          func() common.Executor
    11  	FeaturesUpdater  func(features *common.FeaturesInfo)
    12  	DefaultShellName string
    13  }
    14  
    15  func (e DefaultExecutorProvider) CanCreate() bool {
    16  	return e.Creator != nil
    17  }
    18  
    19  func (e DefaultExecutorProvider) Create() common.Executor {
    20  	if e.Creator == nil {
    21  		return nil
    22  	}
    23  	return e.Creator()
    24  }
    25  
    26  func (e DefaultExecutorProvider) Acquire(config *common.RunnerConfig) (common.ExecutorData, error) {
    27  	return nil, nil
    28  }
    29  
    30  func (e DefaultExecutorProvider) Release(config *common.RunnerConfig, data common.ExecutorData) {}
    31  
    32  func (e DefaultExecutorProvider) GetFeatures(features *common.FeaturesInfo) error {
    33  	if e.FeaturesUpdater == nil {
    34  		return errors.New("cannot evaluate features")
    35  	}
    36  
    37  	e.FeaturesUpdater(features)
    38  	return nil
    39  }
    40  
    41  func (e DefaultExecutorProvider) GetDefaultShell() string {
    42  	return e.DefaultShellName
    43  }