run keyword script property does not accept array syntax as documented
Summary
The documentation states that within the run keyword, the script property accepts "a string or array of strings." However, using an array results in a validation error.
Steps to reproduce
Use the following .gitlab-ci.yml:
stages:
- test
test_run_keyword:
stage: test
image: alpine:latest
run:
- name: say_script
script:
- echo "hello"
- echo "hello2"
What is the current bug behavior?
Pipeline fails with the following error:
This GitLab CI configuration is invalid: jobs:job run object property at `/1/script` is a disallowed additional property
What is the expected correct behavior?
The script property within run should accept an array of strings as documented.
Workaround
Use YAML block scalar syntax instead of an array:
- name: say_script
script: |
echo "hello"
echo "hello2"
Environment
- GitLab.com (SaaS)
- GitLab version: 18.9.0
Additional context
The run keyword was introduced in GitLab 17.3 and the documentation notes it is "available for testing, but not ready for production use." The Pipeline Editor also shows a schema warning ("Incorrect type. Expected string") when using array syntax, suggesting the JSON schema hasn't been updated to match the documented behavior.
Edited by 🤖 GitLab Bot 🤖