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
- New repo
- Add job1.gitlab-ci.yml
- Add job2.gitlab-ci.yml
- Add .gitlab-ci.yml
- Include both files
- 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)