mirror of
https://code.forgejo.org/forgejo/runner.git
synced 2025-09-30 19:22:09 +00:00
the license change from MIT to GPLv3+ is a breaking change Refs forgejo/runner#773 <!--start release-notes-assistant--> <!--URL:https://code.forgejo.org/forgejo/runner--> - other - [PR](https://code.forgejo.org/forgejo/runner/pulls/940): <!--number 940 --><!--line 0 --><!--description Y2hvcmU6IGJ1bXAgdmVyc2lvbiB0byB2MTE=-->chore: bump version to v11<!--description--> <!--end release-notes-assistant--> Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/940 Reviewed-by: Michael Kriese <michael.kriese@gmx.de> Co-authored-by: Earl Warren <contact@earl-warren.org> Co-committed-by: Earl Warren <contact@earl-warren.org>
46 lines
1.1 KiB
Go
46 lines
1.1 KiB
Go
package runner
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"code.forgejo.org/forgejo/runner/v11/act/model"
|
|
)
|
|
|
|
type stepFactory interface {
|
|
newStep(step *model.Step, rc *RunContext) (step, error)
|
|
}
|
|
|
|
type stepFactoryImpl struct{}
|
|
|
|
func (sf *stepFactoryImpl) newStep(stepModel *model.Step, rc *RunContext) (step, error) {
|
|
switch stepModel.Type() {
|
|
case model.StepTypeInvalid:
|
|
return nil, fmt.Errorf("Invalid run/uses syntax for job:%s step:%+v", rc.Run, stepModel)
|
|
case model.StepTypeRun:
|
|
return &stepRun{
|
|
Step: stepModel,
|
|
RunContext: rc,
|
|
}, nil
|
|
case model.StepTypeUsesActionLocal:
|
|
return &stepActionLocal{
|
|
Step: stepModel,
|
|
RunContext: rc,
|
|
readAction: readActionImpl,
|
|
runAction: runActionImpl,
|
|
}, nil
|
|
case model.StepTypeUsesActionRemote:
|
|
return &stepActionRemote{
|
|
Step: stepModel,
|
|
RunContext: rc,
|
|
readAction: readActionImpl,
|
|
runAction: runActionImpl,
|
|
}, nil
|
|
case model.StepTypeUsesDockerURL:
|
|
return &stepDocker{
|
|
Step: stepModel,
|
|
RunContext: rc,
|
|
}, nil
|
|
}
|
|
|
|
return nil, fmt.Errorf("Unable to determine how to run job:%s step:%+v", rc.Run, stepModel)
|
|
}
|