Skip to content

wrong complain about jobs config should contain at least one visible job

Update

This is not a bug, but an expected behavior as mentioned here while the static validator does not evaluate every rules , for example jobs. it does just for the includes because it has to do it. We should discuss this suggestion for ignoring rules completely and validate them in the pipeline simulation

Summary

As soon as you have rules on all of your includes, GitLab complains about "jobs config should contain at least one visible job"

Steps to reproduce

  1. New repo
  2. Add job1.gitlab-ci.yml
  3. Add job2.gitlab-ci.yml
  4. Add .gitlab-ci.yml
  5. Include both files
  6. Add valid conditions to both includes

Example Project

https://gitlab.com/lippoliv/gitlab-demo-ci-include-rules-should-contain-at-least-one-job

What is the current bug behavior?

You can see in my demo, that the rules would end up in one job to be executed. But GitLab complains about "jobs config should contain at least one visible job"

What is the expected correct behavior?

Since Jobs would be executed, the Pipeline should work.

Relevant logs and/or screenshots

.gitlab-ci.yml

stages:
    - build

include:
    - local: job1.gitlab-ci.yml
      rules:
        - if: '$CI_PIPELINE_SOURCE == "schedule"'
    
    - local: job2.gitlab-ci.yml
      rules:
        - if: '$CI_PIPELINE_SOURCE == "schedule"'
          when: never

job1.gitlab-ci.yml

job1:
    stage: build
    script: echo "JOB 1"

job2.gitlab-ci.yml

job2:
    stage: build
    script: echo "JOB 2"

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`)

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

Edited by 🤖 GitLab Bot 🤖