Backend: Using rules:exists on artifacts

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

Summary

If a job has a rules:exists pointing to an artifact that was created previously, the job isn't actually run.

If this is not a bug, then the documentation should be updated to state that artifacts don't work with the rules:exist directive.

Steps to reproduce

  1. Create a project using this .gitlab-ci.yml template:
build:
  stage: build
  script:
    - date > artifact.txt
  artifacts:
    paths:
      - artifact.txt

deploy:
  stage: deploy
  script:
    - ls
  needs:
    job: build
  rules:
    - exists:
        - artifact.txt
  1. Run a build. Observe that the build job runs, but the deploy job doesn't.

Example Project

https://gitlab.com/anton/bug-rules-exist-artifacts

What is the current bug behavior?

Any job using the rules:exist that points to an artifact does not run regardless if the file exists.

What is the expected correct behavior?

Any job using the rules:exist that points to an artifact should run if the file exists.

Relevant logs and/or screenshots

(Paste any relevant logs - please use code blocks (```) to format console output, logs, and code as it's tough to read otherwise.)

Output of checks

(If you are reporting a bug on GitLab.com, write: This bug happens on GitLab.com)

This bug happens on GitLab.com

Results of GitLab environment info

Expand for output related to GitLab environment info

(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:env:info`)

(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)

Results of GitLab application Check

Expand for output related to the GitLab application check

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:check SANITIZE=true)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)

(we will only investigate if the tests are passing)

Possible fixes

(If you can, link to the line of code that might be responsible for the problem)

Edited by 🤖 GitLab Bot 🤖