rules:exists doesn't support dot current directory in file path

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Summary

With rules:exists doesn't support syntax like ./file for file pattern.

Steps to reproduce

create file myFile.txt and this section in gitlab-ci.yml

job-root-file-with-dot:
  stage: build
  script:
    - echo "file ./myFile.txt found"  
  rules:
    - exists:
        - "./myFile.txt"

File is not detected.

Example Project

https://gitlab.com/cedric3.olivier/rules-exists/-/blob/main/.gitlab-ci.yml

What is the current bug behavior?

All rules with file pattern prefixed with current directory pattern . are ignored.

What is the expected correct behavior?

Files location could be stored in variable for templating. Have to change rules if file are in the root directory is problematic.

job-root-file-variable:
  stage: build
  variables:
    BASE_DIR: "."
  script:
    - echo "file ${BASE_DIR}/myFile.txt found"  
  rules:
    - exists:
        - "${BASE_DIR}/myFile.txt"    


job-subdir-file-variable:
  stage: build
  variables:
    BASE_DIR: "subdir"
  script:
    - echo "file ${BASE_DIR}/myFile.txt found"  
  rules:
    - exists:
        - "${BASE_DIR}/myFile.txt"       

In the example above, first job is not run but second is ok.

Both jobs have to be run, they are identical.

Edited by 🤖 GitLab Bot 🤖