1
0
Fork 0
mirror of https://code.forgejo.org/forgejo/runner.git synced 2025-09-15 18:57:01 +00:00

fix: panic if a step in a job is nil (#1145)

* fix: panic if a step is a job is nil

* simplify

* [no ci] Add testdata

* [no ci] Add Test
This commit is contained in:
ChristopherHX 2022-05-12 21:23:34 +02:00 committed by GitHub
parent bb13ab9aa8
commit eaef7fb879
3 changed files with 13 additions and 0 deletions

View file

@ -39,6 +39,11 @@ func newJobExecutor(info jobInfo, sf stepFactory, rc *RunContext) common.Executo
preSteps = append(preSteps, info.startContainer())
for i, stepModel := range infoSteps {
if stepModel == nil {
return func(ctx context.Context) error {
return fmt.Errorf("invalid Step %v: missing run or uses key", i)
}
}
if stepModel.ID == "" {
stepModel.ID = fmt.Sprintf("%d", i)
}