Skip to content

needs requires to replicate previous only:/except: filters

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

Summary

When having something like

### generic.yml
.filter-A:
  only:
    variables:
      - $A
      - $B

.filter-B:
  only:
    variables:
      - $C
      - $D

### .gitlab-ci.yml
# include: generic.yml

job-A:
  stage:   build
  extends: [.filter-A]
  script: echo a

job-B:
  stage:   build
  extends: [.filter-B]
  script: echo b

job-C:
  only:
    variables:
      - $E
  stage:   deploy
  needs: [job-A, job-B]
  script: echo c

gitlab fails when $E + $A is defined but not any of the other variables:

 The form contains the following error:

    job-C: needs 'job-B'

It does not make any sense to require replication of only:/except: filters from previous jobs here. In some cases (like above), it is nearly impossible because:

  • filters are implemented in an external .yml
  • multiple only: are very difficulty to combine and their complexity raises exponentially

Steps to reproduce

Run script above with A=t + E=t.

Example Project

https://gitlab.com/ensc/test-ci-needs/pipelines

What is the current bug behavior?

Pipeline fails

What is the expected correct behavior?

only job-A runs; job-B + job-C are silently skipped

Output of checks

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)

Edited by 🤖 GitLab Bot 🤖