Skip to content

Commit 85dce54

Browse files
Axel von BertoldiGitLab
authored andcommitted
Bump step-runner version to 0.29.0
This version adds job timeout to the RunRequest.
1 parent 205518c commit 85dce54

8 files changed

Lines changed: 97 additions & 7 deletions

File tree

common/build.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,7 @@ func (b *Build) executeStepStage(ctx context.Context, connector steps.Connector,
450450

451451
info := steps.JobInfo{
452452
ID: b.ID,
453+
Timeout: b.GetBuildTimeout(),
453454
ProjectDir: b.FullProjectDir(),
454455
Variables: b.GetAllVariables(),
455456
}

common/mocks.go

Lines changed: 73 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

functions/script_legacy/script_legacy_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ run:
3838
Run(stepYml)
3939
require.NoError(t, err)
4040
assert.Equal(t, proto.StepResult_success, res.Status)
41-
require.Contains(t, logs, `Running step "hello_script_legacy"`)
41+
require.Contains(t, logs, `Running step name=hello_script_legacy`)
4242
require.Contains(t, logs, "Hello from script_legacy")
4343
require.Contains(t, logs, "Second command")
4444
})
@@ -240,9 +240,9 @@ run:
240240
Run(stepYml)
241241
require.NoError(t, err)
242242
assert.Equal(t, proto.StepResult_success, res.Status)
243-
require.Contains(t, logs, `Running step "step1"`)
243+
require.Contains(t, logs, `Running step name=step1`)
244244
require.Contains(t, logs, "First step")
245-
require.Contains(t, logs, `Running step "step2"`)
245+
require.Contains(t, logs, `Running step name=step2`)
246246
require.Contains(t, logs, "Second step")
247247
assert.Len(t, res.SubStepResults, 2)
248248
})

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ require (
8080
gitlab.com/gitlab-org/golang-cli-helpers v0.0.0-20220124161940-198f30295e7e
8181
gitlab.com/gitlab-org/labkit v1.34.0
8282
gitlab.com/gitlab-org/moa v0.0.0-20251209091627-66342f721c88
83-
gitlab.com/gitlab-org/step-runner v0.27.0
83+
gitlab.com/gitlab-org/step-runner v0.29.0
8484
go.mozilla.org/pkcs7 v0.9.0
8585
go.uber.org/automaxprocs v1.6.0
8686
go.yaml.in/yaml/v3 v3.0.4

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -604,8 +604,8 @@ gitlab.com/gitlab-org/labkit v1.34.0 h1:wJrUZdfxbZrA9+qvnpk5gYJtceW+p7ceSJSg1BPZ
604604
gitlab.com/gitlab-org/labkit v1.34.0/go.mod h1:JqQLdgjV/KKAZJ6gvNodaLStmWeTT9mxgJPIEi66VHI=
605605
gitlab.com/gitlab-org/moa v0.0.0-20251209091627-66342f721c88 h1:GVlo8Pr4wfXI/6UF+Rmi0Yv2l7lwVgFiNBeImgWVeko=
606606
gitlab.com/gitlab-org/moa v0.0.0-20251209091627-66342f721c88/go.mod h1:024490ksS75/Bi9UoJTu59qY44JuFBAfi5bzGsLIhtY=
607-
gitlab.com/gitlab-org/step-runner v0.27.0 h1:8wrnKWv7x3CcSXhJUDLHYkWimWlCp65T5JDmceTiPaw=
608-
gitlab.com/gitlab-org/step-runner v0.27.0/go.mod h1:KZ7aYYlc/DFt3xxhfygrr0TTlXWdnN+LJEsFC9W/1Sw=
607+
gitlab.com/gitlab-org/step-runner v0.29.0 h1:cVklPW741QGMblJEXE4WgyiXwYhmp7hNzQdmnl31Hxw=
608+
gitlab.com/gitlab-org/step-runner v0.29.0/go.mod h1:KZ7aYYlc/DFt3xxhfygrr0TTlXWdnN+LJEsFC9W/1Sw=
609609
go.etcd.io/bbolt v1.3.5 h1:XAzx9gjCb0Rxj7EoqcClPD1d5ZBxZJk0jbuoPHenBt0=
610610
go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ=
611611
go.mozilla.org/pkcs7 v0.9.0 h1:yM4/HS9dYv7ri2biPtxt8ikvB37a980dg69/pKmS+eI=

steps/execute.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ type Connector interface {
2323

2424
type JobInfo struct {
2525
ID int64
26+
Timeout time.Duration
2627
ProjectDir string
2728
Variables spec.Variables
2829
}

steps/steps.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ func NewRequest(jobInfo JobInfo, steps []schema.Step) (*client.RunRequest, error
3030

3131
return &client.RunRequest{
3232
Id: strconv.FormatInt(jobInfo.ID, 10),
33+
Timeout: &jobInfo.Timeout,
3334
WorkDir: jobInfo.ProjectDir,
3435
BuildDir: jobInfo.ProjectDir,
3536
Env: map[string]string{},

steps/steps_test.go

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ package steps
55
import (
66
"encoding/json"
77
"testing"
8+
"time"
89

910
"github.com/stretchr/testify/assert"
1011

11-
"gitlab.com/gitlab-org/gitlab-runner/common/spec"
1212
"gitlab.com/gitlab-org/step-runner/schema/v1"
13+
14+
"gitlab.com/gitlab-org/gitlab-runner/common/spec"
1315
)
1416

1517
func Test_addStepsPreamble(t *testing.T) {
@@ -50,6 +52,18 @@ func Test_addStepsPreamble(t *testing.T) {
5052
}
5153
}
5254

55+
func Test_NewRequest_Adds_Timeout(t *testing.T) {
56+
step := `[{"name":"script", "script": "foo bar baz"}]`
57+
var steps []schema.Step
58+
assert.NoError(t, json.Unmarshal([]byte(step), &steps))
59+
to := time.Second * 42
60+
61+
ji := JobInfo{Timeout: to}
62+
got, err := NewRequest(ji, steps)
63+
assert.NoError(t, err)
64+
assert.Equal(t, to, *got.Timeout)
65+
}
66+
5367
func Test_addVariables_Omits(t *testing.T) {
5468
keysToVars := func(keys []string) spec.Variables {
5569
jobVars := spec.Variables{}

0 commit comments

Comments
 (0)