No stages / jobs for this pipeline

hello,

I started to use gitlab for CI/CD.
In my .gitlab-ci.yml :

deploy_dev:
stage: deploy
tags:
- appli
only:
- master
script:

I would like to be able to run my pipeline on other branches. When I select a branch other than master in CI/CD > Pipelines I got No stages / jobs for this pipeline..

I guess this is because of my .gitlab-ci.yml where I put only master, but how to be able to switch branch ?

Thanks

Hi Marvin,

The runner will only run these jobs if the .gitlab-ci.yaml file is present in the branch. If your alternate branches do not have this file present, then it will need to be added.

Once it has been added to said branch and committed, you can view the pushed commit within the project area and ensure that the jobs ran.

Hi Caleb,
thanks for you reply.

I did something like that :

deploy_master:
stage: deploy
tags:
- appli
only:
- master
- merge_requests
script:
- …

deploy_branch:
stage: deploy
tags:
- appli
except:
- master
script:
- …
when: manual

Now I’m able to choose another branche when creating the pipeline. However, when I push onto any branches, In the CI/CD page, i’ve got a lot of skipped pipelines and manual jobs awaiting to be manually started. Is there a way to hide them ?
or maybe I’m doing it wrong
thanks

Hey Marvin,

Sorry for the late response. It seems like there is some confusion as to how some of the CI/CD parameters work. I recommend thoroughly reviewing the GitLab CI/CD Pipeline Configuration Reference, as I think it will answer a lot of your questions.

To quickly summarize:

Your current only: argument is configured so that the deploy_master job only applies to the master & merge_requests branches. This means that commits to all other branches will have this job skipped (probably what you are seeing).

Your current when: argument is configured to set the deploy_branch job as manual, but the except: argument is only configured to reference the master branch. This means that commits to all other branches will create a pending manual job (probably all the manual jobs you are seeing).

If you are looking to hide pending manual jobs or skipped jobs, that kind of indicates that they may not need to be present in the first place. Refactoring your .gitlab-ci.yml to do exactly what you are looking to accomplish is probably the better option here.

Let me know if something isn’t clear. :+1: