Note:
the answer is not specific for this case, but might be useful to mention, since I missed this GitLab behaviour, from the official documentation.
(if you do, please edit or comment)
My case
I was having a main gitlab-ci.yaml that included definitions from a template.
gitlab-ci-template
.deploy_to_cloud:
stage: deploy
script:
- echo Deployed
gitlab-ci
include: repo.url/gitlab-ci-template
stages:
- deploy
deploy:
extends: .deploy_to_cloud
The problem
After copy-pasting and merging all in a single gitlab-ci.yml file
gitlab-ci
stages:
- deploy_to_cloud
.deploy_to_cloud:
stage: deploy
script:
- echo Deployed
I started to get a
jobs config should contain at least one visible job
and to notice that no job was being created anymore; this, just by moving some code to another place.
The problem was because I forgot to rename all the stage definitions!
The solution
There is Gitlab-CI naming rule:
The stage definition name must not start with a leading dot; otherwise it will be hidden and no job will be created for that stage!
Once noticed it makes total sense, given that linux files behave the same way.
Removing the initial dot from the stage definition name made Gitlab see the jobs again in my case.
gitlab-ci
stages:
- deploy_to_cloud
deploy_to_cloud: # notice the removed dot at the beginning
stage: deploy
script:
- echo Deployed