firecow / gitlab-ci-local

Tired of pushing to test your .gitlab-ci.yml?
MIT License
2.03k stars 115 forks source link

$CI_NODE_INDEX defaults to the string "null" when not in a parallel job, expected the empty string #1227

Closed matt-c-earthscope closed 1 month ago

matt-c-earthscope commented 1 month ago

Minimal .gitlab-ci.yml illustrating the issue

---
example:
  script:
    - echo $CI_NODE_INDEX
    - echo $CI_NODE_TOTAL
    - echo $This_variable_does_not_exist

Expected behavior Snippet of gitlab.com job output:

$ echo $CI_NODE_INDEX
$ echo $CI_NODE_TOTAL
1
$ echo $This_variable_does_not_exist
Cleaning up project directory and file based variables
00:01
Job succeeded

Host information Ubuntu 20.04 gitlab-ci-local 4.49.0

Containerd binary Are you using docker or podman, or any other relevant containerization tool. - No

Additional context Looks like the specific lines that set the variable are here:

https://github.com/firecow/gitlab-ci-local/blob/d6378db7dc6975c92356d16be0d7b9f563f7d9d9/src/job.ts#L29

https://github.com/firecow/gitlab-ci-local/blob/d6378db7dc6975c92356d16be0d7b9f563f7d9d9/src/job.ts#L172