Skip to content

Rules when:exists with relative path fails to glob

Summary

This does not trigger a match and job is not created:

    - exists:
        - ./*.spec

the workaround is to remove the relative path specification:

   - exists:
        - "*.spec"

but I don't like that, as for that need to start quoting values and it is not symmetric how globbing works in other areas like cache and artifacts keys.

Steps to reproduce

In this example test:spec:subdir and test:spec:glob are triggered, but test:spec:relative job is not triggered, but it should.

test:spec:subdir:
  script:
    - echo $CI_JOB_NAME
  rules:
    - if: $CI_MERGE_REQUEST_ID
      when: never
    - exists:
        - test/*.spec

test:spec:glob:
  script:
    - echo $CI_JOB_NAME
  rules:
    - if: $CI_MERGE_REQUEST_ID
      when: never
    - exists:
        - "*.spec"

test:spec:relative:
  script:
    - echo $CI_JOB_NAME
  rules:
    - if: $CI_MERGE_REQUEST_ID
      when: never
    - exists:
        - ./*.spec

# vim:ts=2:sw=2:et

Example Project (reproducer)

Edited by Elan Ruusamäe