gitlab-ci-local icon indicating copy to clipboard operation
gitlab-ci-local copied to clipboard

Implement variable usage in rules:exists

Open jspiers opened this issue 1 year ago • 3 comments

.gitlab-ci.yml illustrating the issue:

variables:
  MY_FILE: example.txt

stages:
  - build

this runs:
  stage: build
  script:
    - echo $CI_JOB_NAME

this does not:
  stage: build
  script:
    - echo $CI_JOB_NAME
  rules:
    - exists:
       - $MY_FILE

example.txt:

blablabla

Expected behavior Both jobs should run as they do on GitLab (see this pipeline)

Host information Ubuntu 22.04

$ gitlab-ci-local --version
4.45.2
$ docker --version
Docker version 24.0.7, build afdd53b 

jspiers avatar Dec 09 '23 18:12 jspiers

I'm pretty sure this is in fact a feature request. I'll have to checkup, but labeling it feature for now.

firecow avatar Dec 09 '23 19:12 firecow

Hi thanks for the quick response. It's a bit more subtle than the new issue title suggests, because "rules: exists" is already working when the target filename is referenced directly in a "rules: exists: [filename]". It just doesn't work when the filename is provided indirectly via a variable.

I've updated my example to better show this.

This isn't super important or blocking my use of gitlab-ci-local, I just thought you should know.

Thanks!

jspiers avatar Dec 14 '23 18:12 jspiers

Ooooh.... LoL I didn't even realise we've implemented rules exists 😁

firecow avatar Dec 14 '23 19:12 firecow