Skip to content

Commit 807b71c

Browse files
author
Axel von Bertoldi
committed
Update steps version to 0.2.0
Steps v0.2.0 was released recently, and made some backward-incompatible breaking changes. Because of the way the registry.gitlab.com/gitlab-org/step-runner:v0 image is released (the same v0 tag is reused for all releases), the steps integration integration tests started failing with: ERROR: Job failed (system failure): container exec on "6b6d4cefa3ed71e4f97254736db4c05ff815032ae00fb9585688099c6235ab70" finished with: executing step request: running run request for job "0": rpc error: code = Unknown desc = loading step: reading steps "{}\n---\nsteps:\n- name: echo\n script: echo ${{ env.FLIN_FLAN_FLON }}\n": validating step: jsonschema: '' does not validate with https://gitlab.com/gitlab-org/step-runner/schema/v1/step#/$ref/oneOf/0/required: missing properties: 'name', 'step' This is because we're using a 0.1.0 version of the library, but a 0.2.0 of the binary (included in the above image) Elsewhere I have made these tests to be skipped by setting the CI_SKIP_STEPS_TESTS variable, but to fix this we have to upgrade to v0.2.0 of the steps library. With the 0.2.0 release, the step https://gitlab.com/gitlab-org/ci-cd/runner-tools/echo-step was also changed, and since we use that step in the test, we have to also update the version we use to `@v4` from `@v3`. I'll remove the CI_SKIP_STEPS_TESTS variable when this MR is merged.
1 parent 8db5962 commit 807b71c

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

executors/docker/docker_steps_integration_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func Test_StepsIntegration(t *testing.T) {
4545
},
4646
"remote step": {
4747
steps: `- name: echo
48-
step: "https://gitlab.com/gitlab-org/ci-cd/runner-tools/echo-step@v3"
48+
step: "https://gitlab.com/gitlab-org/ci-cd/runner-tools/echo-step@v4"
4949
inputs:
5050
echo: foo bar baz`,
5151
wantOut: []string{"foo bar baz"},

steps/steps.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const stepsPreamble = "{}\n---\n"
5555
func addStepsPreamble(jsonSteps string) (string, error) {
5656
stepSchema := &schema.Step{}
5757

58-
err := json.Unmarshal([]byte(jsonSteps), &stepSchema.Steps)
58+
err := json.Unmarshal([]byte(jsonSteps), &stepSchema.Run)
5959
if err != nil {
6060
return "", fmt.Errorf("unmarshalling steps %q: %w", jsonSteps, err)
6161
}

steps/steps_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,23 @@ func Test_addStepsPreamble(t *testing.T) {
1616
}{
1717
"simple script": {
1818
in: `[{"name":"script", "script": "foo bar baz"}]`,
19-
want: "{}\n---\nsteps:\n- name: script\n script: foo bar baz\n",
19+
want: "{}\n---\nrun:\n- name: script\n script: foo bar baz\n",
2020
},
2121
"reference local step": {
2222
in: `[{"name":"local", "step":"./some/step", "inputs":{"in":"bar"}}]`,
23-
want: "{}\n---\nsteps:\n- inputs:\n in: bar\n name: local\n step: ./some/step\n",
23+
want: "{}\n---\nrun:\n- inputs:\n in: bar\n name: local\n step: ./some/step\n",
2424
},
2525
"reference remote step": {
2626
in: `[{"name":"remote", "step":"https://gitlab.com/components/script@v1", "inputs":{"in":"bar"}}]`,
27-
want: "{}\n---\nsteps:\n- inputs:\n in: bar\n name: remote\n step: https://gitlab.com/components/script@v1\n",
27+
want: "{}\n---\nrun:\n- inputs:\n in: bar\n name: remote\n step: https://gitlab.com/components/script@v1\n",
2828
},
2929
"action step": {
3030
in: `[{"name":"action", "action":"some-action@v1", "inputs":{"in":"bar"}}]`,
31-
want: "{}\n---\nsteps:\n- action: some-action@v1\n inputs:\n in: bar\n name: action\n",
31+
want: "{}\n---\nrun:\n- action: some-action@v1\n inputs:\n in: bar\n name: action\n",
3232
},
3333
"exec step": {
3434
in: `[{"name":"exec", "exec":{"command":["cmd","arg1", "arg2"],"work_dir":"/foo/bar/baz"}, "inputs":{"in":"bar"}}]`,
35-
want: "{}\n---\nsteps:\n- exec:\n command:\n - cmd\n - arg1\n - arg2\n work_dir: /foo/bar/baz\n inputs:\n in: bar\n name: exec\n",
35+
want: "{}\n---\nrun:\n- exec:\n command:\n - cmd\n - arg1\n - arg2\n work_dir: /foo/bar/baz\n inputs:\n in: bar\n name: exec\n",
3636
},
3737
}
3838

0 commit comments

Comments
 (0)