run[].step path is relative to project dir

.gitlab-ci.yml

include:
  - local: .gitlab/ci/*.gitlab-ci.yml

.gitlab/steps/test/step.yml

spec:
  outputs:
    report:
      type: string

---
run:
  - name: random_generator
    script: |
      echo $(( RANDOM % 100 + 1 )) > ${{step_dir}}/random_number.txt
      echo "Generated random number between 1 and 100 and saved to random_number.txt"

outputs:
  report: ${{step_dir}}/random_number.txt

.gitlab/ci/test.gitlab-ci.yml

test:
  stage: test
  run:
    - name: generate
      # step: "../steps/test" # does NOT WORK
      step: ".gitlab/steps/test" # does work (relative to project dir, not .gitlab/ci/test.gitlab-ci.yml
  • The resolution of paths inside the run block seems inconsistent or unintuitive, leading to misuse or misunderstanding of path references within the GitLab CI Job.