Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Implement variable usage in rules:exists #1059

Open
jspiers opened this issue Dec 9, 2023 · 3 comments
Open

Implement variable usage in rules:exists #1059

jspiers opened this issue Dec 9, 2023 · 3 comments
Labels
nice Down prioritized

Comments

@jspiers
Copy link

jspiers commented Dec 9, 2023

.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 
@firecow
Copy link
Owner

firecow commented Dec 9, 2023

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

@firecow firecow added the feature Feature missing according to gitlab ci standard label Dec 9, 2023
@firecow firecow changed the title Job with rules:exists referring to an existing file with a filename defined in a variable does not run Implement rules:exists Dec 9, 2023
@jspiers
Copy link
Author

jspiers commented Dec 14, 2023

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!

@firecow
Copy link
Owner

firecow commented Dec 14, 2023

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

@firecow firecow changed the title Implement rules:exists Implement variable usage in rules:exists Dec 14, 2023
@firecow firecow added nice Down prioritized and removed feature Feature missing according to gitlab ci standard labels Dec 14, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
nice Down prioritized
Projects
None yet
Development

No branches or pull requests

2 participants